Makefile revision 18390
10Sstevel@tonic-gate#
20Sstevel@tonic-gate# $Id$
30Sstevel@tonic-gate#
40Sstevel@tonic-gate
50Sstevel@tonic-gate#
60Sstevel@tonic-gate# This could probably be merged with ../cc_int/Makefile, but bsd.lib.mk
70Sstevel@tonic-gate# is such a !@#!*#% nightmare because of how it reporgrams the dependencies,
80Sstevel@tonic-gate# suffix rules, SRCS, etc.  It's easiest to cheat by using bsd.prog.mk and
90Sstevel@tonic-gate# SRCS to get dependencies.
100Sstevel@tonic-gate#
110Sstevel@tonic-gate
120Sstevel@tonic-gate.include "../Makefile.inc"
130Sstevel@tonic-gate
140Sstevel@tonic-gate#-----------------------------------------------------------------------
150Sstevel@tonic-gate# Bytecode components
160Sstevel@tonic-gate
170Sstevel@tonic-gate.for i in arity opcode opname
180Sstevel@tonic-gatebc-$i.h:	bi-$i bytecode.def
190Sstevel@tonic-gate	./bi-$i < ${GCCDIR}/bytecode.def > bc-$i.h
200Sstevel@tonic-gate
210Sstevel@tonic-gatebi-$i:	bi-$i.o bi-parser.o bi-lexer.o bi-reverse.o
220Sstevel@tonic-gate	${CC} ${.ALLSRC} -o ${.TARGET}
230Sstevel@tonic-gate
240Sstevel@tonic-gateCLEANFILES+= bi-$i bi-$i.o
250Sstevel@tonic-gateSRCS+= bc-$i.h
260Sstevel@tonic-gate
270Sstevel@tonic-gate.endfor
280Sstevel@tonic-gate
290Sstevel@tonic-gatebi-parser.c bi-parser.h:	bi-parser.y
300Sstevel@tonic-gate	${BISON} ${BISONFLAGS} -d ${.ALLSRC} -o ${.TARGET}
310Sstevel@tonic-gate
320Sstevel@tonic-gateSRCS+= bi-parser.c bi-parser.h
330Sstevel@tonic-gate
340Sstevel@tonic-gateCLEANFILES+= bi-lexer.o bi-parser.o bi-reverse.o
350Sstevel@tonic-gate
360Sstevel@tonic-gate#-----------------------------------------------------------------------
370Sstevel@tonic-gate# insn-* gunk
380Sstevel@tonic-gate
390Sstevel@tonic-gate.for i in config flags codes attr
400Sstevel@tonic-gateinsn-$i.h:	gen$i ${MD_FILE}
410Sstevel@tonic-gate	./gen$i ${MD_FILE} > insn-$i.h
420Sstevel@tonic-gateSRCS+= insn-$i.h
430Sstevel@tonic-gate.endfor
440Sstevel@tonic-gate
450Sstevel@tonic-gate.for i in emit recog opinit extract peep attrtab output
460Sstevel@tonic-gateinsn-$i.c:	gen$i ${MD_FILE}
470Sstevel@tonic-gate	./gen$i ${MD_FILE} > insn-$i.c
480Sstevel@tonic-gateSRCS+= insn-$i.c
490Sstevel@tonic-gate.endfor
500Sstevel@tonic-gate
510Sstevel@tonic-gate.for i in config flags codes emit opinit recog extract peep attr output
520Sstevel@tonic-gategen$i:	gen$i.o rtl.o obstack.o
530Sstevel@tonic-gate	${CC} ${.ALLSRC} -o ${.TARGET}
540Sstevel@tonic-gate
550Sstevel@tonic-gategen$i.o:	gen$i.c ${RTL_H}
560Sstevel@tonic-gateCLEANFILES+= gen$i gen$i.o
570Sstevel@tonic-gate.endfor
580Sstevel@tonic-gate
592139Sjp161948.for i in attrtab
602139Sjp161948gen$i:	gen$i.o rtl.o rtlanal.o print-rtl.o obstack.o
612139Sjp161948	${CC} ${.ALLSRC} -o ${.TARGET}
622139Sjp161948
632139Sjp161948gen$i.o:	gen$i.c ${RTL_H}
642139Sjp161948CLEANFILES+= gen$i gen$i.o
652139Sjp161948.endfor
660Sstevel@tonic-gate
670Sstevel@tonic-gateCLEANFILES+= print-rtl.o rtl.o rtlanal.o obstack.o
680Sstevel@tonic-gate
690Sstevel@tonic-gate#-----------------------------------------------------------------------
700Sstevel@tonic-gate# C hash codes
710Sstevel@tonic-gatec-gperf.h: c-parse.gperf
720Sstevel@tonic-gate	gperf -p -j1 -i 1 -g -o -t -G -N is_reserved_word -k1,3,$$ \
730Sstevel@tonic-gate		${GCCDIR}/c-parse.gperf > ${.TARGET}
740Sstevel@tonic-gateSRCS+=	c-gperf.h
750Sstevel@tonic-gate
760Sstevel@tonic-gate#-----------------------------------------------------------------------
770Sstevel@tonic-gate# C++ hash codes
780Sstevel@tonic-gatehash.h: gxx.gperf
790Sstevel@tonic-gate	gperf -p -j1 -g -o -t -N is_reserved_word '-k1,4,7,$$' \
800Sstevel@tonic-gate		${GCCDIR}/cp/gxx.gperf >hash.h
810Sstevel@tonic-gateSRCS+=	hash.h
820Sstevel@tonic-gate
830Sstevel@tonic-gate#-----------------------------------------------------------------------
840Sstevel@tonic-gate# C parser
850Sstevel@tonic-gatec-parse.c c-parse.h: c-parse.in
860Sstevel@tonic-gate	sed -e "/^ifobjc$$/,/^end ifobjc$$/d" \
870Sstevel@tonic-gate	    -e "/^ifc$$/d" -e "/^end ifc$$/d" \
880Sstevel@tonic-gate	    ${GCCDIR}/c-parse.in > c-parse.y
890Sstevel@tonic-gate	${BISON} -d c-parse.y -o c-parse.c 
900Sstevel@tonic-gate	rm -f c-parse.y
910Sstevel@tonic-gate
920Sstevel@tonic-gateSRCS+=	c-parse.c c-parse.h
932139Sjp161948CLEANFILES+= c-parse.y		# insurance
940Sstevel@tonic-gate
950Sstevel@tonic-gate#-----------------------------------------------------------------------
960Sstevel@tonic-gate# objc parser
970Sstevel@tonic-gateobjc-parse.c objc-parse.h: c-parse.in
980Sstevel@tonic-gate	sed -e "/^ifc$$/,/^end ifc$$/d" \
990Sstevel@tonic-gate	    -e "/^ifobjc$$/d" -e "/^end ifobjc$$/d" \
1000Sstevel@tonic-gate	    ${GCCDIR}/c-parse.in > objc-parse.y
1010Sstevel@tonic-gate	${BISON} -d objc-parse.y -o objc-parse.c 
1020Sstevel@tonic-gate	rm -f objc-parse.y
1030Sstevel@tonic-gate
1040Sstevel@tonic-gateSRCS+=	objc-parse.c objc-parse.h
1050Sstevel@tonic-gateCLEANFILES+= objc-parse.y		# insurance
1060Sstevel@tonic-gate
1070Sstevel@tonic-gate#-----------------------------------------------------------------------
1080Sstevel@tonic-gate# C++ parser done in it's own makefile
1090Sstevel@tonic-gate#-----------------------------------------------------------------------
1100Sstevel@tonic-gate# CPP parser done in it's own makefile
1110Sstevel@tonic-gate#-----------------------------------------------------------------------
1120Sstevel@tonic-gate# All generates sources are cleaned
1130Sstevel@tonic-gateCLEANFILES+=	${SRCS}
1140Sstevel@tonic-gate
1152139Sjp161948#-----------------------------------------------------------------------
1162139Sjp161948all:		${BINFORMAT} ${SRCS}
1172139Sjp161948
1180Sstevel@tonic-gatebeforedepend:	${BINFORMAT}
1190Sstevel@tonic-gate
1200Sstevel@tonic-gate#-----------------------------------------------------------------------
1210Sstevel@tonic-gate# the host/target compiler config.
1220Sstevel@tonic-gate
1230Sstevel@tonic-gateaout:
1240Sstevel@tonic-gate	@rm -f elf
1250Sstevel@tonic-gate	echo '#include "i386/freebsd.h"'     > tm.h
1260Sstevel@tonic-gate	echo '#include "i386/xm-freebsd.h"'  > config.h
1270Sstevel@tonic-gate	echo '#include "i386/xm-freebsd.h"'  > hconfig.h
1280Sstevel@tonic-gate	echo '#include "i386/xm-freebsd.h"'  > tconfig.h
1290Sstevel@tonic-gate	echo '#include "cp/lang-options.h"'  > options.h
1300Sstevel@tonic-gate	echo '#include "cp/lang-specs.h"'    > specs.h
1310Sstevel@tonic-gate	echo '#include "f2c-specs.h"'        >> specs.h
1320Sstevel@tonic-gate	@touch aout
1330Sstevel@tonic-gate
1340Sstevel@tonic-gateelf:
1350Sstevel@tonic-gate	@rm -f aout
1360Sstevel@tonic-gate	echo '#include "i386/freebsd-elf.h"' > tm.h
1370Sstevel@tonic-gate	echo '#include "i386/xm-freebsd.h"'  > config.h
1380Sstevel@tonic-gate	echo '#include "i386/xm-freebsd.h"'  > hconfig.h
1390Sstevel@tonic-gate	echo '#include "i386/xm-freebsd.h"'  > tconfig.h
1400Sstevel@tonic-gate	echo '#include "cp/lang-options.h"'  > options.h
1410Sstevel@tonic-gate	echo '#include "cp/lang-specs.h"'    > specs.h
1420Sstevel@tonic-gate	echo '#include "f2c-specs.h"'        >> specs.h
1430Sstevel@tonic-gate	@touch elf
1442139Sjp161948
1450Sstevel@tonic-gateCLEANFILES+=	config.h hconfig.h tconfig.h tm.h options.h specs.h elf aout
1460Sstevel@tonic-gate
1470Sstevel@tonic-gate.include <bsd.prog.mk>
1480Sstevel@tonic-gate