Makefile revision 162209
14Srgrimes# $FreeBSD: head/gnu/usr.bin/cc/cc_tools/Makefile 162209 2006-09-11 05:12:12Z imp $
24Srgrimes
34Srgrimes.include <bsd.own.mk>
44Srgrimes
54Srgrimes#
64Srgrimes# This could probably be merged with ../cc_int/Makefile, but bsd.lib.mk
74Srgrimes# is such a !@#!*#% nightmare because of how it reprograms the dependencies,
84Srgrimes# suffix rules, SRCS, etc.  It's easiest to cheat by using bsd.prog.mk and
94Srgrimes# SRCS to get dependencies.
104Srgrimes#
114Srgrimes
124Srgrimes#
134Srgrimes# ../Makefile.inc will put an absolute path to our objdir in CFLAGS.
144Srgrimes# Prevent mkdep from using it, so that we don't have to give rules for
154Srgrimes# aliases of generated headers.
164Srgrimes#
174SrgrimesCFLAGS+=	-I.
184Srgrimes
194Srgrimes.include "../Makefile.inc"
204Srgrimes
214Srgrimes.PATH: ${GCCDIR} ${GCCDIR}/f
224Srgrimes
234SrgrimesCFLAGS+=	-DGENERATOR_FILE
244Srgrimes
254Srgrimes#
264Srgrimes#-----------------------------------------------------------------------
274Srgrimes# Build 'pocket' libiberty exclusively for build tools use.
284Srgrimes
294SrgrimesLIBIBERTY_SRCS=	choose-temp.c concat.c cp-demangle.c cp-demint.c cplus-dem.c \
304Srgrimes	dyn-string.c fibheap.c getpwd.c getruntime.c hashtab.c hex.c \
314Srgrimes	lbasename.c make-temp-file.c md5.c obstack.c partition.c pex-unix.c \
324Srgrimes	physmem.c splay-tree.c xexit.c xmalloc.c xmemdup.c xstrdup.c xstrerror.c
334SrgrimesLIBIBERTY_OBJS=	${LIBIBERTY_SRCS:R:S/$/.o/g}
344Srgrimes
354SrgrimesSRCS+=	${LIBIBERTY_SRCS}
36556Srgrimes
3714835SbdeLIBIBERTY=libiberty.a
384Srgrimes${LIBIBERTY}: ${LIBIBERTY_OBJS}
394Srgrimes	@rm -f ${.TARGET}
404Srgrimes	@${AR} cq ${.TARGET} `lorder ${LIBIBERTY_OBJS} | tsort -q`
41757Sdg	${RANLIB} ${.TARGET}
42757SdgCLEANFILES+=	${LIBIBERTY}
43757Sdg
44757Sdg#
45757Sdg#-----------------------------------------------------------------------
464Srgrimes# options
474SrgrimesOPTION_FILES=${GCCDIR}/f/lang.opt ${GCCDIR}/c.opt ${GCCDIR}/common.opt
4814835Sbde
4913228Swollman.ORDER: options.h options.c
5014835Sbdeoptions.h options.c: opts.sh ${OPTION_FILES}
5114835Sbde	/bin/sh ${GCCDIR}/opts.sh mv options.c options.h ${OPTION_FILES}
5214835Sbde
535908SbdeGENSRCS+=	options.c options.h
544SrgrimesCLEANFILES+=	options.c options.h
5514835Sbde
5614835Sbde#-----------------------------------------------------------------------
5714835Sbde# insn-* gunk
5814835Sbde
5914835Sbde.for F in attr codes config flags constants
6014835Sbdeinsn-$F.h: gen$F ${MD_FILE}
6114835Sbde	./gen$F ${MD_FILE} > insn-$F.h
6214835SbdeGENSRCS+=	insn-$F.h
634Srgrimes.endfor
64757Sdg
65757Sdg.for F in conditions
664Srgrimesinsn-$F.c: gen$F ${MD_FILE}
674Srgrimes	./gen$F ${MD_FILE} > insn-$F.c
684SrgrimesGENSRCS+=	insn-$F.c
694Srgrimes.endfor
704Srgrimes
71200SdgGENSRCS+=	gen-time-stamp
724Srgrimesgen-time-stamp: genattr genattrtab genconditions genconstants genemit \
734Srgrimes		genextract gengtype genopinit genoutput genpeep genrecog
744Srgrimes	touch ${.TARGET}
753861Sbde
76592Srgrimes.for F in attr codes config emit extract flags opinit output peep recog
77592Srgrimesgen$F: gen$F.o rtl.o print-rtl.o bitmap.o gensupport.o  ggc-none.o \
78757Sdg	read-rtl.o insn-conditions.o min-insn-modes.o errors.o ${LIBIBERTY}
79592Srgrimes	${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC}
803861Sbde
813861SbdeGENSRCS+=	gen$F.c
823861SbdeCLEANFILES+=	gen$F
833861Sbde.endfor
84608Srgrimes
854Srgrimes#
864Srgrimes# genattrtab needs more complex build rule
874Srgrimes#
884Srgrimesgenattrtab : genattrtab.o rtl.o print-rtl.o bitmap.o gensupport.o ggc-none.o \
894Srgrimes	read-rtl.o insn-conditions.o genautomata.o varray.o min-insn-modes.o \
90592Srgrimes	errors.o ${LIBIBERTY}
91592Srgrimes	${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} -lm
92592Srgrimes
93757SdgGENSRCS+=	genattrtab.c
944SrgrimesCLEANFILES+=	genattrtab
954Srgrimes
964Srgrimes#
974Srgrimes# genconstants and genconditions cannot depend on insn-conditions.o
984Srgrimes# they should be liked with dummy-conditions.o stubs instead
994Srgrimes#
100570Srgrimes.for F in constants conditions
101134Sdggen$F: gen$F.o rtl.o bitmap.o gensupport.o ggc-none.o read-rtl.o dummy-conditions.o min-insn-modes.o errors.o ${LIBIBERTY}
1024Srgrimes	${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC}
103556Srgrimes
104556SrgrimesGENSRCS+=	gen$F.c
105556SrgrimesCLEANFILES+=	gen$F
106556Srgrimes.endfor
10714835Sbde
108134Sdg.for F in modes check genrtl preds
1093842Sdggen$F: gen$F.o errors.o ${LIBIBERTY}
11013729Sdg	${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC}
1113842Sdg
1123842SdgGENSRCS+=	gen$F.c
1133861SbdeCLEANFILES+=	gen$F
114134Sdg.endfor
1154600Sphk
1166308Sphk.ORDER: genrtl.c genrtl.h
1172783Ssosgenrtl.c genrtl.h: gengenrtl
118757Sdg	./gengenrtl > genrtl.c
1192216Sbde	./gengenrtl -h > genrtl.h
1206308Sphk
1216308SphkGENSRCS+=	genrtl.c genrtl.h
1222216Sbde
1235908SbdeSRCS+=	bitmap.c dummy-conditions.c errors.c genautomata.c gensupport.c \
124757Sdg	ggc-none.c print-rtl.c read-rtl.c rtl.c varray.c
125757Sdg
126757Sdg#-----------------------------------------------------------------------
1274Srgrimes# insn modes stuff.
128757Sdg
129757Sdg.ORDER: insn-modes.c insn-modes.h
1303861Sbdeinsn-modes.h: genmodes
131757Sdg	./genmodes -h > insn-modes.h
1323861Sbde
133757Sdginsn-modes.c: genmodes
1344Srgrimes	./genmodes > insn-modes.c
135757Sdg
136757Sdgmin-insn-modes.c: genmodes
137134Sdg	./genmodes -m > min-insn-modes.c
138757Sdg
139757SdgGENSRCS+= insn-modes.c min-insn-modes.c insn-modes.h
1401321Sdg
141757Sdg#-----------------------------------------------------------------------
142718Swollman# Common parser stuff.
143556Srgrimes
144556Srgrimestree-check.h: gencheck
145556Srgrimes	./gencheck > ${.TARGET}
1464SrgrimesGENSRCS+=	tree-check.h
147134Sdg
148134Sdg#-----------------------------------------------------------------------
149200Sdg# Predicates stuff.
150200Sdg
151134Sdgtm-preds.h: genpreds
1521321Sdg	./genpreds > ${.TARGET}
153757SdgGENSRCS+=	tm-preds.h
1544Srgrimes
1553384Srgrimes#-----------------------------------------------------------------------
1563384Srgrimes# Gengtype
1573384Srgrimes
1583384Srgrimesgengtype-lex.c : gengtype-lex.l
1592512Sbde	${LEX} -t  ${.ALLSRC} | \
1605603Sbde	sed 's/^\(char msg\[\];\)/yyconst \1/' > ${.TARGET}
1612486Sdg
1622486Sdg.ORDER: gengtype-yacc.c gengtype-yacc.h
1634217Sphkgengtype-yacc.c gengtype-yacc.h: gengtype-yacc.y
1644217Sphk	${YACC} -d -o gengtype-yacc.c ${.ALLSRC}
1654217Sphk
1664217SphkGENSRCS+=	gengtype-yacc+%DIKED.c gengtype-yacc.h gengtype-lex.c
1674217SphkCLEANFILES+=	gengtype-yacc.c
1684Srgrimes
1693284Srgrimesgengtype-yacc+%DIKED.c: gengtype-yacc.c
1703284Srgrimes	cat    ${.ALLSRC} > ${.TARGET}
1713284Srgrimes	sed -e "s/xmalloc/malloc/g" \
1723284Srgrimes	    -e "s/xrealloc/realloc/g" \
1733284Srgrimes	    -e "s/malloc/xmalloc/g" \
1743284Srgrimes	    -e "s/realloc/xrealloc/g" \
1753284Srgrimes	    ${.ALLSRC} > ${.TARGET}
1763284Srgrimes
1773284Srgrimesgengtype: gengtype.o gengtype-yacc+%DIKED.o gengtype-lex.o ${LIBIBERTY}
1783284Srgrimes	${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC}
1793284Srgrimes
1803284SrgrimesGENSRCS+=	gengtype.c
1813284SrgrimesCLEANFILES+=	gengtype
1823284Srgrimes
1833284Srgrimesgengtype-lex.o: gengtype-yacc.h
1843284Srgrimes
1853284Srgrimes.ORDER: gtype-desc.c gtype-desc.h
1863284Srgrimesgtype-desc.c gtype-desc.h: gtype-time-stamp
1873284Srgrimes	@true
1883284Srgrimes
1893284SrgrimesGENSRCS+=	gtype-time-stamp
1903284Srgrimesgtype-time-stamp: gengtype ${GTFILES}
1913284Srgrimes	./gengtype
1923384Srgrimes	touch ${.TARGET}
1933384Srgrimes
1944SrgrimesGENSRCS+=	gtype-desc.c gtype-desc.h
1953284SrgrimesCLEANFILES+=	gt-*.h gtype-*.h
1963284Srgrimes
1973284Srgrimes#
1983284Srgrimes#-----------------------------------------------------------------------
1993284Srgrimes# Fortran build tools
2003284Srgrimes
2013384Srgrimes.if ${MK_FORTRAN} != "no"
2023284Srgrimesgen-time-stamp: fini
2033284Srgrimesfini: fini.o ${LIBIBERTY}
2043284Srgrimes	${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC}
2053284SrgrimesSRCS+=		fini.c
2063284SrgrimesCLEANFILES+=	fini
2073284Srgrimes.endif
2083284Srgrimes
2093284Srgrimes#-----------------------------------------------------------------------
2103384Srgrimes# Determine content of variables used by the target/host config files
2113284Srgrimes
2123284Srgrimes#
2133284Srgrimes# The list of headers to go into tm.h
2143284Srgrimes#
2153284Srgrimes.if ${TARGET_ARCH} == "amd64"
2163284SrgrimesTARGET_INC=	i386/biarch64.h
2173284Srgrimes.endif
2183284SrgrimesTARGET_INC+=	${GCC_CPU}/${GCC_CPU}.h
2193284Srgrimes.if ${TARGET_ARCH} == "i386" || ${TARGET_ARCH} == "amd64"
2203284SrgrimesTARGET_INC+=	${GCC_CPU}/unix.h
2213384SrgrimesTARGET_INC+=	${GCC_CPU}/att.h
2223384Srgrimes.endif
2233384Srgrimes.if ${TARGET_ARCH} != "alpha"
2243284SrgrimesTARGET_INC+=	dbxelf.h
2253284SrgrimesTARGET_INC+=	elfos.h
2263384Srgrimes.endif
2275908SbdeTARGET_INC+=	freebsd-native.h
2283384SrgrimesTARGET_INC+=	freebsd-spec.h
2293384SrgrimesTARGET_INC+=	freebsd.h
2303384Srgrimes.if ${TARGET_ARCH} == "alpha"
2313384SrgrimesTARGET_INC+=	${GCC_CPU}/elf.h
2323384Srgrimes.endif
2333284Srgrimes.if ${TARGET_ARCH} != "i386" && ${TARGET_ARCH} != "amd64"
2343384Srgrimes.if exists(${GCCDIR}/config/${GCC_CPU}/sysv4.h)
2353284SrgrimesTARGET_INC+=	${GCC_CPU}/sysv4.h
2363384Srgrimes.endif
2373384Srgrimes.endif
2385908SbdeTARGET_INC+=	${GCC_CPU}/freebsd.h
2393384Srgrimes.if ${TARGET_ARCH} == "amd64"
2409344SdgTARGET_INC+=	${GCC_CPU}/x86-64.h
2419344SdgTARGET_INC+=	${GCC_CPU}/freebsd64.h
2423384SrgrimesTARGET_INC+=	freebsd64-fix.h
2439344Sdg.endif
2449344Sdg.if ${TARGET_ARCH} == "powepc"
2459344SdgTARGET_INC+=	altivec-defs.h
2469344Sdg.endif
2479344SdgTARGET_INC+=	defaults.h
2489344Sdg
2493384Srgrimes#
2503384Srgrimes# Use TARGET_INC as a template and build a list of target specific
2513384Srgrimes# include files for gengtype to scan
2523384Srgrimes#
2539344SdgGCONFIG_H=	${.CURDIR}/auto-host.h
2544600Sphk
2555908Sbde.for H in ${TARGET_INC}
2565908Sbde.for D in ${GCCDIR}/config ${GCCDIR} ${.CURDIR}
2575908Sbde.if exists($D/$H)
2585908SbdeGCONFIG_H+=	$D/$H
2594600Sphk.endif
2605908Sbde.endfor
2615908Sbde.endfor
2625908Sbde
2635908Sbde#
2645908Sbde# Define some variables to make blocks copied from Makefile.in happy
2655908Sbde#
2665908Sbdesrcdir=		${GCCDIR}
2675908SbdeHASHTAB_H=	${GCCDIR}/hashtab.h
2685908SbdeSPLAY_TREE_H=	${GCCDIR}/splay-tree.h
2694600Sphkout_file=	${GCCDIR}/config/${GCC_CPU}/${GCC_CPU}.c
2705908SbdeGTFILES_SRCDIR=	${GCCDIR}
2715908Sbde
2725908Sbde#
2734600Sphk# Copied unchanged from gcc/Makefile.in
2745908Sbde#
2754600SphkGTFILES = $(srcdir)/input.h $(srcdir)/coretypes.h $(srcdir)/cpplib.h \
2764600Sphk  $(GCONFIG_H) $(HASHTAB_H) $(SPLAY_TREE_H) \
2774600Sphk  $(srcdir)/bitmap.h $(srcdir)/coverage.c $(srcdir)/function.h  $(srcdir)/rtl.h \
2784600Sphk  $(srcdir)/optabs.h $(srcdir)/tree.h $(srcdir)/libfuncs.h $(srcdir)/hashtable.h \
2793426Srgrimes  $(srcdir)/real.h $(srcdir)/varray.h $(srcdir)/insn-addr.h \
2803384Srgrimes  $(srcdir)/cselib.h $(srcdir)/basic-block.h  $(srcdir)/cgraph.h \
2813384Srgrimes  $(srcdir)/c-common.h $(srcdir)/c-tree.h \
2823384Srgrimes  $(srcdir)/alias.c $(srcdir)/bitmap.c $(srcdir)/cselib.c $(srcdir)/cgraph.c \
2835908Sbde  $(srcdir)/dbxout.c $(srcdir)/dwarf2out.c $(srcdir)/dwarf2asm.c \
2843384Srgrimes  $(srcdir)/dojump.c \
2853384Srgrimes  $(srcdir)/emit-rtl.c $(srcdir)/except.c $(srcdir)/explow.c $(srcdir)/expr.c \
2863384Srgrimes  $(srcdir)/fold-const.c $(srcdir)/function.c \
2873384Srgrimes  $(srcdir)/gcse.c $(srcdir)/integrate.c $(srcdir)/lists.c $(srcdir)/optabs.c \
2883384Srgrimes  $(srcdir)/profile.c $(srcdir)/ra-build.c $(srcdir)/regclass.c \
2893384Srgrimes  $(srcdir)/reg-stack.c $(srcdir)/cfglayout.c $(srcdir)/langhooks.c \
2903384Srgrimes  $(srcdir)/sdbout.c $(srcdir)/stmt.c $(srcdir)/stor-layout.c \
2913795Sphk  $(srcdir)/stringpool.c $(srcdir)/tree.c $(srcdir)/varasm.c \
2923795Sphk  $(out_file)
2933406Sdg
2943384Srgrimes#
2953384Srgrimes# Build a list of frontend directories to look into
2963284Srgrimes#
2973284SrgrimesGTFILES_LANG_DIR_NAMES=
2983384Srgrimes
2993384Srgrimes.if ${MK_CXX} != "no"
3003284SrgrimesGTFILES_LANG_DIR_NAMES+=	cp
3013284Srgrimes.endif
3023384Srgrimes
303570Srgrimes.if ${MK_OBJC} != "no"
3043384SrgrimesGTFILES_LANG_DIR_NAMES+=	objc
305570Srgrimes.endif
3062783Ssos
3073489Sphk.if ${MK_FORTRAN} != "no"
3086512SphkGTFILES_LANG_DIR_NAMES+=	f
3096512Sphk.endif
3103489Sphk
3113258Sdg#
3121998Swollman# Build a list of language specific files for gengtype
3131321Sdg#
3141998Swollman.for L in ${GTFILES_LANG_DIR_NAMES} c
3151998Swollman.if exists(${GCCDIR}/$L-config-lang.in)
3161998Swollman# Source the language config file
3171998SwollmanL_GTFILES!=	sh -c '. ${GCCDIR}/$L-config-lang.in; echo $$gtfiles'
3181998Swollman.else
3191998SwollmanL_GTFILES!=	sh -c '. ${GCCDIR}/$L/config-lang.in; echo $$gtfiles'
3201998Swollman.endif
3211998Swollman.for F in ${L_GTFILES}
3221998SwollmanGTFILES_FILES+=	$F
3231998SwollmanGTFILES_LANGS+= $L
3241998Swollman.endfor
3251998Swollman.endfor
3261998SwollmanGTFILES+=	${GTFILES_FILES}
3271998Swollman
3281998Swollman#-----------------------------------------------------------------------
3291998Swollman# the host/target compiler config.
3301998Swollman
33113081SdgCOMMONHDRS=	bconfig.h config.h configargs.h gencheck.h multilib.h \
3321998Swollman		specs.h safe-ctype.h tconfig.h tm.h tm_p.h gcov-iov.h \
3331998Swollman		gtyp-gen.h
3341998SwollmanGENSRCS+=	${COMMONHDRS}
3351998Swollman
3361998SwollmanMFILE?=	${.CURDIR}/Makefile
3371998Swollman${COMMONHDRS}: ${MFILE}
3381998Swollman
3391998Swollmanconfigargs.h:
3401998Swollman	echo 'static const char configuration_arguments[] ='	> ${.TARGET}
3411998Swollman	echo '	"FreeBSD/${TARGET_ARCH} system compiler";'	>> ${.TARGET}
3421998Swollman	echo 'static const char thread_model[] = "posix";'	>> ${.TARGET}
3431998Swollman	echo 'static const struct {'				>> ${.TARGET}
3441998Swollman	echo '	const char *name, *value;'			>> ${.TARGET}
3451998Swollman	echo '} configure_default_options[] = {'		>> ${.TARGET}
3461998Swollman	echo '	{ "NULL", "NULL" } };'				>> ${.TARGET}
3471998Swollman
3481998Swollmantconfig.h:
3491998Swollman	echo '#ifndef GCC_TCONFIG_H'			> ${.TARGET}
3502495Spst	echo '#define GCC_TCONFIG_H'			>> ${.TARGET}
3512495Spst	echo '#ifdef IN_GCC'				>> ${.TARGET}
3522495Spst	echo '# include "ansidecl.h"'			>> ${.TARGET}
3532495Spst	echo '#endif'					>> ${.TARGET}
3542495Spst	echo '#define USED_FOR_TARGET'			>> ${.TARGET}
3552495Spst	echo '#endif /* GCC_TCONFIG_H */'		>> ${.TARGET}
3562495Spst
3572495Spstbconfig.h:
3582495Spst	echo '#ifndef GCC_BCONFIG_H'			> ${.TARGET}
3592495Spst	echo '#define GCC_BCONFIG_H'			>> ${.TARGET}
3602495Spst	echo '#include "auto-host.h"'			>> ${.TARGET}
3612495Spst.if exists(${GCCDIR}/config/${GCC_CPU}/${GCC_CPU}-modes.def)
3622495Spst	echo '#define EXTRA_MODES_FILE "${GCC_CPU}/${GCC_CPU}-modes.def"' >> ${.TARGET}
3632495Spst.endif
3642495Spst	echo '#ifdef IN_GCC'				>> ${.TARGET}
3652495Spst	echo '# include "ansidecl.h"'			>> ${.TARGET}
36613014Sdg	echo '#endif'					>> ${.TARGET}
3672495Spst	echo '#endif /* GCC_BCONFIG_H */'		>> ${.TARGET}
3682495Spst
3692495Spstgencheck.h:
3702495Spst	echo '#include "cp/cp-tree.def"'		> ${.TARGET}
3712495Spst	echo '#include "objc/objc-tree.def"'		>> ${.TARGET}
37210826Spst
3732495Spstmultilib.h:
37410826Spst	echo 'static const char *const multilib_raw[] = { \
3752495Spst	    "aout maout;", "elf !maout;", NULL };'	> ${.TARGET}
3762495Spst	echo 'static const char *const multilib_matches_raw[] = { \
37710826Spst	    "maout maout;", "melf melf;", NULL };'	>> ${.TARGET}
3783117Spst	echo 'static const char *multilib_extra = "";'	>> ${.TARGET}
37910826Spst	echo 'static const char *multilib_options = "";'>> ${.TARGET}
38010826Spst	echo 'static const char *const multilib_exclusions_raw[] = { \
38110826Spst	    NULL };'					>> ${.TARGET}
38210826Spst
3832495Spstspecs.h:
3842495Spst	echo '#include "cp/lang-specs.h"'		> ${.TARGET}
38510826Spst	echo '#include "f/lang-specs.h"'		>> ${.TARGET}
38610826Spst	echo '#include "objc/lang-specs.h"'		>> ${.TARGET}
38710826Spst
38810826Spstconfig.h: bconfig.h
38910826Spst	echo '#include <bconfig.h>'			> ${.TARGET}
39010826Spst
39110826Spsttm.h:
39210826Spst	echo '#ifndef GCC_TM_H'				> ${.TARGET}
39310826Spst	echo '#define GCC_TM_H'				>> ${.TARGET}
39410826Spst.if defined(TARGET_CPU_DEFAULT)
39510826Spst	echo "#define TARGET_CPU_DEFAULT (${TARGET_CPU_DEFAULT})" >> ${.TARGET}
39610826Spst.endif
39710826Spst	echo '#ifdef IN_GCC'				>> ${.TARGET}
39810826Spst.for H in ${TARGET_INC}
39910826Spst	echo '#include "$H"'				>> ${.TARGET}
40010826Spst.endfor
40110826Spst	echo '#if !defined GENERATOR_FILE && !defined USED_FOR_TARGET' >> ${.TARGET}
40210826Spst	echo '# include "insn-constants.h"'		>> ${.TARGET}
40310826Spst	echo '# include "insn-flags.h"'			>> ${.TARGET}
40410826Spst	echo '#endif'					>> ${.TARGET}
40510826Spst	echo '#endif'					>> ${.TARGET}
40610826Spst.if exists(${GCCDIR}/config/${GCC_CPU}/${GCC_CPU}-modes.def)
40710826Spst	echo '#define EXTRA_MODES_FILE "${GCC_CPU}/${GCC_CPU}-modes.def"' >> ${.TARGET}
40810826Spst.endif
40910826Spst	echo '#endif /* GCC_TM_H */'			>> ${.TARGET}
41010826Spst
41110826Spsttm_p.h:
41210826Spst	echo '#include "${GCC_CPU}/${GCC_CPU}-protos.h"'	>> ${.TARGET}
41310826Spst	echo '#include "tm-preds.h"'				>> ${.TARGET}
41410826Spst
41510826Spstsafe-ctype.h:
41610826Spst	echo '#include <ctype.h>'				> ${.TARGET}
41710826Spst.for Z in TOUPPER TOLOWER ISDIGIT ISXDIGIT ISUPPER ISLOWER ISALPHA ISALNUM \
41810826Spst    ISSPACE ISPUNCT ISGRAPH ISBLANK ISPRINT ISCNTRL
41910826Spst	echo '#define ${Z}	${Z:L}'				>> ${.TARGET}
42010826Spst.endfor
42110826Spst	echo "#define ISIDST(x)		\
42210826Spst		((x) == '_' || isalpha(x))"			>> ${.TARGET}
42310826Spst	echo "#define ISIDNUM(x)	\
42410826Spst		(isdigit(x) || ISIDST(x))"			>> ${.TARGET}
42510826Spst	echo "#define IS_VSPACE(x)	\
42610826Spst		((x) == '\n' || (x) == '\r')"			>> ${.TARGET}
42710826Spst	echo "#define IS_NVSPACE(x)	\
42813014Sdg		(!IS_VSPACE(x) && (isspace(x) || (x) == '\0'))"	>> ${.TARGET}
4291998Swollman	echo "#define IS_SPACE_OR_NUL(x)	\
4301998Swollman		(isspace(x) || (x) == '\0')"			>> ${.TARGET}
4311998Swollman
4326308Sphkgtyp-gen.h:
4336308Sphk	echo "/* This file is machine generated.  Do not edit.  */" > ${.TARGET}
4341998Swollman	echo "static const char *srcdir = "			>> ${.TARGET}
4351998Swollman	echo "\"$(GTFILES_SRCDIR)\";"				>> ${.TARGET}
4361998Swollman	echo "static const char *lang_files[] = {"		>> ${.TARGET}
4371998Swollman.for F in ${GTFILES_FILES}
4381998Swollman	echo "\"$F\", "						>> ${.TARGET}
4391998Swollman.endfor
4406308Sphk	echo "NULL};"						>> ${.TARGET}
4411998Swollman	echo "static const char *langs_for_lang_files[] = {"	>> ${.TARGET}
4426308Sphk.for F in ${GTFILES_LANGS}
4436308Sphk	echo "\"$F\", "						>> ${.TARGET}
4441998Swollman.endfor
4451998Swollman	echo "NULL};"						>> ${.TARGET}
4461998Swollman	echo "static const char *all_files[] = {"		>> ${.TARGET}
4471998Swollman.for F in ${GTFILES}
4481998Swollman	echo "\"$F\", "						>> ${.TARGET}
4491998Swollman.endfor
45013000Sdg	echo "NULL};"						>> ${.TARGET}
45113000Sdg	echo "static const char *lang_dir_names[] = { \"c\", "	>> ${.TARGET}
45213000Sdg.for F in ${GTFILES_LANG_DIR_NAMES}
45313000Sdg	echo "\"$F\", "						>> ${.TARGET}
45413000Sdg.endfor
45513000Sdg	echo "NULL};"						>> ${.TARGET}
45613000Sdg
457556Srgrimesgcov-iov.h:
45813000Sdg	echo "#define GCOV_VERSION ((gcov_unsigned_t)0x33303470)" >> ${.TARGET}
45913000Sdg
46013000Sdg#-----------------------------------------------------------------------
461556Srgrimes# General things.
4624Srgrimes
4634SrgrimesSRCS+=		${GENSRCS}
4644SrgrimesCLEANFILES+=	${GENSRCS}
4654Srgrimes
4664Srgrimesall:		${SRCS}
4674Srgrimes
4684Srgrimes.include <bsd.prog.mk>
4694Srgrimes
4704Srgrimes#-----------------------------------------------------------------------
4714Srgrimes# Fixups.
4724Srgrimes
4734Srgrimes# Set OBJS the same as bsd.prog.mk would do if we defined PROG.  We can't
4744Srgrimes# define PROG because we have multiple programs.
4754Srgrimes#
476757SdgOBJS+=		${SRCS:N*.h:R:S/$/.o/g}
4774SrgrimesCLEANFILES+=	${OBJS}
478570Srgrimes
479570Srgrimes.if !exists(${DEPENDFILE})
480570Srgrimes# Fudge pre-dependfile dependencies of objects in much the same way as
481570Srgrimes# bsd.prog.mk would do if we defined PROG.
482974Sdg
483570Srgrimes${OBJS}: ${COMMONHDRS}
484570Srgrimes
4854Srgrimesdummy-conditions.o:
486570Srgrimesgencheck.o:
487757Sdggenmodes.o:
4884Srgrimes
4891321Sdggenpreds.o: insn-modes.h
490757Sdggenconstants.o: insn-modes.h genrtl.h
4914Srgrimesgengtype.o: insn-modes.h genrtl.h gtyp-gen.h
492757Sdgrtl.o: insn-modes.h gtype-desc.h genrtl.h
493570Srgrimesbitmap.o: insn-modes.h gtype-desc.h genrtl.h
494760Srgrimesggc-none.o: gtype-desc.h
495757Sdggensupport.o: insn-modes.h genrtl.h
4964Srgrimesvarray.o: gtype-desc.h
4974Srgrimesgenautomata.o: insn-modes.h genrtl.h
4984Srgrimesgenconditions.o: insn-modes.h genrtl.h
4994Srgrimesgencodes.o: insn-modes.h genrtl.h
5005908Sbdegenconfig.o: insn-modes.h genrtl.h
5015908Sbdeprint-rtl.o: insn-modes.h genrtl.h tm-preds.h tree-check.h
5025908Sbderead-rtl.o: insn-modes.h genrtl.h
5035908Sbdegenattr.o: insn-modes.h genrtl.h
5045908Sbdegenemit.o: insn-modes.h genrtl.h
5055908Sbdegenflags.o: insn-modes.h genrtl.h
5065908Sbdegenopinit.o: insn-modes.h genrtl.h
5075908Sbdegenoutput.o: insn-modes.h genrtl.h
5085908Sbdegenpeep.o: insn-modes.h genrtl.h
5095908Sbdegenrecog.o: insn-modes.h genrtl.h
5105908Sbdegenextract.o: genrtl.h insn-config.h
5115908Sbdegenattrtab.o: insn-modes.h gtype-desc.h genrtl.h
5125908Sbdegenrtl.o: insn-modes.h genrtl.h gtype-desc.h
5135908Sbde
5145908Sbdeinsn-conditions.o: insn-constants.h tm-preds.h
515608Srgrimesinsn-modes.o: insn-modes.h
516974Sdgmin-insn-modes.o: insn-modes.h
517974Sdggtype-desc.o: insn-modes.h insn-config.h insn-codes.h tree-check.h
518974Sdg
519974Sdg.endif
520757Sdg