Makefile revision 22996
1#
2# $Id$
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 reporgrams 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
24CLEANFILES+= bi-$i bi-$i.o
25SRCS+= bc-$i.h
26
27.endfor
28
29bi-parser.c bi-parser.h:	bi-parser.y
30	${BISON} ${BISONFLAGS} -d ${.ALLSRC} -o ${.TARGET}
31
32SRCS+= bi-parser.c bi-parser.h
33
34CLEANFILES+= bi-lexer.o bi-parser.o bi-reverse.o
35
36#-----------------------------------------------------------------------
37# insn-* gunk
38
39.for i in config flags codes attr
40insn-$i.h:	gen$i ${MD_FILE}
41	./gen$i ${MD_FILE} > insn-$i.h
42SRCS+= insn-$i.h
43.endfor
44
45.for i in emit recog opinit extract peep attrtab output
46insn-$i.c:	gen$i ${MD_FILE}
47	./gen$i ${MD_FILE} > insn-$i.c
48SRCS+= insn-$i.c
49.endfor
50
51.for i in config flags codes emit opinit recog extract peep attr output
52gen$i:	gen$i.o rtl.o obstack.o
53	${CC} ${.ALLSRC} -o ${.TARGET}
54
55gen$i.o:	gen$i.c ${RTL_H}
56CLEANFILES+= gen$i gen$i.o
57.endfor
58
59.for i in attrtab
60gen$i:	gen$i.o rtl.o rtlanal.o print-rtl.o obstack.o
61	${CC} ${.ALLSRC} -o ${.TARGET}
62
63gen$i.o:	gen$i.c ${RTL_H}
64CLEANFILES+= gen$i gen$i.o
65.endfor
66
67CLEANFILES+= print-rtl.o rtl.o rtlanal.o obstack.o
68
69#-----------------------------------------------------------------------
70# C hash codes
71c-gperf.h: c-parse.gperf
72	gperf -p -j1 -i 1 -g -o -t -G -N is_reserved_word -k1,3,$$ \
73		${GCCDIR}/c-parse.gperf > ${.TARGET}
74SRCS+=	c-gperf.h
75
76#-----------------------------------------------------------------------
77# C++ hash codes
78hash.h: gxx.gperf
79	gperf -p -j1 -g -o -t -N is_reserved_word '-k1,4,7,$$' \
80		${GCCDIR}/cp/gxx.gperf >hash.h
81SRCS+=	hash.h
82
83#-----------------------------------------------------------------------
84# C parser
85c-parse.c c-parse.h: c-parse.in
86	sed -e "/^ifobjc$$/,/^end ifobjc$$/d" \
87	    -e "/^ifc$$/d" -e "/^end ifc$$/d" \
88	    ${GCCDIR}/c-parse.in > c-parse.y
89	${BISON} -d c-parse.y -o c-parse.c 
90	rm -f c-parse.y
91
92SRCS+=	c-parse.c c-parse.h
93CLEANFILES+= c-parse.y		# insurance
94
95#-----------------------------------------------------------------------
96# objc parser
97objc-parse.c objc-parse.h: c-parse.in
98	sed -e "/^ifc$$/,/^end ifc$$/d" \
99	    -e "/^ifobjc$$/d" -e "/^end ifobjc$$/d" \
100	    ${GCCDIR}/c-parse.in > objc-parse.y
101	${BISON} -d objc-parse.y -o objc-parse.c 
102	rm -f objc-parse.y
103
104SRCS+=	objc-parse.c objc-parse.h
105CLEANFILES+= objc-parse.y		# insurance
106
107#-----------------------------------------------------------------------
108# C++ parser done in it's own makefile
109#-----------------------------------------------------------------------
110# CPP parser done in it's own makefile
111#-----------------------------------------------------------------------
112# All generates sources are cleaned
113CLEANFILES+=	${SRCS}
114
115#-----------------------------------------------------------------------
116all:		${BINFORMAT} ${SRCS}
117
118beforedepend:	${BINFORMAT}
119
120#-----------------------------------------------------------------------
121# the host/target compiler config.
122
123aout:
124	@rm -f elf
125	echo '#include "i386/freebsd.h"'     > tm.h
126	echo '#include "i386/xm-freebsd.h"'  > config.h
127	echo '#include "i386/xm-freebsd.h"'  > hconfig.h
128	echo '#include "i386/xm-freebsd.h"'  > tconfig.h
129	echo '#include "cp/lang-options.h"'  > options.h
130	echo '#include "cp/lang-specs.h"'    > specs.h
131	echo '#include "f2c-specs.h"'        >> specs.h
132	@touch aout
133
134elf:
135	@rm -f aout
136	echo '#include "i386/freebsd-elf.h"' > tm.h
137	echo '#include "i386/xm-freebsd.h"'  > config.h
138	echo '#include "i386/xm-freebsd.h"'  > hconfig.h
139	echo '#include "i386/xm-freebsd.h"'  > tconfig.h
140	echo '#include "cp/lang-options.h"'  > options.h
141	echo '#include "cp/lang-specs.h"'    > specs.h
142	echo '#include "f2c-specs.h"'        >> specs.h
143	@touch elf
144
145CLEANFILES+=	config.h hconfig.h tconfig.h tm.h options.h specs.h elf aout
146
147.include <bsd.prog.mk>
148