1
2/*
3 * XMakefile for xmake
4 */
5
6.set OD		obj
7.set SRCS	include.c list.c main.c subs.c var.c wild.c
8.set OBJS	$(SRCS:"*.c":"$(OD)/*.o")
9.set PROTOS	xmake-protos.h
10.set CFLAGS	-g -O
11.set LFLAGS
12.set XMKPROTO	xmkproto
13.set IBIN	/usr/local/bin
14.set MBIN	/usr/local/man/man1
15
16.set DIST	/home/httpd/htdocs/xmake
17.set VERS	1.06
18
19#if __GNUC__
20.set CFLAGS	-g -O2 -Wall -Wstrict-prototypes
21#endif
22.set CFLAGS	$(CFLAGS) $(EXTDEFS)
23
24all: $(OD) $(PROTOS) $(OD)/$(XMKPROTO) $(OD)/xmake
25
26fall: clean all
27
28$(OD) : $(OD)
29    mkdir %(left)
30
31$(OD)/xmake: $(OBJS)
32    cc $(CFLAGS) %(right) $(LFLAGS) -o %(left)
33
34$(OBJS):: $(PROTOS)
35
36$(OBJS):: defs.h
37
38$(OBJS): $(SRCS)
39    cc $(CFLAGS) '-DXMAKE_VERS="$(VERS)"' %(right) -o %(left) -c
40
41/*
42 * This is a cute hack to avoid running xmkproto
43 * on every invocation.
44 */
45
46$(PROTOS): $(OD)/$(XMKPROTO) $(OD)/.protook
47    @touch $(OD)/.protook
48
49$(OD)/.protook : $(SRCS)
50    $(OD)/$(XMKPROTO) -o $(PROTOS) %(right:"*.c")
51
52$(OD)/$(XMKPROTO): $(XMKPROTO).c
53    cc $(CFLAGS) %(right) -o %(left)
54
55
56clean:
57    rm -f $(OBJS) $(OD)/xmake $(OD)/$(XMKPROTO) core *.core $(OD)/.protook
58
59i: install
60
61install: all $(IBIN)/xmake $(IBIN)/$(XMKPROTO) $(MBIN)/xmake.1
62
63$(IBIN)/xmake $(IBIN)/$(XMKPROTO) : $(OD)/xmake $(OD)/$(XMKPROTO)
64    install -c -s -m 755 %(right) %(left)
65
66$(MBIN)/xmake.1 : xmake.1
67    install -c -m 644 %(right) %(left)
68
69dist: clean
70    @if [ -f $(DIST)/xmake-$(VERS).tgz ]; then echo "Destination already exists, remove old copy first"; exit 1; fi
71    (cd ..; tar czf $(DIST)/xmake.tgz.new xmake)
72    chown dillon:dillon $(DIST)/xmake.tgz.new
73    chmod 644 $(DIST)/xmake.tgz.new
74    mv -f $(DIST)/xmake.tgz.new $(DIST)/xmake-$(VERS).tgz
75
76