Makefile revision 34229
1#
2# $Id: Makefile,v 1.7 1998/03/06 13:34:36 bde Exp $
3#
4
5#
6# This could probably be merged with ../cc_int/Makefile, but bsd.lib.mk
7# is such a !@#!*#% nightmare because of how it reprograms the dependencies,
8# suffix rules, SRCS, etc.  It's easiest to cheat by using bsd.prog.mk and
9# SRCS to get dependencies.
10#
11
12.include "../Makefile.inc"
13
14#-----------------------------------------------------------------------
15# Bytecode components
16
17.for i in arity opcode opname
18bc-$i.h:	bi-$i bytecode.def
19	./bi-$i < ${GCCDIR}/bytecode.def > bc-$i.h
20
21bi-$i:	bi-$i.o bi-parser.o bi-lexer.o bi-reverse.o
22	${CC} ${.ALLSRC} -o ${.TARGET}
23
24SRCS+= bc-$i.h
25LOCOBJS+= bi-$i.o
26CLEANFILES+= bi-$i bi-$i.o
27.endfor
28
29.ORDER: bi-parser.c bi-parser.h
30bi-parser.c bi-parser.h:	bi-parser.y
31	${BISON} ${BISONFLAGS} -d ${.ALLSRC} -o bi-parser.c
32
33SRCS+= bi-parser.c bi-parser.h
34
35LOCOBJS+= bi-lexer.o bi-parser.o bi-reverse.o
36CLEANFILES+= bi-lexer.o bi-parser.o bi-reverse.o
37
38#-----------------------------------------------------------------------
39# insn-* gunk
40
41.for i in config flags codes attr
42insn-$i.h:	gen$i ${MD_FILE}
43	./gen$i ${MD_FILE} > insn-$i.h
44SRCS+= insn-$i.h
45.endfor
46
47.for i in emit recog opinit extract peep attrtab output
48insn-$i.c:	gen$i ${MD_FILE}
49	./gen$i ${MD_FILE} > insn-$i.c
50SRCS+= insn-$i.c
51.endfor
52
53.for i in config flags codes emit opinit recog extract peep attr output
54gen$i:	gen$i.o rtl.o obstack.o
55	${CC} ${.ALLSRC} -o ${.TARGET}
56
57gen$i.o:	gen$i.c ${RTL_H}
58LOCOBJS+= gen$i.o
59CLEANFILES+= gen$i gen$i.o
60.endfor
61
62.for i in attrtab
63gen$i:	gen$i.o rtl.o rtlanal.o print-rtl.o obstack.o
64	${CC} ${.ALLSRC} -o ${.TARGET}
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}
133CLEANFILES+=	elf aout
134
135#-----------------------------------------------------------------------
136# Everything in ${SRCS} is generated
137CLEANFILES+=	${SRCS}
138
139#-----------------------------------------------------------------------
140all:		${COMMONHDRS} ${SRCS}
141
142#-----------------------------------------------------------------------
143beforedepend:	${COMMONHDRS}
144
145# We kept ${LOCOBJS} separate from ${OBJS} because adding all the
146# objects to ${OBJS} would give too many (cyclic) dependencies.
147# Add just enough dependencies for `make -j 1000' to work.
148${LOCOBJS}: ${COMMONHDRS}
149genattrtab.o:	insn-config.h
150genextract.o:	insn-config.h
151
152.include <bsd.prog.mk>
153