Makefile revision 53173
1# $FreeBSD: head/gnu/usr.bin/cc/cc_tools/Makefile 53173 1999-11-15 04:16:19Z obrien $ 2 3# 4# This could probably be merged with ../cc_int/Makefile, but bsd.lib.mk 5# is such a !@#!*#% nightmare because of how it reprograms the dependencies, 6# suffix rules, SRCS, etc. It's easiest to cheat by using bsd.prog.mk and 7# SRCS to get dependencies. 8# 9 10# ../Makefile.inc will put an absolute path to our objdir in CFLAGS. 11# Prevent mkdep from using it, so that we don't have to give rules for 12# aliases of generated headers. 13 14CFLAGS+= -I. 15 16.include "../Makefile.inc" 17 18.PATH: ${GCCDIR} ${GCCDIR}/cp 19 20CFLAGS+= -I${GCCDIR}/objc 21 22#----------------------------------------------------------------------- 23# insn-* gunk 24 25.for i in attr codes config flags 26insn-$i.h: gen$i ${MD_FILE} 27 ./gen$i ${MD_FILE} > insn-$i.h 28GENSRCS+= insn-$i.h 29.endfor 30 31.for i in attrtab emit extract opinit output peep recog 32insn-$i.c: gen$i ${MD_FILE} 33 ./gen$i ${MD_FILE} > insn-$i.c 34GENSRCS+= insn-$i.c 35.endfor 36 37.for i in attr codes config emit extract flags opinit output peep recog 38build-tools: gen$i 39 40gen$i: gen$i.o rtl.o obstack.o print-rtl.o bitmap.o 41 ${CC} -static ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} 42 43GENSRCS+= gen$i.c 44CLEANFILES+= gen$i 45.endfor 46 47.for i in attrtab 48build-tools: gen$i 49 50gen$i: gen$i.o rtl.o rtlanal.o print-rtl.o obstack.o bitmap.o 51 ${CC} -static ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} 52 53GENSRCS+= gen$i.c 54CLEANFILES+= gen$i 55.endfor 56 57SRCS+= bitmap.c obstack.c print-rtl.c rtl.c rtlanal.c 58 59.for i in check genrtl 60build-tools: gen$i 61 62gen$i: gen$i.o 63 ${CC} -static ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} 64 65GENSRCS+= gen$i.c 66CLEANFILES+= gen$i 67.endfor 68 69.ORDER: genrtl.c genrtl.h 70genrtl.c genrtl.h: gengenrtl 71 ./gengenrtl genrtl.h genrtl.c 72 73GENSRCS+= genrtl.c genrtl.h 74 75#----------------------------------------------------------------------- 76# C hash codes 77c-gperf.h: c-parse.gperf 78 gperf -p -j1 -i 1 -g -o -t -G -N is_reserved_word -k1,3,$$ \ 79 ${GCCDIR}/c-parse.gperf > ${.TARGET} 80GENSRCS+= c-gperf.h 81 82#----------------------------------------------------------------------- 83# C++ hash codes 84gxx-hash.h: gxx.gperf 85 gperf -p -j1 -g -o -t -N is_reserved_word '-k1,4,7,$$' \ 86 ${GCCDIR}/cp/gxx.gperf >gxx-hash.h 87GENSRCS+= gxx-hash.h 88 89# make a link the the Cygnus used name for now -- hopes are they will change it 90hash.h: gxx-hash.h 91 ln -sf ${.ALLSRC} ${.TARGET} 92GENSRCS+= hash.h 93 94#----------------------------------------------------------------------- 95# Common parser stuff. 96 97tree-check.h: gencheck 98 ./gencheck > ${.TARGET} 99GENSRCS+= tree-check.h 100 101#----------------------------------------------------------------------- 102# C parser 103.ORDER: c-parse.c c-parse.h 104c-parse.c c-parse.h: c-parse.in 105 sed -e "/^ifobjc$$/,/^end ifobjc$$/d" \ 106 -e "/^ifc$$/d" -e "/^end ifc$$/d" \ 107 ${GCCDIR}/c-parse.in > c-parse.y 108 ${YACC} -d -o c-parse.c c-parse.y 109 mv c-parse.y c-parse.y.out 110 111GENSRCS+= c-parse.c c-parse.h 112CLEANFILES+= c-parse.y c-parse.y.out # insurance 113 114#----------------------------------------------------------------------- 115# objc parser 116.ORDER: objc-parse.c objc-parse.h 117objc-parse.c objc-parse.h: c-parse.in 118 sed -e "/^ifc$$/,/^end ifc$$/d" \ 119 -e "/^ifobjc$$/d" -e "/^end ifobjc$$/d" \ 120 ${GCCDIR}/c-parse.in > objc-parse.y 121 ${YACC} -d -o objc-parse.c objc-parse.y 122 mv objc-parse.y objc-parse.y.out 123 124GENSRCS+= objc-parse.c objc-parse.h 125CLEANFILES+= objc-parse.y objc-parse.y.out # insurance 126 127#----------------------------------------------------------------------- 128# C++ parser done in its own makefile 129#----------------------------------------------------------------------- 130# CPP parser done in its own makefile 131#----------------------------------------------------------------------- 132# the host/target compiler config. 133 134COMMONHDRS= config.h hconfig.h multilib.h options.h specs.h tconfig.h tm.h 135GENSRCS+= ${COMMONHDRS} gencheck.h 136 137config.h hconfig.h: 138 echo '#include "auto-host.h"' > ${.TARGET} 139 echo '#include "gansidecl.h"' >> ${.TARGET} 140 echo '#include "${GCC_ARCH}/xm-${GCC_ARCH}.h"' >> ${.TARGET} 141 echo '#include "hwint.h"' >> ${.TARGET} 142 143gencheck.h: 144 echo '#include "cp/cp-tree.def"' > ${.TARGET} 145 echo '#include "objc/objc-tree.def"' >> ${.TARGET} 146 147multilib.h: 148 echo 'static char *multilib_raw[] = { \ 149 "aout maout;", "elf !maout;", NULL };' > ${.TARGET} 150 echo 'static char *multilib_matches_raw[] = { \ 151 "maout maout;", "melf melf;", NULL };' >> ${.TARGET} 152 echo 'static char *multilib_extra = "";' >> ${.TARGET} 153 154options.h: 155 echo '#include "cp/lang-options.h"' > ${.TARGET} 156 echo '#include "f/lang-options.h"' >> ${.TARGET} 157 158specs.h: 159 echo '#include "cp/lang-specs.h"' > ${.TARGET} 160 echo '#include "f/lang-specs.h"' >> ${.TARGET} 161 echo '#include "objc/lang-specs.h"' >> ${.TARGET} 162 163tconfig.h: 164 echo '#include "gansidecl.h"' > ${.TARGET} 165 echo '#include "${GCC_ARCH}/xm-${GCC_ARCH}.h"' >> ${.TARGET} 166 167# KEEP THIS IN SYNC with src/gcc/lib/libgcc/Makefile !! 168tm.h: 169 echo '#include "${GCC_ARCH}/${GCC_ARCH}.h"' > ${.TARGET} 170.if ${GCC_ARCH} == "i386" 171 echo '#include "${GCC_ARCH}/att.h"' >> ${.TARGET} 172 echo '#include "svr4.h"' >> ${.TARGET} 173.endif 174 echo '#include <freebsd.h>' >> ${.TARGET} 175 echo '#include "${GCC_ARCH}/freebsd.h"' >> ${.TARGET} 176.if ${GCC_ARCH} == "i386" 177 echo '#include "${GCC_ARCH}/perform.h"' >> ${.TARGET} 178.endif 179 echo '#include <freebsd-native.h>' >> ${.TARGET} 180 181#----------------------------------------------------------------------- 182# General things. 183 184SRCS+= ${GENSRCS} 185CLEANFILES+= ${GENSRCS} 186 187all: ${SRCS} 188 189.include <bsd.prog.mk> 190 191#----------------------------------------------------------------------- 192# Fixups. 193 194# Set OBJS the same as bsd.prog.mk would do if we defined PROG. We can't 195# define PROG because we have multiple programs. 196# 197OBJS+= ${SRCS:N*.h:R:S/$/.o/g} 198 199.if !exists(${DEPENDFILE}) 200# Fudge pre-dependfile dependencies of objects in much the same way as 201# bsd.prog.mk would do if we defined PROG. There are complications to 202# avoid circular dependencies. First, only make most objects depend on 203# all headers. Filter out the objects that would cause problems (i.e., 204# objects that will be used to create programs that will generate headers). 205# 206${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} 207 208# Next, make each of the problematic objects depend on only most headers. 209# Filter out the headers that would cause problems (and a few more when it 210# is inconvenient to filter precisely). 211# 212bitmap.o genattr.o gencodes.o genconfig.o genflags.o obstack.o rtl.o: \ 213 ${SRCS:M*.h:Ninsn-*.h} 214gencheck.o: gencheck.h ${SRCS:M*.h:Ngenrtl.h:Ntree-check.h:Ninsn-*.h} 215gengenrtl.o: ${SRCS:M*.h:Ngenrtl.h:Ninsn-*.h} 216.endif 217