Makefile revision 56806
1191783Srmacklem# $FreeBSD: head/gnu/usr.bin/cc/cc_tools/Makefile 56806 2000-01-29 12:38:21Z obrien $ 2191783Srmacklem 3191783Srmacklem# 4191783Srmacklem# This could probably be merged with ../cc_int/Makefile, but bsd.lib.mk 5191783Srmacklem# is such a !@#!*#% nightmare because of how it reprograms the dependencies, 6191783Srmacklem# suffix rules, SRCS, etc. It's easiest to cheat by using bsd.prog.mk and 7191783Srmacklem# SRCS to get dependencies. 8191783Srmacklem# 9191783Srmacklem 10191783Srmacklem# ../Makefile.inc will put an absolute path to our objdir in CFLAGS. 11191783Srmacklem# Prevent mkdep from using it, so that we don't have to give rules for 12191783Srmacklem# aliases of generated headers. 13191783Srmacklem 14191783SrmacklemCFLAGS+= -I. 15191783Srmacklem 16191783Srmacklem.include "../Makefile.inc" 17191783Srmacklem 18191783Srmacklem.PATH: ${GCCDIR} ${GCCDIR}/cp 19191783Srmacklem 20191783Srmacklem#----------------------------------------------------------------------- 21191783Srmacklem# insn-* gunk 22191783Srmacklem 23191783Srmacklem.for F in attr codes config flags 24191783Srmackleminsn-$F.h: gen$F ${MD_FILE} 25191783Srmacklem ./gen$F ${MD_FILE} > insn-$F.h 26191783SrmacklemGENSRCS+= insn-$F.h 27191783Srmacklem.endfor 28191783Srmacklem 29191783Srmacklem.for F in attrtab emit extract opinit output peep recog 30191783Srmackleminsn-$F.c: gen$F ${MD_FILE} 31191783Srmacklem ./gen$F ${MD_FILE} > insn-$F.c 32191783SrmacklemGENSRCS+= insn-$F.c 33191783Srmacklem.endfor 34191783Srmacklem 35191783Srmacklem.for F in attr codes config emit extract flags opinit output peep recog 36191783Srmacklembuild-tools: gen$F 37191783Srmacklem 38191783Srmacklemgen$F: gen$F.o rtl.o obstack.o print-rtl.o bitmap.o 39191783Srmacklem ${CC} -static ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} 40191783Srmacklem 41223280SrmacklemGENSRCS+= gen$F.c 42191783SrmacklemCLEANFILES+= gen$F 43191783Srmacklem.endfor 44191783Srmacklem 45191783Srmacklem.for F in attrtab 46191783Srmacklembuild-tools: gen$F 47191783Srmacklem 48191783Srmacklemgen$F: gen$F.o rtl.o rtlanal.o print-rtl.o obstack.o bitmap.o 49191783Srmacklem ${CC} -static ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} 50191783Srmacklem 51191783SrmacklemGENSRCS+= gen$F.c 52191783SrmacklemCLEANFILES+= gen$F 53191783Srmacklem.endfor 54191783Srmacklem 55191783SrmacklemSRCS+= bitmap.c obstack.c print-rtl.c rtl.c rtlanal.c 56191783Srmacklem 57191783Srmacklem.for F in check genrtl 58191783Srmacklembuild-tools: gen$F 59191783Srmacklem 60191783Srmacklemgen$F: gen$F.o 61191783Srmacklem ${CC} -static ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} 62269398Srmacklem 63191783SrmacklemGENSRCS+= gen$F.c 64191783SrmacklemCLEANFILES+= gen$F 65191783Srmacklem.endfor 66191783Srmacklem 67191783Srmacklem.ORDER: genrtl.c genrtl.h 68223280Srmacklemgenrtl.c genrtl.h: gengenrtl 69223280Srmacklem ./gengenrtl genrtl.h genrtl.c 70223280Srmacklem 71223280SrmacklemGENSRCS+= genrtl.c genrtl.h 72223280Srmacklem 73223280Srmacklem#----------------------------------------------------------------------- 74223280Srmacklem# C hash codes 75223280Srmacklemc-gperf.h: c-parse.gperf 76223280Srmacklem gperf -p -j1 -i 1 -g -o -t -G -N is_reserved_word -k1,3,$$ \ 77223280Srmacklem ${GCCDIR}/c-parse.gperf > ${.TARGET} 78223280SrmacklemGENSRCS+= c-gperf.h 79223280Srmacklem 80244042Srmacklem#----------------------------------------------------------------------- 81244042Srmacklem# C++ hash codes 82223280Srmacklemgxx-hash.h: gxx.gperf 83244042Srmacklem gperf -p -j1 -g -o -t -N is_reserved_word '-k1,4,7,$$' \ 84244042Srmacklem ${GCCDIR}/cp/gxx.gperf >gxx-hash.h 85223280SrmacklemGENSRCS+= gxx-hash.h 86244042Srmacklem 87244042Srmacklem# make a link the the Cygnus used name for now -- hopes are they will change it 88223280Srmacklemhash.h: gxx-hash.h 89223280Srmacklem ln -sf ${.ALLSRC} ${.TARGET} 90191783SrmacklemGENSRCS+= hash.h 91191783Srmacklem 92244042Srmacklem#----------------------------------------------------------------------- 93191783Srmacklem# Common parser stuff. 94191783Srmacklem 95191783Srmacklemtree-check.h: gencheck 96191783Srmacklem ./gencheck > ${.TARGET} 97244042SrmacklemGENSRCS+= tree-check.h 98244042Srmacklem 99191783Srmacklem#----------------------------------------------------------------------- 100244042Srmacklem# the host/target compiler config. 101191783Srmacklem 102191783SrmacklemCOMMONHDRS= config.h hconfig.h multilib.h options.h specs.h tconfig.h tm.h 103191783SrmacklemGENSRCS+= ${COMMONHDRS} gencheck.h 104191783Srmacklem 105191783Srmacklemconfig.h hconfig.h: 106191783Srmacklem echo '#include "auto-host.h"' > ${.TARGET} 107221973Srmacklem echo '#include "gansidecl.h"' >> ${.TARGET} 108191783Srmacklem echo '#include "${GCC_ARCH}/xm-${GCC_ARCH}.h"' >> ${.TARGET} 109221973Srmacklem echo '#include "hwint.h"' >> ${.TARGET} 110191783Srmacklem 111221973Srmacklemgencheck.h: 112191783Srmacklem echo '#include "cp/cp-tree.def"' > ${.TARGET} 113221973Srmacklem echo '#include "objc/objc-tree.def"' >> ${.TARGET} 114191783Srmacklem 115221973Srmacklemmultilib.h: 116191783Srmacklem echo 'static char *multilib_raw[] = { \ 117191783Srmacklem "aout maout;", "elf !maout;", NULL };' > ${.TARGET} 118191783Srmacklem echo 'static char *multilib_matches_raw[] = { \ 119191783Srmacklem "maout maout;", "melf melf;", NULL };' >> ${.TARGET} 120191783Srmacklem echo 'static char *multilib_extra = "";' >> ${.TARGET} 121191783Srmacklem 122191783Srmacklemoptions.h: 123191783Srmacklem echo '#include "cp/lang-options.h"' > ${.TARGET} 124191783Srmacklem echo '#include "f/lang-options.h"' >> ${.TARGET} 125191783Srmacklem 126191783Srmacklemspecs.h: 127191783Srmacklem echo '#include "cp/lang-specs.h"' > ${.TARGET} 128191783Srmacklem echo '#include "f/lang-specs.h"' >> ${.TARGET} 129191783Srmacklem echo '#include "objc/lang-specs.h"' >> ${.TARGET} 130207764Srmacklem 131207764Srmacklemtconfig.h: 132207764Srmacklem echo '#include "gansidecl.h"' > ${.TARGET} 133207764Srmacklem echo '#include "${GCC_ARCH}/xm-${GCC_ARCH}.h"' >> ${.TARGET} 134207764Srmacklem 135207764Srmacklem# KEEP THIS IN SYNC with src/gcc/lib/libgcc/Makefile !! 136207764Srmacklemtm.h: 137207764Srmacklem echo '#include "${GCC_ARCH}/${GCC_ARCH}.h"' > ${.TARGET} 138207764Srmacklem.if ${GCC_ARCH} == "i386" 139207764Srmacklem echo '#include "${GCC_ARCH}/att.h"' >> ${.TARGET} 140207764Srmacklem echo '#include "svr4.h"' >> ${.TARGET} 141207764Srmacklem.endif 142207764Srmacklem echo '#include <freebsd.h>' >> ${.TARGET} 143207764Srmacklem echo '#include "${GCC_ARCH}/freebsd.h"' >> ${.TARGET} 144207764Srmacklem.if ${GCC_ARCH} == "i386" 145207764Srmacklem echo '#include "${GCC_ARCH}/perform.h"' >> ${.TARGET} 146207764Srmacklem.endif 147207764Srmacklem echo '#include <freebsd-native.h>' >> ${.TARGET} 148207764Srmacklem 149207764Srmacklem#----------------------------------------------------------------------- 150207764Srmacklem# General things. 151207764Srmacklem 152207764SrmacklemSRCS+= ${GENSRCS} 153207764SrmacklemCLEANFILES+= ${GENSRCS} 154207764Srmacklem 155191783Srmacklemall: ${SRCS} 156191783Srmacklem 157191783Srmacklem.include <bsd.prog.mk> 158191783Srmacklem 159191783Srmacklem#----------------------------------------------------------------------- 160191783Srmacklem# Fixups. 161191783Srmacklem 162191783Srmacklem# Set OBJS the same as bsd.prog.mk would do if we defined PROG. We can't 163191783Srmacklem# define PROG because we have multiple programs. 164191783Srmacklem# 165191783SrmacklemOBJS+= ${SRCS:N*.h:R:S/$/.o/g} 166191783Srmacklem 167191783Srmacklem.if !exists(${DEPENDFILE}) 168191783Srmacklem# Fudge pre-dependfile dependencies of objects in much the same way as 169191783Srmacklem# bsd.prog.mk would do if we defined PROG. There are complications to 170224086Szack# avoid circular dependencies. First, only make most objects depend on 171191783Srmacklem# all headers. Filter out the objects that would cause problems (i.e., 172244042Srmacklem# objects that will be used to create programs that will generate headers). 173228757Srmacklem# 174191783Srmacklem${OBJS:Nbitmap.o:Ngenattr.o:Ngencheck.o:Ngencodes.o:Ngenconfig.o:Ngenflags.o:Ngengenrtl.o:Nobstack.o:Nprint-rtl.o:Nrtl.o}: ${SRCS:M*.h} 175191783Srmacklem 176191783Srmacklem# Next, make each of the problematic objects depend on only most headers. 177191783Srmacklem# Filter out the headers that would cause problems (and a few more when it 178191783Srmacklem# is inconvenient to filter precisely). 179191783Srmacklem# 180191783Srmacklembitmap.o genattr.o gencodes.o genconfig.o genflags.o obstack.o print-rtl.o \ 181191783Srmacklem rtl.o: ${SRCS:M*.h:Ninsn-*.h} 182191783Srmacklemgencheck.o: gencheck.h ${SRCS:M*.h:Ngenrtl.h:Ntree-check.h:Ninsn-*.h} 183191783Srmacklemgengenrtl.o: ${SRCS:M*.h:Ngenrtl.h:Ninsn-*.h} 184191783Srmacklem.endif 185191783Srmacklem