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