Makefile revision 96734
1219019Sgabor# $FreeBSD: head/gnu/usr.bin/cc/cc_tools/Makefile 96734 2002-05-16 15:18:13Z ru $ 2264497Stijl 3219019Sgabor# 4219019Sgabor# This could probably be merged with ../cc_int/Makefile, but bsd.lib.mk 5219019Sgabor# is such a !@#!*#% nightmare because of how it reprograms the dependencies, 6219019Sgabor# suffix rules, SRCS, etc. It's easiest to cheat by using bsd.prog.mk and 7219019Sgabor# SRCS to get dependencies. 8219019Sgabor# 9219019Sgabor 10219019Sgabor# ../Makefile.inc will put an absolute path to our objdir in CFLAGS. 11219019Sgabor# Prevent mkdep from using it, so that we don't have to give rules for 12219019Sgabor# aliases of generated headers. 13219019Sgabor 14219019SgaborCFLAGS+= -I. 15219019Sgabor 16219019Sgabor.include "../Makefile.inc" 17219019Sgabor 18219019Sgabor.PATH: ${GCCDIR} ${GCCDIR}/cp ${GCCDIR}/../libiberty 19219019Sgabor 20219019SgaborCFLAGS+= -static -DGENERATOR_FILE 21219019Sgabor 22219019Sgabor.if defined(BOOTSTRAPPING) 23219019SgaborCFLAGS+= -DBOOTSTRAPPING 24219019Sgabor.endif 25219019Sgabor 26219019Sgabor#----------------------------------------------------------------------- 27219019Sgabor# insn-* gunk 28219019Sgabor 29219019Sgabor.for F in attr codes config flags 30219019Sgaborinsn-$F.h: gen$F ${MD_FILE} 31219019Sgabor ./gen$F ${MD_FILE} > insn-$F.h 32219019SgaborGENSRCS+= insn-$F.h 33219019Sgabor.endfor 34219019Sgabor 35219019SgaborGENSRCS+= gen-time-stamp 36219019Sgaborgen-time-stamp: genattrtab genemit genextract genopinit genoutput genpeep genrecog 37219019Sgabor touch ${.TARGET} 38219019Sgabor 39219019Sgabor.for F in attr codes config emit extract flags opinit output peep recog 40219019Sgaborbuild-tools: gen$F 41219019Sgabor 42219019Sgaborgen$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 43219019Sgabor ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} 44219019Sgabor 45219019SgaborGENSRCS+= gen$F.c 46219019SgaborCLEANFILES+= gen$F 47219019Sgabor.endfor 48219019Sgabor 49219019Sgabor.for F in attrtab 50219019Sgaborbuild-tools: gen$F 51219019Sgabor 52219019Sgaborgen$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 53219019Sgabor ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} 54219019Sgabor 55219019SgaborGENSRCS+= gen$F.c 56219019SgaborCLEANFILES+= gen$F 57219019Sgabor.endfor 58219019Sgabor 59219019SgaborSRCS+= 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 60219019Sgabor 61219019Sgabor.for F in check genrtl preds 62219019Sgaborbuild-tools: gen$F 63219019Sgabor 64219019Sgaborgen$F: gen$F.o 65219019Sgabor ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} 66219019Sgabor 67219019SgaborGENSRCS+= gen$F.c 68219019SgaborCLEANFILES+= gen$F 69219019Sgabor.endfor 70219019Sgabor 71219019Sgabor.ORDER: genrtl.c genrtl.h 72219019Sgaborgenrtl.c genrtl.h: gengenrtl 73219019Sgabor ./gengenrtl > genrtl.c 74219019Sgabor ./gengenrtl -h > genrtl.h 75219019Sgabor 76219019SgaborGENSRCS+= genrtl.c genrtl.h 77219019Sgabor 78219019Sgabor#----------------------------------------------------------------------- 79219019Sgabor# Common parser stuff. 80219019Sgabor 81219019Sgabortree-check.h: gencheck 82219019Sgabor ./gencheck > ${.TARGET} 83219019SgaborGENSRCS+= tree-check.h 84219019Sgabor 85219019Sgabor#----------------------------------------------------------------------- 86219019Sgabor# Predicates stuff. 87219019Sgabor 88219019Sgabortm-preds.h: genpreds 89219019Sgabor ./genpreds > ${.TARGET} 90219019SgaborGENSRCS+= tm-preds.h 91219019Sgabor 92219019Sgabor#----------------------------------------------------------------------- 93219019Sgabor# the host/target compiler config. 94219019Sgabor 95219019SgaborCOMMONHDRS= config.h hconfig.h multilib.h options.h specs.h tconfig.h \ 96219019Sgabor tm_p.h configargs.h safe-ctype.h 97219019SgaborGENSRCS+= ${COMMONHDRS} gencheck.h 98219019Sgabor 99219019SgaborMFILE?= ${.CURDIR}/Makefile 100219019Sgabor${COMMONHDRS}: ${MFILE} 101219019Sgabor 102219019Sgaborconfigargs.h: 103219019Sgabor echo 'static const char configuration_arguments[] =' > ${.TARGET} 104219019Sgabor echo ' "FreeBSD/${TARGET_ARCH} system compiler";' >> ${.TARGET} 105264497Stijl echo 'static const char thread_model[] = "posix";' >> ${.TARGET} 106264497Stijl 107219019Sgaborhconfig.h: 108264497Stijl echo '#include "auto-host.h"' > ${.TARGET} 109219019Sgabor echo '#include <tconfig.h>' >> ${.TARGET} 110219019Sgabor 111219019Sgaborgencheck.h: 112219019Sgabor echo '#include "cp/cp-tree.def"' > ${.TARGET} 113219019Sgabor echo '#include "objc/objc-tree.def"' >> ${.TARGET} 114219019Sgabor 115219019Sgabormultilib.h: 116219019Sgabor echo 'static const char *const multilib_raw[] = { \ 117219019Sgabor "aout maout;", "elf !maout;", NULL };' > ${.TARGET} 118219019Sgabor echo 'static const char *const multilib_matches_raw[] = { \ 119219019Sgabor "maout maout;", "melf melf;", NULL };' >> ${.TARGET} 120219019Sgabor echo 'static const char *multilib_extra = "";' >> ${.TARGET} 121219019Sgabor echo 'static const char *const multilib_exclusions_raw[] = { \ 122219019Sgabor NULL };' >> ${.TARGET} 123219019Sgabor 124219019Sgaboroptions.h: 125219019Sgabor echo '#include "cp/lang-options.h"' > ${.TARGET} 126219019Sgabor echo '#include "f/lang-options.h"' >> ${.TARGET} 127219019Sgabor echo '#include "objc/lang-options.h"' >> ${.TARGET} 128219019Sgabor 129219019Sgaborspecs.h: 130219019Sgabor echo '#include "cp/lang-specs.h"' > ${.TARGET} 131219019Sgabor echo '#include "f/lang-specs.h"' >> ${.TARGET} 132219019Sgabor echo '#include "objc/lang-specs.h"' >> ${.TARGET} 133219019Sgabor 134219019Sgaborconfig.h: 135219019Sgabor echo '#include <hconfig.h>' > ${.TARGET} 136219019Sgabor echo '#ifndef GENERATOR_FILE' >> ${.TARGET} 137219019Sgabor echo '#include "insn-codes.h"' >> ${.TARGET} 138219019Sgabor echo '#include "insn-flags.h"' >> ${.TARGET} 139219019Sgabor echo '#endif' >> ${.TARGET} 140219019Sgabor 141219019Sgabortconfig.h: 142219019Sgabor echo 'struct rtx_def;' > ${.TARGET} 143219019Sgabor echo 'typedef struct rtx_def *rtx;' >> ${.TARGET} 144219019Sgabor echo 'struct rtvec_def;' >> ${.TARGET} 145219019Sgabor echo 'typedef struct rtvec_def *rtvec;' >> ${.TARGET} 146219019Sgabor echo 'union tree_node;' >> ${.TARGET} 147219019Sgabor echo 'typedef union tree_node *tree;' >> ${.TARGET} 148 echo '' >> ${.TARGET} 149.if ${TARGET_ARCH} == "ia64" 150 echo '#define TARGET_CPU_DEFAULT (MASK_GNU_AS|MASK_GNU_LD)' >>${.TARGET} 151.endif 152 echo '#include "ansidecl.h"' >> ${.TARGET} 153 echo '#include "${GCC_CPU}/${GCC_CPU}.h"' >> ${.TARGET} 154.if ${TARGET_ARCH} == "i386" 155 echo '#include "${GCC_CPU}/att.h"' >> ${.TARGET} 156.endif 157.if ${TARGET_ARCH} != "alpha" 158 echo '#include "dbxelf.h"' >> ${.TARGET} 159 echo '#include "elfos.h"' >> ${.TARGET} 160.endif 161 echo '#include <freebsd-native.h>' >> ${.TARGET} 162 echo '#include "freebsd-spec.h"' >> ${.TARGET} 163 echo '#include "freebsd.h"' >> ${.TARGET} 164.if ${TARGET_ARCH} == "alpha" 165 echo '#include "${GCC_CPU}/elf.h"' >> ${.TARGET} 166.endif 167.if ${TARGET_ARCH} != "i386" 168.if exists(${GCCDIR}/config/${GCC_CPU}/sysv4.h) 169 echo '#include "${GCC_CPU}/sysv4.h"' >> ${.TARGET} 170.endif 171.endif 172 echo '#include "${GCC_CPU}/freebsd.h"' >> ${.TARGET} 173.if ${TARGET_ARCH} == "x86-64" 174 echo '#include "${GCC_CPU}/freebsd64.h"' >> ${.TARGET} 175.endif 176 echo '#include "defaults.h"' >> ${.TARGET} 177 echo '#ifndef POSIX' >> ${.TARGET} 178 echo '# define POSIX' >> ${.TARGET} 179 echo '#endif' >> ${.TARGET} 180.if ${TARGET_ARCH} != "ia64" 181 echo '#define CONFIG_SJLJ_EXCEPTIONS 0' >> ${.TARGET} 182.endif 183 184tm_p.h: 185 echo '#include "${GCC_CPU}/${GCC_CPU}-protos.h"' >> ${.TARGET} 186 echo '#include "tm-preds.h"' >> ${.TARGET} 187 188safe-ctype.h: Makefile 189 echo '#include <ctype.h>' > ${.TARGET} 190.for Z in TOUPPER TOLOWER ISDIGIT ISXDIGIT ISUPPER ISLOWER ISALPHA ISALNUM \ 191 ISSPACE ISPUNCT ISGRAPH ISBLANK ISPRINT ISCNTRL 192 echo '#define ${Z} ${Z:L}' >> ${.TARGET} 193.endfor 194 echo "#define ISIDST(x) \ 195 ((x) == '_' || isalpha(x))" >> ${.TARGET} 196 echo "#define ISIDNUM(x) \ 197 (isdigit(x) || ISIDST(x))" >> ${.TARGET} 198 echo "#define IS_VSPACE(x) \ 199 ((x) == '\n' || (x) == '\r')" >> ${.TARGET} 200 echo "#define IS_NVSPACE(x) \ 201 (!IS_VSPACE(x) && (isspace(x) || (x) == '\0'))" >> ${.TARGET} 202 echo "#define IS_SPACE_OR_NUL(x) \ 203 (isspace(x) || (x) == '\0')" >> ${.TARGET} 204 205#----------------------------------------------------------------------- 206# General things. 207 208SRCS+= ${GENSRCS} 209CLEANFILES+= ${GENSRCS} 210 211all: ${SRCS} 212 213.include <bsd.prog.mk> 214 215#----------------------------------------------------------------------- 216# Fixups. 217 218# Set OBJS the same as bsd.prog.mk would do if we defined PROG. We can't 219# define PROG because we have multiple programs. 220# 221OBJS+= ${SRCS:N*.h:R:S/$/.o/g} 222 223.if !exists(${DEPENDFILE}) 224# Fudge pre-dependfile dependencies of objects in much the same way as 225# bsd.prog.mk would do if we defined PROG. There are complications to 226# avoid circular dependencies. First, only make most objects depend on 227# all headers. Filter out the objects that would cause problems (i.e., 228# objects that will be used to create programs that will generate headers). 229# 230${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} 231 232# Force these to be made absolustly first w/-j 233${OBJS}: ${COMMONHDRS} 234 235# Next, make each of the problematic objects depend on only most headers. 236# Filter out the headers that would cause problems (and a few more when it 237# is inconvenient to filter precisely). 238# 239bitmap.o genattr.o gencodes.o genconfig.o genflags.o gensupport.o obstack.o print-rtl.o \ 240 read-rtl.o rtl.o: ${SRCS:M*.h:Ninsn-*.h} 241gencheck.o: gencheck.h ${SRCS:M*.h:Ngenrtl.h:Ntree-check.h:Ninsn-*.h} 242gengenrtl.o: ${SRCS:M*.h:Ngenrtl.h:Ninsn-*.h} 243genpreds.o: ${COMMONHDRS} 244.endif 245