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