1#
2# Makefile for BtYacc.
3#
4
5VERSION       = 3-0
6
7DEST	      = .
8
9HDRS	      = defs.h mstring.h
10
11CFLAGS	      = -g -Wall -Wstrict-prototypes -Wmissing-prototypes
12
13LDFLAGS	      =
14
15LIBS	      =
16
17CC	      = cc
18LINKER	      = cc
19# LINKER      = cl
20# CC	      = cl
21
22MAKEFILE      = Makefile
23
24OBJS	      = closure.o dtor.o error.o lalr.o lr0.o main.o mkpar.o	\
25		output.o mstring.o reader.o readskel.o skeleton.o	\
26		symtab.o verbose.o warshall.o
27
28PRINT	      = pr -f -l88
29
30PROGRAM	      = btyacc
31
32SRCS	      = closure.c dtor.c error.c lalr.c lr0.c main.c mkpar.c	\
33		output.c mstring.c reader.c readskel.c skeleton.c	\
34		symtab.c verbose.c warshall.c
35
36OTHERS	      = README README.BYACC \
37		Makefile btyaccpa.ske push.skel empty.y skel2c manpage	\
38		makefile.dos skeleton.c
39
40TEST_GEN      = test/*.tab.c test/*.code.c test/*.tab.h test/*.output	\
41		test/*.o test/a.out test/tmp.txt
42
43all:		$(PROGRAM)
44
45$(PROGRAM):     $(OBJS) $(LIBS)
46		$(LINKER) $(LDFLAGS) -o $(PROGRAM) $(OBJS) $(LIBS)
47
48clean:;		rm -f $(OBJS) $(TEST_GEN)
49
50clobber:;	rm -f $(OBJS) $(PROGRAM)
51
52distclean:;	rm -f $(OBJS) $(PROGRAM) skeleton.c *.zip *.gz $(TEST_GEN) \
53		test/faillog.txt
54
55depend:;	mkmf -f $(MAKEFILE) PROGRAM=$(PROGRAM) DEST=$(DEST)
56
57index:;		ctags -wx $(HDRS) $(SRCS)
58
59install:	$(PROGRAM)
60		cp $(PROGRAM).exe /bin
61
62oldinstall:	$(PROGRAM)
63		@echo Installing $(PROGRAM) in $(DEST)
64		install -s $(PROGRAM) $(DEST)
65
66listing:;	$(PRINT) Makefile $(HDRS) $(SRCS) | lpr
67
68lint:;		lint $(SRCS)
69
70program:        $(PROGRAM)
71
72tags:           $(HDRS) $(SRCS)
73		ctags $(HDRS) $(SRCS)
74
75dist:		tar zip
76
77tar:
78		rm -f btyacc.tar btyacc.tar.gz
79		tar cvf btyacc.tar $(OTHERS) $(SRCS) $(HDRS) test/*.y
80		gzip -9 btyacc.tar
81		mv btyacc.tar.gz btyacc-$(VERSION).tar.gz
82
83zip:
84		zip btyacc.zip $(OTHERS) $(SRCS) $(HDRS) test/*.y
85		mv btyacc.zip btyacc-$(VERSION).zip
86
87skeleton.c: btyaccpa.ske skel2c
88		@echo "/*" >$@
89		@echo "** This file generated automatically from $<" >>$@
90		@echo "*/" >>$@
91		@echo >>$@
92		awk -f skel2c btyaccpa.ske >>$@
93
94test: program
95		@cd test; CC=$(CC) ./runtests
96
97etags TAGS:
98		etags *.c *.h
99
100help:
101	@echo "A simple 'make' will build btyacc"
102	@echo "'make test' will run some automated regression tests"
103
104.PHONY: all clean clobber distclean depend index install oldinstall listing lint program dist tar zip test help
105
106###
107closure.o: defs.h
108dtor.o: defs.h
109error.o: defs.h
110lalr.o: defs.h
111lr0.o: defs.h
112main.o: defs.h
113mkpar.o: defs.h
114mstring.o: mstring.h
115output.o: defs.h
116reader.o: defs.h mstring.h
117readskel.o: defs.h
118skeleton.o: defs.h
119symtab.o: defs.h
120verbose.o: defs.h
121warshall.o: defs.h
122