Makefile revision 34112
1#
2# $Id: Makefile,v 1.6 1998/01/25 09:47:46 jb 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# Everything in ${SRCS} is generated
120CLEANFILES+=	${SRCS}
121
122#-----------------------------------------------------------------------
123all:		${BINFORMAT} ${SRCS}
124
125#-----------------------------------------------------------------------
126beforedepend:	${BINFORMAT}
127
128#-----------------------------------------------------------------------
129# the host/target compiler config.
130
131COMMONHDRS=	config.h hconfig.h tconfig.h tm.h options.h specs.h
132
133${COMMONHDRS}:	${BINFORMAT}
134
135aout:
136	@rm -f elf
137	echo '#include "${MACHINE_ARCH}/freebsd.h"'     > tm.h
138	echo '#include "${MACHINE_ARCH}/xm-freebsd.h"'  > config.h
139	echo '#include "${MACHINE_ARCH}/xm-freebsd.h"'  > hconfig.h
140	echo '#include "${MACHINE_ARCH}/xm-freebsd.h"'  > tconfig.h
141	echo '#include "cp/lang-options.h"'             > options.h
142	echo '#include "cp/lang-specs.h"'               > specs.h
143	echo '#include "f2c-specs.h"'                   >> specs.h
144	@touch aout
145
146elf:
147	@rm -f aout
148	echo '#include "${MACHINE_ARCH}/freebsd-elf.h"' > tm.h
149	echo '#include "${MACHINE_ARCH}/xm-freebsd.h"'  > config.h
150	echo '#include "${MACHINE_ARCH}/xm-freebsd.h"'  > hconfig.h
151	echo '#include "${MACHINE_ARCH}/xm-freebsd.h"'  > tconfig.h
152	echo '#include "cp/lang-options.h"'             > options.h
153	echo '#include "cp/lang-specs.h"'               > specs.h
154	echo '#include "f2c-specs.h"'                   >> specs.h
155	@touch elf
156
157SRCS+=	${COMMONHDRS}
158CLEANFILES+=	elf aout
159
160# We kept ${LOCOBJS} separate from ${OBJS} because adding all the
161# objects to ${OBJS} would give too many (cyclic) dependencies.
162# Add just enough dependencies for `make -j 1000' to work.
163${LOCOBJS}: ${COMMONHDRS}
164genattrtab.o:	insn-config.h
165genextract.o:	insn-config.h
166
167.include <bsd.prog.mk>
168