Makefile revision 116859
155714Skris# $FreeBSD: head/gnu/usr.bin/cc/cc_tools/Makefile 116859 2003-06-26 03:02:32Z peter $ 255714Skris 355714Skris# 455714Skris# This could probably be merged with ../cc_int/Makefile, but bsd.lib.mk 555714Skris# is such a !@#!*#% nightmare because of how it reprograms the dependencies, 655714Skris# suffix rules, SRCS, etc. It's easiest to cheat by using bsd.prog.mk and 755714Skris# SRCS to get dependencies. 8206046Ssimon# 9206046Ssimon 10206046Ssimon# ../Makefile.inc will put an absolute path to our objdir in CFLAGS. 11206046Ssimon# Prevent mkdep from using it, so that we don't have to give rules for 12206046Ssimon# aliases of generated headers. 13205128Ssimon 14205128SsimonCFLAGS+= -I. 15205128Ssimon 16205128Ssimon.include "../Makefile.inc" 17205128Ssimon 18205128Ssimon.PATH: ${GCCDIR} ${GCCDIR}/cp ${GCCDIR}/../libiberty 19205128Ssimon 20205128SsimonCFLAGS+= -static -DGENERATOR_FILE 21205128Ssimon 22205128Ssimon#----------------------------------------------------------------------- 23205128Ssimon# insn-* gunk 24205128Ssimon 25205128Ssimon.for F in attr codes config flags 26205128Ssimoninsn-$F.h: gen$F ${MD_FILE} 27205128Ssimon ./gen$F ${MD_FILE} > insn-$F.h 28205128SsimonGENSRCS+= insn-$F.h 29194206Ssimon.endfor 30194206Ssimon 31194206SsimonGENSRCS+= gen-time-stamp 32194206Ssimongen-time-stamp: genattrtab genemit genextract genopinit genoutput genpeep genrecog 33194206Ssimon touch ${.TARGET} 34194206Ssimon 35194206Ssimon.for F in attr codes config emit extract flags opinit output peep recog 36194206Ssimonbuild-tools: gen$F 37194206Ssimon 38194206Ssimongen$F: gen$F.o rtl.o obstack.o print-rtl.o bitmap.o errors.o gensupport.o ggc-none.o hashtab.o read-rtl.o 39194206Ssimon ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} 40194206Ssimon 41194206SsimonGENSRCS+= gen$F.c 42194206SsimonCLEANFILES+= gen$F 43194206Ssimon.endfor 44194206Ssimon 45194206Ssimon.for F in attrtab 46194206Ssimonbuild-tools: gen$F 47194206Ssimon 48194206Ssimongen$F: gen$F.o rtl.o print-rtl.o obstack.o bitmap.o errors.o gensupport.o ggc-none.o hashtab.o read-rtl.o 49194206Ssimon ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} 50194206Ssimon 51194206SsimonGENSRCS+= gen$F.c 52194206SsimonCLEANFILES+= gen$F 53194206Ssimon.endfor 54194206Ssimon 55194206SsimonSRCS+= bitmap.c errors.c gensupport.c ggc-none.c hashtab.c obstack.c print-rtl.c regclass.c rtl.c rtlanal.c read-rtl.c 56194206Ssimon 57194206Ssimon.for F in check genrtl preds 58194206Ssimonbuild-tools: gen$F 59194206Ssimon 60194206Ssimongen$F: gen$F.o 61194206Ssimon ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} 62167612Ssimon 63162911SsimonGENSRCS+= gen$F.c 64167612SsimonCLEANFILES+= gen$F 65167612Ssimon.endfor 66167612Ssimon 67167612Ssimon.ORDER: genrtl.c genrtl.h 68167612Ssimongenrtl.c genrtl.h: gengenrtl 69162911Ssimon ./gengenrtl > genrtl.c 70162911Ssimon ./gengenrtl -h > genrtl.h 71162911Ssimon 72162911SsimonGENSRCS+= genrtl.c genrtl.h 73162911Ssimon 74162911Ssimon#----------------------------------------------------------------------- 75162911Ssimon# Common parser stuff. 76162911Ssimon 77162911Ssimontree-check.h: gencheck 78160814Ssimon ./gencheck > ${.TARGET} 79160814SsimonGENSRCS+= tree-check.h 80160814Ssimon 81160814Ssimon#----------------------------------------------------------------------- 82160814Ssimon# Predicates stuff. 83160814Ssimon 84160814Ssimontm-preds.h: genpreds 85160814Ssimon ./genpreds > ${.TARGET} 86160814SsimonGENSRCS+= tm-preds.h 87160814Ssimon 88160814Ssimon#----------------------------------------------------------------------- 89160814Ssimon# the host/target compiler config. 90162911Ssimon 91160814SsimonCOMMONHDRS= config.h hconfig.h multilib.h options.h specs.h tconfig.h \ 92160814Ssimon tm_p.h configargs.h safe-ctype.h 93160814SsimonGENSRCS+= ${COMMONHDRS} gencheck.h 94160814Ssimon 95160814SsimonMFILE?= ${.CURDIR}/Makefile 96160814Ssimon${COMMONHDRS}: ${MFILE} 97160814Ssimon 98160814Ssimonconfigargs.h: 99160814Ssimon echo 'static const char configuration_arguments[] =' > ${.TARGET} 100160814Ssimon echo ' "FreeBSD/${TARGET_ARCH} system compiler";' >> ${.TARGET} 101160814Ssimon echo 'static const char thread_model[] = "posix";' >> ${.TARGET} 102160814Ssimon 103160814Ssimonhconfig.h: 104160814Ssimon echo '#include "auto-host.h"' > ${.TARGET} 105160814Ssimon echo '#include <tconfig.h>' >> ${.TARGET} 106160814Ssimon 107160814Ssimongencheck.h: 108160814Ssimon echo '#include "cp/cp-tree.def"' > ${.TARGET} 109160814Ssimon echo '#include "objc/objc-tree.def"' >> ${.TARGET} 110160814Ssimon 111160814Ssimonmultilib.h: 112160814Ssimon echo 'static const char *const multilib_raw[] = { \ 113160814Ssimon "aout maout;", "elf !maout;", NULL };' > ${.TARGET} 114160814Ssimon echo 'static const char *const multilib_matches_raw[] = { \ 115160814Ssimon "maout maout;", "melf melf;", NULL };' >> ${.TARGET} 116160814Ssimon echo 'static const char *multilib_extra = "";' >> ${.TARGET} 117160814Ssimon echo 'static const char *multilib_options = "";'>> ${.TARGET} 118160814Ssimon echo 'static const char *const multilib_exclusions_raw[] = { \ 119160814Ssimon NULL };' >> ${.TARGET} 120160814Ssimon 121160814Ssimonoptions.h: 122160814Ssimon echo '#include "cp/lang-options.h"' > ${.TARGET} 123160814Ssimon echo '#include "f/lang-options.h"' >> ${.TARGET} 124160814Ssimon echo '#include "objc/lang-options.h"' >> ${.TARGET} 125160814Ssimon 126160814Ssimonspecs.h: 127160814Ssimon echo '#include "cp/lang-specs.h"' > ${.TARGET} 128160814Ssimon echo '#include "f/lang-specs.h"' >> ${.TARGET} 129160814Ssimon echo '#include "objc/lang-specs.h"' >> ${.TARGET} 130160814Ssimon 131160814Ssimonconfig.h: 132160814Ssimon echo '#include <hconfig.h>' > ${.TARGET} 133160814Ssimon echo '#ifndef GENERATOR_FILE' >> ${.TARGET} 134160814Ssimon echo '#include "insn-codes.h"' >> ${.TARGET} 135160814Ssimon echo '#include "insn-flags.h"' >> ${.TARGET} 136160814Ssimon echo '#endif' >> ${.TARGET} 137160814Ssimon 138160814Ssimontconfig.h: 139160814Ssimon echo 'struct rtx_def;' > ${.TARGET} 140160814Ssimon echo 'typedef struct rtx_def *rtx;' >> ${.TARGET} 141160814Ssimon echo 'struct rtvec_def;' >> ${.TARGET} 142160814Ssimon echo 'typedef struct rtvec_def *rtvec;' >> ${.TARGET} 143160814Ssimon echo 'union tree_node;' >> ${.TARGET} 144160814Ssimon echo 'typedef union tree_node *tree;' >> ${.TARGET} 145160814Ssimon echo '' >> ${.TARGET} 146160814Ssimon.if ${TARGET_ARCH} == "amd64" 147160814Ssimon echo '#include "i386/biarch64.h" >> ${.TARGET} 148160814Ssimon.endif 149160814Ssimon.if ${TARGET_ARCH} == "ia64" 150160814Ssimon echo '#define TARGET_CPU_DEFAULT (MASK_GNU_AS|MASK_GNU_LD)' >>${.TARGET} 151160814Ssimon.endif 152160814Ssimon echo '#include "ansidecl.h"' >> ${.TARGET} 153160814Ssimon echo '#include "${GCC_CPU}/${GCC_CPU}.h"' >> ${.TARGET} 154160814Ssimon.if ${TARGET_ARCH} == "i386" || ${TARGET_ARCH} == "amd64" 155160814Ssimon echo '#include "${GCC_CPU}/att.h"' >> ${.TARGET} 156160814Ssimon.endif 157160814Ssimon.if ${TARGET_ARCH} != "alpha" 158160814Ssimon echo '#include "dbxelf.h"' >> ${.TARGET} 159160814Ssimon echo '#include "elfos.h"' >> ${.TARGET} 160160814Ssimon.endif 161160814Ssimon echo '#include <freebsd-native.h>' >> ${.TARGET} 162160814Ssimon echo '#include "freebsd-spec.h"' >> ${.TARGET} 163160814Ssimon echo '#include "freebsd.h"' >> ${.TARGET} 164160814Ssimon.if ${TARGET_ARCH} == "alpha" 165160814Ssimon echo '#include "${GCC_CPU}/elf.h"' >> ${.TARGET} 166160814Ssimon.endif 167167612Ssimon.if ${TARGET_ARCH} != "i386" && ${TARGET_ARCH} != "amd64" 168167612Ssimon.if exists(${GCCDIR}/config/${GCC_CPU}/sysv4.h) 169167612Ssimon echo '#include "${GCC_CPU}/sysv4.h"' >> ${.TARGET} 170167612Ssimon.endif 171167612Ssimon.endif 172162911Ssimon echo '#include "${GCC_CPU}/freebsd.h"' >> ${.TARGET} 173162911Ssimon.if ${TARGET_ARCH} == "amd64" 174162911Ssimon echo '#include "${GCC_CPU}/x86-64.h"' >> ${.TARGET} 175162911Ssimon echo '#include "${GCC_CPU}/freebsd64.h"' >> ${.TARGET} 176160814Ssimon.endif 177160814Ssimon echo '#include "defaults.h"' >> ${.TARGET} 178160814Ssimon echo '#ifndef POSIX' >> ${.TARGET} 179160814Ssimon echo '# define POSIX' >> ${.TARGET} 180160814Ssimon echo '#endif' >> ${.TARGET} 181160814Ssimon.if ${TARGET_ARCH} != "ia64" 182160814Ssimon echo '#define CONFIG_SJLJ_EXCEPTIONS 0' >> ${.TARGET} 183160814Ssimon.endif 184160814Ssimon 185160814Ssimontm_p.h: 186160814Ssimon echo '#include "${GCC_CPU}/${GCC_CPU}-protos.h"' >> ${.TARGET} 187162911Ssimon echo '#include "tm-preds.h"' >> ${.TARGET} 188160814Ssimon 189160814Ssimonsafe-ctype.h: Makefile 190160814Ssimon echo '#include <ctype.h>' > ${.TARGET} 191160814Ssimon.for Z in TOUPPER TOLOWER ISDIGIT ISXDIGIT ISUPPER ISLOWER ISALPHA ISALNUM \ 192160814Ssimon ISSPACE ISPUNCT ISGRAPH ISBLANK ISPRINT ISCNTRL 193160814Ssimon echo '#define ${Z} ${Z:L}' >> ${.TARGET} 194160814Ssimon.endfor 195160814Ssimon echo "#define ISIDST(x) \ 196160814Ssimon ((x) == '_' || isalpha(x))" >> ${.TARGET} 197160814Ssimon echo "#define ISIDNUM(x) \ 198160814Ssimon (isdigit(x) || ISIDST(x))" >> ${.TARGET} 199160814Ssimon echo "#define IS_VSPACE(x) \ 200160814Ssimon ((x) == '\n' || (x) == '\r')" >> ${.TARGET} 201160814Ssimon echo "#define IS_NVSPACE(x) \ 202160814Ssimon (!IS_VSPACE(x) && (isspace(x) || (x) == '\0'))" >> ${.TARGET} 203160814Ssimon echo "#define IS_SPACE_OR_NUL(x) \ 204160814Ssimon (isspace(x) || (x) == '\0')" >> ${.TARGET} 205160814Ssimon 206160814Ssimon#----------------------------------------------------------------------- 207160814Ssimon# General things. 208142425Snectar 209142425SnectarSRCS+= ${GENSRCS} 210142425SnectarCLEANFILES+= ${GENSRCS} 211142425Snectar 212142425Snectarall: ${SRCS} 213127128Snectar 214127128Snectar.include <bsd.prog.mk> 215127128Snectar 216127128Snectar#----------------------------------------------------------------------- 217127128Snectar# Fixups. 218142425Snectar 219127128Snectar# Set OBJS the same as bsd.prog.mk would do if we defined PROG. We can't 220127128Snectar# define PROG because we have multiple programs. 221120631Snectar# 222120631SnectarOBJS+= ${SRCS:N*.h:R:S/$/.o/g} 223120631Snectar 224120631Snectar.if !exists(${DEPENDFILE}) 225120631Snectar# Fudge pre-dependfile dependencies of objects in much the same way as 226120631Snectar# bsd.prog.mk would do if we defined PROG. There are complications to 227120631Snectar# avoid circular dependencies. First, only make most objects depend on 228120631Snectar# all headers. Filter out the objects that would cause problems (i.e., 229120631Snectar# objects that will be used to create programs that will generate headers). 230120631Snectar# 231120631Snectar${OBJS:Nbitmap.o:Nerrors.o:Ngenattr.o:Ngencheck.o:Ngencodes.o:Ngenconfig.o:Ngenflags.o:Ngengenrtl.o:Ngenpreds.o:Ngensupport.o:Nggc-none.o:Nhashtab.o:Nobstack.o:Nprint-rtl.o:Nread-rtl.o:Nrtl.o}: ${SRCS:M*.h} 232120631Snectar 233120631Snectar# Force these to be made absolustly first w/-j 234120631Snectar${OBJS}: ${COMMONHDRS} 235120631Snectar 236120631Snectar# Next, make each of the problematic objects depend on only most headers. 237120631Snectar# Filter out the headers that would cause problems (and a few more when it 238120631Snectar# is inconvenient to filter precisely). 239111147Snectar# 240111147Snectarbitmap.o genattr.o gencodes.o genconfig.o genflags.o gensupport.o obstack.o print-rtl.o \ 241111147Snectar read-rtl.o rtl.o: ${SRCS:M*.h:Ninsn-*.h} 242111147Snectargencheck.o: gencheck.h ${SRCS:M*.h:Ngenrtl.h:Ntree-check.h:Ninsn-*.h} 243111147Snectargengenrtl.o: ${SRCS:M*.h:Ngenrtl.h:Ninsn-*.h} 244111147Snectargenpreds.o: ${COMMONHDRS} 245111147Snectar.endif 246111147Snectar