Makefile revision 18390
1139825Simp#
286227Stmm# $Id$
3128776Stmm#
4167308Smarius
5128776Stmm#
686227Stmm# This could probably be merged with ../cc_int/Makefile, but bsd.lib.mk
786227Stmm# is such a !@#!*#% nightmare because of how it reporgrams the dependencies,
886227Stmm# suffix rules, SRCS, etc.  It's easiest to cheat by using bsd.prog.mk and
986227Stmm# SRCS to get dependencies.
1086227Stmm#
1186227Stmm
1286227Stmm.include "../Makefile.inc"
1386227Stmm
1486227Stmm#-----------------------------------------------------------------------
1586227Stmm# Bytecode components
1686227Stmm
1786227Stmm.for i in arity opcode opname
18128776Stmmbc-$i.h:	bi-$i bytecode.def
1986227Stmm	./bi-$i < ${GCCDIR}/bytecode.def > bc-$i.h
2086227Stmm
2186227Stmmbi-$i:	bi-$i.o bi-parser.o bi-lexer.o bi-reverse.o
2286227Stmm	${CC} ${.ALLSRC} -o ${.TARGET}
2386227Stmm
2486227StmmCLEANFILES+= bi-$i bi-$i.o
2586227StmmSRCS+= bc-$i.h
2686227Stmm
2786227Stmm.endfor
2886227Stmm
2986227Stmmbi-parser.c bi-parser.h:	bi-parser.y
3086227Stmm	${BISON} ${BISONFLAGS} -d ${.ALLSRC} -o ${.TARGET}
3186227Stmm
3286227StmmSRCS+= bi-parser.c bi-parser.h
3386227Stmm
3486227StmmCLEANFILES+= bi-lexer.o bi-parser.o bi-reverse.o
35146474Smarius
36146474Smarius#-----------------------------------------------------------------------
37146474Smarius# insn-* gunk
3886227Stmm
3986227Stmm.for i in config flags codes attr
4086227Stmminsn-$i.h:	gen$i ${MD_FILE}
4186227Stmm	./gen$i ${MD_FILE} > insn-$i.h
4286227StmmSRCS+= insn-$i.h
43130068Sphk.endfor
4486227Stmm
45167308Smarius.for i in emit recog opinit extract peep attrtab output
46167308Smariusinsn-$i.c:	gen$i ${MD_FILE}
4786227Stmm	./gen$i ${MD_FILE} > insn-$i.c
4886227StmmSRCS+= insn-$i.c
4986227Stmm.endfor
50167308Smarius
5186227Stmm.for i in config flags codes emit opinit recog extract peep attr output
52167308Smariusgen$i:	gen$i.o rtl.o obstack.o
5386227Stmm	${CC} ${.ALLSRC} -o ${.TARGET}
54167308Smarius
5586227Stmmgen$i.o:	gen$i.c ${RTL_H}
5686227StmmCLEANFILES+= gen$i gen$i.o
5786227Stmm.endfor
5886227Stmm
5986227Stmm.for i in attrtab
60133862Smariusgen$i:	gen$i.o rtl.o rtlanal.o print-rtl.o obstack.o
6186227Stmm	${CC} ${.ALLSRC} -o ${.TARGET}
62128776Stmm
6386227Stmmgen$i.o:	gen$i.c ${RTL_H}
6486227StmmCLEANFILES+= gen$i gen$i.o
6586227Stmm.endfor
6686227Stmm
6786227StmmCLEANFILES+= print-rtl.o rtl.o rtlanal.o obstack.o
68133862Smarius
6986227Stmm#-----------------------------------------------------------------------
7086227Stmm# C hash codes
7186227Stmmc-gperf.h: c-parse.gperf
72167308Smarius	gperf -p -j1 -i 1 -g -o -t -G -N is_reserved_word -k1,3,$$ \
73167308Smarius		${GCCDIR}/c-parse.gperf > ${.TARGET}
7486227StmmSRCS+=	c-gperf.h
7586227Stmm
7688823Stmm#-----------------------------------------------------------------------
7788823Stmm# C++ hash codes
7888823Stmmhash.h: gxx.gperf
7988823Stmm	gperf -p -j1 -g -o -t -N is_reserved_word '-k1,4,7,$$' \
8088823Stmm		${GCCDIR}/cp/gxx.gperf >hash.h
81128776StmmSRCS+=	hash.h
82128776Stmm
83167308Smarius#-----------------------------------------------------------------------
84146474Smarius# C parser
85128776Stmmc-parse.c c-parse.h: c-parse.in
86128776Stmm	sed -e "/^ifobjc$$/,/^end ifobjc$$/d" \
87128776Stmm	    -e "/^ifc$$/d" -e "/^end ifc$$/d" \
88128776Stmm	    ${GCCDIR}/c-parse.in > c-parse.y
89128776Stmm	${BISON} -d c-parse.y -o c-parse.c 
90128776Stmm	rm -f c-parse.y
91128776Stmm
92167308SmariusSRCS+=	c-parse.c c-parse.h
93167308SmariusCLEANFILES+= c-parse.y		# insurance
94167308Smarius
9586227Stmm#-----------------------------------------------------------------------
96178443Smarius# objc parser
97178443Smariusobjc-parse.c objc-parse.h: c-parse.in
98178443Smarius	sed -e "/^ifc$$/,/^end ifc$$/d" \
99167308Smarius	    -e "/^ifobjc$$/d" -e "/^end ifobjc$$/d" \
100167308Smarius	    ${GCCDIR}/c-parse.in > objc-parse.y
101167308Smarius	${BISON} -d objc-parse.y -o objc-parse.c 
102167308Smarius	rm -f objc-parse.y
103167308Smarius
10486227StmmSRCS+=	objc-parse.c objc-parse.h
10586227StmmCLEANFILES+= objc-parse.y		# insurance
10686227Stmm
107128776Stmm#-----------------------------------------------------------------------
10886227Stmm# C++ parser done in it's own makefile
10986227Stmm#-----------------------------------------------------------------------
11086227Stmm# CPP parser done in it's own makefile
11186227Stmm#-----------------------------------------------------------------------
11286227Stmm# All generates sources are cleaned
113167308SmariusCLEANFILES+=	${SRCS}
114167308Smarius
115167308Smarius#-----------------------------------------------------------------------
116167308Smariusall:		${BINFORMAT} ${SRCS}
117167308Smarius
118146474Smariusbeforedepend:	${BINFORMAT}
11986227Stmm
12086227Stmm#-----------------------------------------------------------------------
12186227Stmm# the host/target compiler config.
12286227Stmm
123167308Smariusaout:
124167308Smarius	@rm -f elf
125178443Smarius	echo '#include "i386/freebsd.h"'     > tm.h
126178443Smarius	echo '#include "i386/xm-freebsd.h"'  > config.h
127178443Smarius	echo '#include "i386/xm-freebsd.h"'  > hconfig.h
128167308Smarius	echo '#include "i386/xm-freebsd.h"'  > tconfig.h
129167308Smarius	echo '#include "cp/lang-options.h"'  > options.h
130167308Smarius	echo '#include "cp/lang-specs.h"'    > specs.h
13186227Stmm	echo '#include "f2c-specs.h"'        >> specs.h
132167308Smarius	@touch aout
133167308Smarius
134167308Smariuself:
135167308Smarius	@rm -f aout
136167308Smarius	echo '#include "i386/freebsd-elf.h"' > tm.h
137167308Smarius	echo '#include "i386/xm-freebsd.h"'  > config.h
138167308Smarius	echo '#include "i386/xm-freebsd.h"'  > hconfig.h
139167308Smarius	echo '#include "i386/xm-freebsd.h"'  > tconfig.h
14086227Stmm	echo '#include "cp/lang-options.h"'  > options.h
14186227Stmm	echo '#include "cp/lang-specs.h"'    > specs.h
14286227Stmm	echo '#include "f2c-specs.h"'        >> specs.h
14386227Stmm	@touch elf
14486227Stmm
145167308SmariusCLEANFILES+=	config.h hconfig.h tconfig.h tm.h options.h specs.h elf aout
14686227Stmm
14786227Stmm.include <bsd.prog.mk>
148167308Smarius