Makefile revision 169740
1246149Ssjg# $FreeBSD: head/gnu/usr.bin/cc/cc_tools/Makefile 169740 2007-05-19 07:56:08Z scottl $
2246149Ssjg
3246149Ssjg.include <bsd.own.mk>
4246149Ssjg
5246149SsjgCFLAGS+=	-I.
6246149SsjgLDFLAGS+=	-static
7246149Ssjg
8246149Ssjg.include "../Makefile.inc"
9246149Ssjg
10246149SsjgCFLAGS+=	-g
11246149SsjgCFLAGS+=	-DGENERATOR_FILE -DHAVE_CONFIG_H
12246149Ssjg
13246149Ssjg# Override LIBIBERTY set by Makefile.inc, We use our own for
14246149Ssjg# build tools.
15246149SsjgLIBIBERTY=	libiberty.a
16246149Ssjg
17246149Ssjg.PATH:	${GCCDIR} ${GCCLIB}/libiberty
18246149Ssjg
19246149Ssjg#-----------------------------------------------------------------------
20246149Ssjg# Determine content of variables used by the target/host config files
21246149Ssjg
22246149Ssjg#
23246149Ssjg# The list of headers to go into tm.h
24246149Ssjg#
25246149SsjgTARGET_INC+=	options.h
26246149Ssjg.if ${TARGET_ARCH} == "amd64"
27246149SsjgTARGET_INC+=	i386/biarch64.h
28246149Ssjg.endif
29246149Ssjg.if ${TARGET_ARCH} != "arm"
30246149SsjgTARGET_INC+=	${GCC_CPU}/${GCC_CPU}.h
31246149Ssjg.endif
32246149Ssjg.if ${TARGET_ARCH} == "i386" || ${TARGET_ARCH} == "amd64"
33246149SsjgTARGET_INC+=	${GCC_CPU}/unix.h
34246149SsjgTARGET_INC+=	${GCC_CPU}/att.h
35246149Ssjg.endif
36246149SsjgTARGET_INC+=	dbxelf.h
37246149SsjgTARGET_INC+=	elfos.h
38249033SsjgTARGET_INC+=	freebsd-native.h
39246149SsjgTARGET_INC+=	freebsd-spec.h
40249033SsjgTARGET_INC+=	freebsd.h
41249033Ssjg.if ${TARGET_ARCH} != "i386" && ${TARGET_ARCH} != "amd64"
42246149Ssjg.if exists(${GCCDIR}/config/${GCC_CPU}/sysv4.h)
43246149SsjgTARGET_INC+=	${GCC_CPU}/sysv4.h
44246149Ssjg.endif
45246149Ssjg.endif
46246149Ssjg.if ${TARGET_ARCH} == "amd64"
47246149SsjgTARGET_INC+=	${GCC_CPU}/x86-64.h
48246149SsjgTARGET_INC+=	${GCC_CPU}/freebsd.h
49246149SsjgTARGET_INC+=	${GCC_CPU}/freebsd64.h
50246149SsjgTARGET_INC+=	freebsd64-fix.h
51246149Ssjg.elif ${TARGET_ARCH} == "arm"
52246149SsjgTARGET_INC+=	${GCC_CPU}/elf.h
53246149SsjgTARGET_INC+=	${GCC_CPU}/aout.h
54246149SsjgTARGET_INC+=	${GCC_CPU}/freebsd.h
55246149SsjgTARGET_INC+=	${GCC_CPU}/arm.h
56246149Ssjg.else
57246149SsjgTARGET_INC+=	${GCC_CPU}/freebsd.h
58246149Ssjg.endif
59246149SsjgTARGET_INC+=	defaults.h
60246149Ssjg
61246149Ssjg.for H in ${TARGET_INC}
62246149Ssjg.for D in ${GCCDIR}/config ${GCCDIR} ${.CURDIR}
63246149Ssjg.if exists($D/$H)
64246149SsjgTARGET_INC_FILES+=     $D/$H
65246149Ssjg.endif
66246149Ssjg.endfor
67246149Ssjg.endfor
68246149Ssjg
69246149Ssjg#
70246149Ssjg# gtyp includes.
71246149Ssjg#
72246149Ssjgsrcdir=		${GCCDIR}
73246149SsjgCPPLIB_H=	${GCCLIB}/libcpp/include/line-map.h \
74246149Ssjg		${GCCLIB}/libcpp/include/cpplib.h
75246149SsjgSYMTAB_H=	${GCCLIB}/libcpp/include/symtab.h
76246149SsjgCPP_ID_DATA_H=	${CPPLIB_H} ${GCCLIB}/libcpp/include/cpp-id-data.h
77246149SsjgHASHTAB_H=	${GCCLIB}/include/hashtab.h
78246149SsjgSPLAY_TREE_H=	${GCCLIB}/include/splay-tree.h
79246149Ssjgout_file=	${srcdir}/config/${GCC_CPU}/${GCC_CPU}.c
80246149Ssjgtm_file_list=	${TARGET_INC_FILES}
81246149Ssjghost_xm_file_list= ${.CURDIR}/auto-host.h ${GCCLIB}/include/ansidecl.h
82246149SsjgGTFILES_SRCDIR=	${srcdir}
83246149Ssjg
84246149Ssjg# Copied unchanged from gcc/Makefile.in
85246149SsjgGTFILES = $(srcdir)/input.h $(srcdir)/coretypes.h \
86246149Ssjg  $(CPP_ID_DATA_H) $(host_xm_file_list) \
87246149Ssjg  $(tm_file_list) $(HASHTAB_H) $(SPLAY_TREE_H) $(srcdir)/bitmap.h \
88246149Ssjg  $(srcdir)/coverage.c $(srcdir)/rtl.h \
89246149Ssjg  $(srcdir)/optabs.h $(srcdir)/tree.h $(srcdir)/function.h $(srcdir)/libfuncs.h $(SYMTAB_H) \
90246149Ssjg  $(srcdir)/real.h $(srcdir)/varray.h $(srcdir)/insn-addr.h $(srcdir)/hwint.h \
91246149Ssjg  $(srcdir)/ipa-reference.h $(srcdir)/output.h \
92246149Ssjg  $(srcdir)/cselib.h $(srcdir)/basic-block.h  $(srcdir)/cgraph.h \
93246149Ssjg  $(srcdir)/c-common.h $(srcdir)/c-tree.h $(srcdir)/reload.h \
94246149Ssjg  $(srcdir)/alias.c $(srcdir)/bitmap.c $(srcdir)/cselib.c $(srcdir)/cgraph.c \
95246149Ssjg  $(srcdir)/ipa-prop.c $(srcdir)/ipa-cp.c $(srcdir)/ipa-inline.c \
96246149Ssjg  $(srcdir)/dbxout.c $(srcdir)/dwarf2out.c $(srcdir)/dwarf2asm.c \
97246149Ssjg  $(srcdir)/dojump.c $(srcdir)/tree-profile.c \
98246149Ssjg  $(srcdir)/emit-rtl.c $(srcdir)/except.c $(srcdir)/explow.c $(srcdir)/expr.c \
99246149Ssjg  $(srcdir)/function.c $(srcdir)/except.h \
100246149Ssjg  $(srcdir)/gcse.c $(srcdir)/integrate.c $(srcdir)/lists.c $(srcdir)/optabs.c \
101246149Ssjg  $(srcdir)/profile.c $(srcdir)/regclass.c \
102246149Ssjg  $(srcdir)/reg-stack.c $(srcdir)/cfglayout.c \
103246149Ssjg  $(srcdir)/sdbout.c $(srcdir)/stor-layout.c \
104246149Ssjg  $(srcdir)/stringpool.c $(srcdir)/tree.c $(srcdir)/varasm.c \
105246149Ssjg  $(srcdir)/tree-mudflap.c $(srcdir)/tree-flow.h \
106246149Ssjg  $(srcdir)/c-objc-common.c $(srcdir)/c-common.c $(srcdir)/c-parser.c \
107246149Ssjg  $(srcdir)/tree-ssanames.c $(srcdir)/tree-eh.c $(srcdir)/tree-ssa-address.c \
108246149Ssjg  $(srcdir)/tree-phinodes.c $(srcdir)/tree-cfg.c \
109246149Ssjg  $(srcdir)/tree-dfa.c $(srcdir)/tree-ssa-propagate.c \
110246149Ssjg  $(srcdir)/tree-iterator.c $(srcdir)/gimplify.c \
111246149Ssjg  $(srcdir)/tree-chrec.h $(srcdir)/tree-vect-generic.c \
112246149Ssjg  $(srcdir)/tree-ssa-operands.h $(srcdir)/tree-ssa-operands.c \
113246149Ssjg  $(srcdir)/tree-profile.c $(srcdir)/tree-nested.c \
114246149Ssjg  $(srcdir)/ipa-reference.c $(srcdir)/tree-ssa-structalias.h \
115246149Ssjg  $(srcdir)/tree-ssa-structalias.c \
116246149Ssjg  $(srcdir)/c-pragma.h $(srcdir)/omp-low.c \
117246149Ssjg  $(srcdir)/targhooks.c $(srcdir)/cgraphunit.c $(out_file) \
118246149Ssjg
119246149Ssjg# The list of frontend directories to look into
120246149SsjgGTFILES_LANG_DIR_NAMES=
121246149Ssjg
122246149Ssjg.if ${MK_CXX} != "no"
123246149SsjgGTFILES_LANG_DIR_NAMES+=	cp
124246149Ssjg.endif
125246149Ssjg
126246149Ssjg.if ${MK_OBJC} != "no"
127246149SsjgGTFILES_LANG_DIR_NAMES+=	objc
128246149Ssjg.endif
129246149Ssjg
130246149Ssjg# The list of language specific files for gengtype
131246149Ssjg.for L in ${GTFILES_LANG_DIR_NAMES} c
132246149Ssjg.if exists(${GCCDIR}/$L-config-lang.in)
133246149Ssjg# Source the language config file
134246149SsjgL_GTFILES!=	sh -c '. ${GCCDIR}/$L-config-lang.in; echo $$gtfiles'
135246149Ssjg.else
136246149SsjgL_GTFILES!=	sh -c '. ${GCCDIR}/$L/config-lang.in; echo $$gtfiles'
137246149Ssjg.endif
138246149Ssjg.for F in ${L_GTFILES}
139246149SsjgGTFILES_FILES+=	$F
140246149SsjgGTFILES_LANGS+= $L
141246149Ssjg.endfor
142246149Ssjg.endfor
143246149SsjgGTFILES+=	${GTFILES_FILES}
144246149Ssjg
145246149Ssjg#
146246149Ssjg# Tree definition files.
147246149Ssjg#
148246149SsjgTREE_DEF_FILES=
149246149Ssjg
150246149Ssjg.if ${MK_CXX} != "no"
151246149SsjgTREE_DEF_FILES+=	cp/cp-tree.def
152246149Ssjg.endif
153249033Ssjg
154246149Ssjg.if ${MK_OBJC} != "no"
155246149SsjgTREE_DEF_FILES+=	objc/objc-tree.def
156246149Ssjg.endif
157246149Ssjg
158246149Ssjg#
159246149Ssjg# Option files.
160246149Ssjg#
161246149SsjgOPT_FILES=	c.opt common.opt
162246149Ssjg
163246149Ssjg.if exists(${GCCDIR}/config/${GCC_CPU}/${GCC_CPU}.opt)
164246149SsjgOPT_FILES+=	${GCCDIR}/config/${GCC_CPU}/${GCC_CPU}.opt
165246149Ssjg.endif
166246149Ssjg
167246149Ssjg.if exists(${.CURDIR}/${GCC_CPU}-freebsd.opt)
168246149SsjgOPT_FILES+=	${.CURDIR}/${GCC_CPU}-freebsd.opt
169246149Ssjg.endif
170246149Ssjg
171246149Ssjg.if ${TARGET_ARCH} == "powerpc"
172246149SsjgOPT_FILES+=	${GCCDIR}/config/${GCC_CPU}/sysv4.opt
173246149Ssjg.endif
174246149Ssjg
175246149Ssjg.if ${TARGET_ARCH} == "sparc64"
176246149SsjgOPT_FILES+=	${GCCDIR}/config/${GCC_CPU}/long-double-switch.opt
177246149Ssjg.endif
178246149Ssjg
179249033Ssjg.if exists(${.CURDIR}/freebsd.opt)
180249033SsjgOPT_FILES+=	${.CURDIR}/freebsd.opt
181249033Ssjg.endif
182249033Ssjg
183249033Ssjg#-----------------------------------------------------------------------
184246149Ssjg# Build rules for header files and generator tools
185246149Ssjg
186246149Ssjg# Host config
187246149Ssjgconfig.h:
188246149Ssjg	TARGET_CPU_DEFAULT="${TARGET_CPU_DEFAULT}" \
189246149Ssjg	HEADERS="auto-host.h ansidecl.h" \
190246149Ssjg	DEFINES="" \
191246149Ssjg	/bin/sh ${GCCDIR}/mkconfig.sh ${.TARGET}
192246149Ssjg
193246149SsjgGENSRCS+=	config.h
194246149SsjgCLEANFILES+=	cs-config.h
195246149Ssjg
196246149Ssjg# Build config
197246149Ssjgbconfig.h:
198246149Ssjg	TARGET_CPU_DEFAULT="${TARGET_CPU_DEFAULT}" \
199249033Ssjg	HEADERS="auto-host.h ansidecl.h" \
200249033Ssjg	DEFINES="" \
201249033Ssjg	/bin/sh ${GCCDIR}/mkconfig.sh ${.TARGET}
202249033Ssjg.if exists(${GCCDIR}/config/${GCC_CPU}/${GCC_CPU}-modes.def)
203249033Ssjg	echo '#define EXTRA_MODES_FILE "${GCC_CPU}/${GCC_CPU}-modes.def"' >> ${.TARGET}
204249033Ssjg.endif
205249033Ssjg
206249033SsjgGENSRCS+=	bconfig.h
207249033SsjgCLEANFILES+=	cs-bconfig.h
208249033Ssjg
209249033Ssjg# tconfig.h
210246149Ssjgtconfig.h:
211249033Ssjg	TARGET_CPU_DEFAULT="${TARGET_CPU_DEFAULT}" \
212249033Ssjg	HEADERS="auto-host.h ansidecl.h" \
213249033Ssjg	DEFINES="USED_FOR_TARGET" \
214249033Ssjg	/bin/sh ${GCCDIR}/mkconfig.sh ${.TARGET}
215249033Ssjg
216249033SsjgGENSRCS+=	tconfig.h
217246149SsjgCLEANFILES+=	cs-tconfig.h
218246149Ssjg# Options
219246149Ssjgoptionlist: ${OPT_FILES}
220246149Ssjg	awk -f ${GCCDIR}/opt-gather.awk ${.ALLSRC} > ${.TARGET}
221246149Ssjg
222246149Ssjgoptions.h:	optionlist
223246149Ssjg	awk -f ${GCCDIR}/opt-functions.awk \
224246149Ssjg	    -f ${GCCDIR}/opth-gen.awk \
225249033Ssjg		< ${.ALLSRC} > ${.TARGET}
226249033Ssjg
227249033Ssjgoptions.c:	optionlist
228249033Ssjg	awk -f ${GCCDIR}/opt-functions.awk \
229246149Ssjg	    -f ${GCCDIR}/optc-gen.awk \
230246149Ssjg		-v header_name="config.h system.h coretypes.h tm.h" \
231246149Ssjg		< ${.ALLSRC} > ${.TARGET}
232246149SsjgGENONLY+=	optionlist options.h options.c
233246149Ssjg
234246149Ssjg# Target machine config
235246149Ssjgtm.h:
236246149Ssjg	TARGET_CPU_DEFAULT="${TARGET_CPU_DEFAULT}" \
237246149Ssjg	HEADERS="${TARGET_INC}" \
238246149Ssjg	DEFINES="" \
239246149Ssjg	/bin/sh ${GCCDIR}/mkconfig.sh ${.TARGET}
240246149Ssjg.if exists(${GCCDIR}/config/${GCC_CPU}/${GCC_CPU}-modes.def)
241246149Ssjg	echo '#define EXTRA_MODES_FILE "${GCC_CPU}/${GCC_CPU}-modes.def"' >> ${.TARGET}
242246149Ssjg.endif
243246149Ssjg
244246149SsjgGENSRCS+=	tm.h
245246149SsjgCLEANFILES+=	cs-tm.h
246246149Ssjg
247246149Ssjg# Target machine protos/preds.
248249033Ssjgtm_p.h:
249249033Ssjg	TARGET_CPU_DEFAULT="${TARGET_CPU_DEFAULT}" \
250246149Ssjg	HEADERS="${GCC_CPU}/${GCC_CPU}-protos.h tm-preds.h" \
251246149Ssjg	DEFINES="" \
252246149Ssjg	/bin/sh ${GCCDIR}/mkconfig.sh tm_p.h
253246149Ssjg
254246149SsjgGENSRCS+=	tm_p.h
255246149SsjgCLEANFILES+=	cs-tm_p.h
256246149Ssjg
257246149Ssjg# gencheck
258246149Ssjggencheck.h:
259246149Ssjg.for F in ${TREE_DEF_FILES}
260246149Ssjg	echo "#include \"$F\""					>> ${.TARGET}
261246149Ssjg.endfor
262246149Ssjg
263246149SsjgGENSRCS+=	gencheck.h
264246149Ssjg
265246149Ssjg
266246149Ssjg# Source header for gtyp generator.
267246149Ssjggtyp-gen.h:	${GTFILES}
268246149Ssjg	echo "/* This file is machine generated.  Do not edit.  */" > ${.TARGET}
269246149Ssjg	echo "static const char * const srcdir = "		>> ${.TARGET}
270246149Ssjg	echo "\"$(GTFILES_SRCDIR)\";"				>> ${.TARGET}
271246149Ssjg	echo "static const char * const lang_files[] = {"	>> ${.TARGET}
272246149Ssjg.for F in ${GTFILES_FILES}
273246149Ssjg	echo "\"$F\", "						>> ${.TARGET}
274246149Ssjg.endfor
275246149Ssjg	echo "NULL};"						>> ${.TARGET}
276246149Ssjg	echo "static const char * const langs_for_lang_files[] = {">> ${.TARGET}
277246149Ssjg.for F in ${GTFILES_LANGS}
278246149Ssjg	echo "\"$F\", "						>> ${.TARGET}
279246149Ssjg.endfor
280246149Ssjg	echo "NULL};"						>> ${.TARGET}
281246149Ssjg	echo "static const char * const all_files[] = {"	>> ${.TARGET}
282246149Ssjg.for F in ${GTFILES}
283246149Ssjg	echo "\"$F\", "						>> ${.TARGET}
284246149Ssjg.endfor
285246149Ssjg	echo "NULL};"						>> ${.TARGET}
286246149Ssjg	echo "static const char * const lang_dir_names[] = {"	>> ${.TARGET}
287246149Ssjg.for F in c ${GTFILES_LANG_DIR_NAMES}
288246149Ssjg	echo "\"$F\", "						>> ${.TARGET}
289246149Ssjg.endfor
290246149Ssjg	echo "NULL};"						>> ${.TARGET}
291246149Ssjg
292246149SsjgGENSRCS+=	gtyp-gen.h
293246149Ssjg
294246149Ssjg# Version header for gcov
295246149Ssjggcov-iov.h:
296246149Ssjg	echo "#define GCOV_VERSION ((gcov_unsigned_t)0x34303270)" >> ${.TARGET}
297246149Ssjg
298246149SsjgGENSRCS+=	gcov-iov.h
299246149Ssjg
300246149Ssjg# Multilib config file
301246149Ssjgmultilib.h:
302246149Ssjg	echo 'static const char *const multilib_raw[] = { \
303246149Ssjg	    ". ;", NULL };'					> ${.TARGET}
304246149Ssjg	echo 'static const char *const multilib_matches_raw[] = { \
305246149Ssjg	    NULL };'						>> ${.TARGET}
306246149Ssjg	echo 'static const char *multilib_extra = "";'		>> ${.TARGET}
307246149Ssjg	echo 'static const char *multilib_options = "";'	>> ${.TARGET}
308246149Ssjg	echo 'static const char *const multilib_exclusions_raw[] = { \
309246149Ssjg	    NULL };'						>> ${.TARGET}
310246149Ssjg
311246149SsjgGENSRCS+=	multilib.h
312246149Ssjg
313246149Ssjgconfigargs.h:
314246149Ssjg	echo 'static const char configuration_arguments[] ='	> ${.TARGET}
315246149Ssjg	echo '	"FreeBSD/${TARGET_ARCH} system compiler";'	>> ${.TARGET}
316246149Ssjg	echo 'static const char thread_model[] = "posix";'	>> ${.TARGET}
317246149Ssjg	echo 'static const struct {'				>> ${.TARGET}
318246149Ssjg	echo '	const char *name, *value;'			>> ${.TARGET}
319246149Ssjg	echo '} configure_default_options[] = {'		>> ${.TARGET}
320246149Ssjg	echo '	{ "NULL", "NULL" } };'				>> ${.TARGET}
321246149Ssjg
322246149SsjgGENSRCS+=	configargs.h
323246149Ssjg
324246149Ssjg# Language spec files
325246149Ssjgspecs.h:
326246149Ssjg	echo '#include "cp/lang-specs.h"'			> ${.TARGET}
327246149Ssjg	echo '#include "objc/lang-specs.h"'			>> ${.TARGET}
328246149Ssjg
329246149SsjgGENSRCS+=	specs.h
330246149Ssjg
331246149Ssjggstdint.h:
332246149Ssjg	echo '#include "sys/types.h"'				> ${.TARGET}
333246149Ssjg	echo '#include "sys/stdint.h"'				>> ${.TARGET}
334246149Ssjg
335246149SsjgGENSRCS+=	gstdint.h
336246149Ssjg
337246149Ssjg# Linked headers
338246149Ssjggthr-default.h: ${GCCDIR}/gthr-posix.h
339246149Ssjg	ln -sf ${.ALLSRC} ${.TARGET}
340246149Ssjg
341246149SsjgGENSRCS+=	gthr-default.h
342246149Ssjg
343246149Ssjgunwind.h: ${GCCDIR}/unwind-generic.h
344246149Ssjg	ln -sf ${.ALLSRC} ${.TARGET}
345246149Ssjg
346246149SsjgGENSRCS+=	unwind.h
347246149Ssjg
348246149Ssjg#
349246149Ssjg# gtype gunk
350246149Ssjg#
351246149Ssjggengtype-lex.c:	gengtype-lex.l
352246149Ssjg	flex -ogengtype-lex.c ${.ALLSRC}
353246149Ssjg
354246149Ssjggengtype-yacc.h: gengtype-yacc.y
355246149Ssjg	yacc -d -o gengtype-yacc.c ${.ALLSRC}
356246149Ssjg
357246149Ssjggengtype-yacc.c: gengtype-yacc.h
358246149Ssjg
359246149Ssjggengtype-yacc+%DIKED.c: gengtype-yacc.c
360246149Ssjg	cat    ${.ALLSRC} > ${.TARGET}
361246149Ssjg	sed -e "s/xmalloc/malloc/g" \
362246149Ssjg	    -e "s/xrealloc/realloc/g" \
363246149Ssjg	    -e "s/malloc/xmalloc/g" \
364246149Ssjg	    -e "s/realloc/xrealloc/g" \
365246149Ssjg	    ${.ALLSRC} > ${.TARGET}
366246149Ssjg
367246149SsjgGENSRCS+= gengtype-lex.c gengtype-yacc.h gengtype-yacc+%DIKED.c
368246149SsjgCLEANFILES+= gengtype-yacc.c
369246149Ssjg
370246149Ssjggengtype: gengtype.o gengtype-yacc+%DIKED.o gengtype-lex.o errors.o \
371246149Ssjg	  ${LIBIBERTY}
372246149Ssjg	${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC}
373246149Ssjg
374246149Ssjggtype-desc.h:	gengtype
375246149Ssjg	./gengtype
376246149Ssjg	touch ${.TARGET}
377246149Ssjg
378246149Ssjggtype-desc.c:	gtype-desc.h
379246149Ssjg
380246149SsjgGENONLY+=	gtype-desc.c gtype-desc.h
381246149SsjgCLEANFILES+=	gt-*.h gtype-*.h
382246149Ssjg
383246149Ssjg#
384246149Ssjg# Generator tools.
385246149Ssjg#
386246149Ssjg.for F in check checksum genrtl modes
387246149Ssjggen$F:	gen$F.o errors.o ${LIBIBERTY}
388246149Ssjg	${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC}
389246149Ssjg.endfor
390246149Ssjg
391246149Ssjg.for F in attr attrtab automata codes conditions config constants emit \
392246149Ssjg	extract flags  opinit output peep preds recog
393246149Ssjggen$F:	gen$F.o rtl.o read-rtl.o ggc-none.o vec.o min-insn-modes.o \
394246149Ssjg	gensupport.o print-rtl.o errors.o ${LIBIBERTY}
395246149Ssjg	${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} -lm
396246149Ssjg.endfor
397246149Ssjg
398246149Ssjggencondmd:	gencondmd.o
399246149Ssjg	${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC}
400246149Ssjg
401246149Ssjg#
402246149Ssjg# Generated .md files.
403246149Ssjg#
404246149Ssjginsn-conditions.md:	gencondmd
405246149Ssjg	./gencondmd > ${.TARGET}
406246149SsjgGENSRCS+=	insn-conditions.md
407246149Ssjg
408246149Ssjg#
409246149Ssjg# Generated header files.
410246149Ssjg#
411246149Ssjg
412246149Ssjg.for F in constants
413246149Ssjginsn-$F.h:	gen$F ${MD_FILE}
414246149Ssjg	./gen$F ${MD_FILE} > ${.TARGET}
415246149SsjgGENSRCS+=	insn-$F.h
416246149Ssjg.endfor
417246149Ssjg
418246149Ssjg.for F in attr codes config flags
419246149Ssjginsn-$F.h:	gen$F ${MD_FILE} insn-conditions.md
420246149Ssjg	./gen$F ${MD_FILE} insn-conditions.md > ${.TARGET}
421246149SsjgGENSRCS+=	insn-$F.h
422246149Ssjg.endfor
423246149Ssjg
424246149Ssjg# Header files with irregular names.
425246149Ssjggenrtl.h:	gengenrtl
426246149Ssjg	./gengenrtl -h > ${.TARGET}
427246149SsjgGENSRCS+=	genrtl.h
428246149Ssjg
429246149Ssjgtm-preds.h:	genpreds
430246149Ssjg	./genpreds -h ${MD_FILE} > ${.TARGET}
431246149SsjgGENSRCS+=	tm-preds.h
432246149Ssjg
433246149Ssjgtm-constrs.h:	genpreds
434246149Ssjg	./genpreds -c ${MD_FILE} > ${.TARGET}
435246149SsjgGENSRCS+=	tm-constrs.h
436246149Ssjg
437246149Ssjgtree-check.h:	gencheck
438246149Ssjg	./gencheck > ${.TARGET}
439246149SsjgGENSRCS+=	tree-check.h
440246149Ssjg
441246149Ssjginsn-modes.h:	genmodes
442246149Ssjg	./genmodes -h > ${.TARGET}
443246149SsjgGENSRCS+=	insn-modes.h
444246149Ssjg
445246149Ssjg#
446246149Ssjg# Generated source files.
447246149Ssjg#
448246149Ssjg.for F in attrtab automata emit extract opinit output peep preds recog
449246149Ssjginsn-$F.c:	gen$F ${MD_FILE} insn-conditions.md
450246149Ssjg	./gen$F ${MD_FILE} insn-conditions.md > ${.TARGET}
451246149SsjgGENONLY+=	insn-$F.c
452246149Ssjg.endfor
453246149Ssjg
454246149Ssjg.for F in conditions
455246149Ssjginsn-$F.c:	gen$F ${MD_FILE}
456246149Ssjg	./gen$F ${MD_FILE} > ${.TARGET}
457246149SsjgGENSRCS+=	insn-$F.c
458246149Ssjg.endfor
459246149Ssjg
460246149Ssjg# Source files with irregular names.
461246149Ssjginsn-modes.c:	genmodes
462246149Ssjg	./genmodes > ${.TARGET}
463246149SsjgGENONLY+=	insn-modes.c
464246149Ssjg
465246149Ssjgmin-insn-modes.c:	genmodes
466246149Ssjg	./genmodes -m > ${.TARGET}
467246149SsjgGENSRCS+=	min-insn-modes.c
468246149Ssjg
469246149Ssjggenrtl.c:	gengenrtl
470246149Ssjg	./gengenrtl > ${.TARGET}
471246149SsjgGENONLY+=	genrtl.c
472246149Ssjg
473246149Ssjggencondmd.c:	genconditions ${MD_FILE}
474246149Ssjg	./genconditions ${MD_FILE} > ${.TARGET}
475246149SsjgGENSRCS+=	gencondmd.c
476246149Ssjg
477246149Ssjg#-----------------------------------------------------------------------
478246149Ssjg# Build tools.
479246149Ssjg
480246149SsjgGNTOOLS+=	genattr genattrtab genautomata gencodes gencheck genchecksum \
481246149Ssjg		genconditions gencondmd genconfig genconstants genemit \
482246149Ssjg		genextract genflags gengenrtl gengtype genmodes genopinit \
483246149Ssjg		genoutput genpeep genpreds genrecog
484246149Ssjg
485246149Ssjgall: ${GNTOOLS} ${GENSRCS} ${GENONLY}
486246149Ssjgbeforedepend: ${GENONLY}
487246149Ssjg
488246149Ssjg#
489246149Ssjg#-----------------------------------------------------------------------
490246149Ssjg# Build 'pocket' libiberty exclusively for build tools use.
491246149Ssjg
492246149SsjgLIBIBERTY_SRCS=	choose-temp.c concat.c cp-demangle.c cp-demint.c cplus-dem.c \
493246149Ssjg	dyn-string.c fibheap.c fopen_unlocked.c getpwd.c getruntime.c \
494246149Ssjg	hashtab.c hex.c lbasename.c make-temp-file.c md5.c obstack.c \
495246149Ssjg	partition.c pex-unix.c physmem.c safe-ctype.c splay-tree.c xexit.c \
496246149Ssjg	xmalloc.c xmemdup.c xstrdup.c xstrerror.c
497246149SsjgLIBIBERTY_OBJS=	${LIBIBERTY_SRCS:R:S/$/.o/g}
498246149Ssjg
499246149Ssjg.for _src in ${LIBIBERTY_SRCS}
500246149Ssjg${_src:R:S/$/.o/}: ${_src}
501246149Ssjg	${CC} -c -I ${.CURDIR}/../libiberty ${CFLAGS} -o ${.TARGET} ${.IMPSRC}
502246149Ssjg.endfor
503246149Ssjg
504246149Ssjg${LIBIBERTY}: ${LIBIBERTY_OBJS}
505246149Ssjg	@rm -f ${.TARGET}
506246149Ssjg	@${AR} cq ${.TARGET} `lorder ${LIBIBERTY_OBJS} | tsort -q`
507246149Ssjg	${RANLIB} ${.TARGET}
508246149SsjgCLEANFILES+=	${LIBIBERTY} ${LIBIBERTY_OBJS}
509246149Ssjg
510246149Ssjg
511246149Ssjg#-----------------------------------------------------------------------
512246149Ssjg# Fixups.
513246149Ssjg
514246149Ssjg# Set OBJS the same as bsd.prog.mk would do if we defined PROG.  We can't
515246149Ssjg# define PROG because we have multiple programs.
516246149Ssjg#
517246149SsjgSRCS=		errors.c genattr.c genattrtab.c \
518246149Ssjg		genautomata.c gencheck.c genchecksum.c gencodes.c \
519246149Ssjg		genconditions.c genconfig.c genconstants.c genemit.c \
520246149Ssjg		genextract.c genflags.c gengenrtl.c gengtype.c genmodes.c \
521246149Ssjg		genopinit.c genoutput.c genpeep.c genpreds.c genrecog.c \
522246149Ssjg		gensupport.c ggc-none.c print-rtl.c read-rtl.c rtl.c \
523246149Ssjg		vec.c
524246149Ssjg
525246149SsjgSRCS+=		${GENSRCS}
526246149SsjgOBJS+=		${SRCS:N*.h:R:S/$/.o/g}
527246149SsjgGENOBJS+=	${GENSRCS:N*.h:R:S/$/.o/g}
528246149SsjgCLEANFILES+=	${GENSRCS} ${GENONLY} ${GENOBJS} ${GNTOOLS}
529246149Ssjg
530246149Ssjg#-----------------------------------------------------------------------
531246149Ssjg# Manual dependencies.
532246149Ssjg.if !exists(${DEPENDFILE})
533246149Ssjg.include  "Makefile.dep"
534246149Ssjg.endif
535246149Ssjg
536246149Ssjg.include <bsd.prog.mk>
537246149Ssjg# DO NOT DELETE
538246149Ssjg