Makefile revision 34813
1101776Stjr#
2101776Stjr# $Id: Makefile,v 1.9 1998/03/12 12:52:24 bde Exp $
3101776Stjr#
4101776Stjr
5227753Stheraven#
6227753Stheraven# This could probably be merged with ../cc_int/Makefile, but bsd.lib.mk
7227753Stheraven# is such a !@#!*#% nightmare because of how it reprograms the dependencies,
8227753Stheraven# suffix rules, SRCS, etc.  It's easiest to cheat by using bsd.prog.mk and
9227753Stheraven# SRCS to get dependencies.
10101776Stjr#
11101776Stjr
12101776Stjr.include "../Makefile.inc"
13101776Stjr
14101776Stjr#-----------------------------------------------------------------------
15101776Stjr# Bytecode components
16101776Stjr
17101776Stjr.for i in arity opcode opname
18101776Stjrbc-$i.h:	bi-$i bytecode.def
19101776Stjr	./bi-$i < ${GCCDIR}/bytecode.def > bc-$i.h
20101776Stjr
21101776Stjrbi-$i:	bi-$i.o bi-parser.o bi-lexer.o bi-reverse.o
22101776Stjr	${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC}
23101776Stjr
24101776StjrSRCS+= bc-$i.h
25101776StjrLOCOBJS+= bi-$i.o
26101776StjrCLEANFILES+= bi-$i bi-$i.o
27101776Stjr.endfor
28101776Stjr
29101776Stjr.ORDER: bi-parser.c bi-parser.h
30101776Stjrbi-parser.c bi-parser.h:	bi-parser.y
31101776Stjr	${BISON} ${BISONFLAGS} -d ${.ALLSRC} -o bi-parser.c
32101776Stjr
33101776StjrSRCS+= bi-parser.c bi-parser.h
34101776Stjr
35101776StjrLOCOBJS+= bi-lexer.o bi-parser.o bi-reverse.o
36101776StjrCLEANFILES+= bi-lexer.o bi-parser.o bi-reverse.o
37101776Stjr
38227753Stheraven#-----------------------------------------------------------------------
39101776Stjr# insn-* gunk
40101776Stjr
41101776Stjr.for i in config flags codes attr
42101776Stjrinsn-$i.h:	gen$i ${MD_FILE}
43129705Stjr	./gen$i ${MD_FILE} > insn-$i.h
44129705StjrSRCS+= insn-$i.h
45101776Stjr.endfor
46101776Stjr
47104080Stjr.for i in emit recog opinit extract peep attrtab output
48101776Stjrinsn-$i.c:	gen$i ${MD_FILE}
49101776Stjr	./gen$i ${MD_FILE} > insn-$i.c
50101776StjrSRCS+= insn-$i.c
51101776Stjr.endfor
52101776Stjr
53101776Stjr.for i in config flags codes emit opinit recog extract peep attr output
54101776Stjrgen$i:	gen$i.o rtl.o obstack.o
55227753Stheraven	${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC}
56227753Stheraven
57227753Stheravengen$i.o:	gen$i.c ${RTL_H}
58227753StheravenLOCOBJS+= gen$i.o
59227753StheravenCLEANFILES+= gen$i gen$i.o
60227753Stheraven.endfor
61
62.for i in attrtab
63gen$i:	gen$i.o rtl.o rtlanal.o print-rtl.o obstack.o
64	${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC}
65
66gen$i.o:	gen$i.c ${RTL_H}
67LOCOBJS+= gen$i.o
68CLEANFILES+= gen$i gen$i.o
69.endfor
70
71LOCOBJS+= print-rtl.o rtl.o rtlanal.o obstack.o
72CLEANFILES+= print-rtl.o rtl.o rtlanal.o obstack.o
73
74#-----------------------------------------------------------------------
75# C hash codes
76c-gperf.h: c-parse.gperf
77	gperf -p -j1 -i 1 -g -o -t -G -N is_reserved_word -k1,3,$$ \
78		${GCCDIR}/c-parse.gperf > ${.TARGET}
79SRCS+=	c-gperf.h
80
81#-----------------------------------------------------------------------
82# C++ hash codes
83hash.h: gxx.gperf
84	gperf -p -j1 -g -o -t -N is_reserved_word '-k1,4,7,$$' \
85		${GCCDIR}/cp/gxx.gperf >hash.h
86SRCS+=	hash.h
87
88#-----------------------------------------------------------------------
89# C parser
90.ORDER: c-parse.c c-parse.h
91c-parse.c c-parse.h: c-parse.in
92	sed -e "/^ifobjc$$/,/^end ifobjc$$/d" \
93	    -e "/^ifc$$/d" -e "/^end ifc$$/d" \
94	    ${GCCDIR}/c-parse.in > c-parse.y
95	${BISON} -d c-parse.y -o c-parse.c 
96	rm -f c-parse.y
97
98SRCS+=	c-parse.c c-parse.h
99CLEANFILES+= c-parse.y		# insurance
100
101#-----------------------------------------------------------------------
102# objc parser
103.ORDER: objc-parse.c objc-parse.h
104objc-parse.c objc-parse.h: c-parse.in
105	sed -e "/^ifc$$/,/^end ifc$$/d" \
106	    -e "/^ifobjc$$/d" -e "/^end ifobjc$$/d" \
107	    ${GCCDIR}/c-parse.in > objc-parse.y
108	${BISON} -d objc-parse.y -o objc-parse.c 
109	rm -f objc-parse.y
110
111SRCS+=	objc-parse.c objc-parse.h
112CLEANFILES+= objc-parse.y		# insurance
113
114#-----------------------------------------------------------------------
115# C++ parser done in its own makefile
116#-----------------------------------------------------------------------
117# CPP parser done in its own makefile
118#-----------------------------------------------------------------------
119# the host/target compiler config.
120
121COMMONHDRS=	config.h hconfig.h tconfig.h tm.h options.h specs.h
122
123${COMMONHDRS}:
124	echo '#include "${MACHINE_ARCH}/freebsd.h"'     > tm.h
125	echo '#include "${MACHINE_ARCH}/xm-freebsd.h"'  > config.h
126	echo '#include "${MACHINE_ARCH}/xm-freebsd.h"'  > hconfig.h
127	echo '#include "${MACHINE_ARCH}/xm-freebsd.h"'  > tconfig.h
128	echo '#include "cp/lang-options.h"'             > options.h
129	echo '#include "cp/lang-specs.h"'               > specs.h
130	echo '#include "f2c-specs.h"'                   >> specs.h
131
132SRCS+=	${COMMONHDRS}
133
134#-----------------------------------------------------------------------
135# Everything in ${SRCS} is generated
136CLEANFILES+=	${SRCS}
137
138#-----------------------------------------------------------------------
139all:		${SRCS}
140
141#-----------------------------------------------------------------------
142# We kept ${LOCOBJS} separate from ${OBJS} because adding all the
143# objects to ${OBJS} would give too many (cyclic) dependencies.
144# Add just enough dependencies for `make -j 1000' to work.
145${LOCOBJS}: ${COMMONHDRS}
146genattrtab.o:	insn-config.h
147genextract.o:	insn-config.h
148
149.include <bsd.prog.mk>
150