Makefile revision 45466
1# 2# $Id: Makefile,v 1.18 1999/04/05 10:18:50 peter 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${GCCDIR}/objc 17 18.include "../Makefile.inc" 19 20.PATH: ${GCCDIR} ${GCCDIR}/cp 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 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 check genrtl 48build-tools: gen$i 49 50gen$i: gen$i.o 51 ${CC} -static ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} 52 53GENSRCS+= gen$i.c 54CLEANFILES+= gen$i 55.endfor 56 57genrtl.h genrtl.c: gengenrtl 58 ./gengenrtl genrtl.h genrtl.c 59 60GENSRCS+= genrtl.c genrtl.h 61 62.for i in attrtab 63build-tools: gen$i 64 65gen$i: gen$i.o rtl.o rtlanal.o print-rtl.o obstack.o bitmap.o 66 ${CC} -static ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} 67 68GENSRCS+= gen$i.c 69CLEANFILES+= gen$i 70.endfor 71 72SRCS+= bitmap.c print-rtl.c rtl.c rtlanal.c obstack.c 73#----------------------------------------------------------------------- 74# C hash codes 75c-gperf.h: c-parse.gperf 76 gperf -p -j1 -i 1 -g -o -t -G -N is_reserved_word -k1,3,$$ \ 77 ${GCCDIR}/c-parse.gperf > ${.TARGET} 78GENSRCS+= c-gperf.h 79 80#----------------------------------------------------------------------- 81# C++ hash codes 82hash.h: gxx.gperf 83 gperf -p -j1 -g -o -t -N is_reserved_word '-k1,4,7,$$' \ 84 ${GCCDIR}/cp/gxx.gperf >hash.h 85GENSRCS+= hash.h 86 87#----------------------------------------------------------------------- 88# common parser stuff 89 90.for i in c objc 91$i-parse.c: tree-check.h 92.endfor 93 94tree-check.h: gencheck 95 ./gencheck > ${.TARGET} 96 97GENSRCS+= tree-check.h 98 99#----------------------------------------------------------------------- 100# C parser 101.ORDER: c-parse.c c-parse.h 102c-parse.c c-parse.h: c-parse.in 103 sed -e "/^ifobjc$$/,/^end ifobjc$$/d" \ 104 -e "/^ifc$$/d" -e "/^end ifc$$/d" \ 105 ${GCCDIR}/c-parse.in > c-parse.y 106 ${BISON} -d c-parse.y -o c-parse.c 107 rm -f c-parse.y 108 109GENSRCS+= c-parse.c c-parse.h 110CLEANFILES+= c-parse.y # insurance 111 112#----------------------------------------------------------------------- 113# objc parser 114.ORDER: objc-parse.c objc-parse.h 115objc-parse.c objc-parse.h: c-parse.in 116 sed -e "/^ifc$$/,/^end ifc$$/d" \ 117 -e "/^ifobjc$$/d" -e "/^end ifobjc$$/d" \ 118 ${GCCDIR}/c-parse.in > objc-parse.y 119 ${BISON} -d objc-parse.y -o objc-parse.c 120 rm -f objc-parse.y 121 122GENSRCS+= objc-parse.c objc-parse.h 123CLEANFILES+= objc-parse.y # insurance 124 125#----------------------------------------------------------------------- 126# C++ parser done in its own makefile 127#----------------------------------------------------------------------- 128# CPP parser done in its own makefile 129#----------------------------------------------------------------------- 130# the host/target compiler config. 131 132COMMONHDRS= config.h hconfig.h options.h specs.h tconfig.h tm.h multilib.h 133GENSRCS+= ${COMMONHDRS} 134 135config.h hconfig.h: 136 echo '#include "auto-host.h"' > ${.TARGET} 137 echo '#include "${MACHINE_ARCH}/xm-${MACHINE_ARCH}.h"' >> ${.TARGET} 138 139tconfig.h: 140 echo '#include "${MACHINE_ARCH}/xm-${MACHINE_ARCH}.h"' > ${.TARGET} 141 142options.h: 143 echo '#include "cp/lang-options.h"' > ${.TARGET} 144 #echo '#include "f/lang-options.h"' >> ${.TARGET} 145 146specs.h: 147 echo '#include "cp/lang-specs.h"' > ${.TARGET} 148 #echo '#include "f/lang-specs.h"' >> ${.TARGET} 149 150tm.h: 151 echo '#include "${MACHINE_ARCH}/${MACHINE_ARCH}.h"' > ${.TARGET} 152.if ${MACHINE_ARCH} == "i386" 153 echo '#include "${MACHINE_ARCH}/att.h"' >> ${.TARGET} 154.endif 155 echo '#include "${MACHINE_ARCH}/freebsd.h"' >> ${.TARGET} 156.if ${MACHINE_ARCH} == "i386" 157 echo '#include "${MACHINE_ARCH}/perform.h"' >> ${.TARGET} 158.endif 159 160multilib.h: genmultilib 161 echo 'static char *multilib_raw[] = {"aout maout;elf !maout;", NULL};' > multilib.h 162 echo 'static char *orig_port_multilib_raw[] = {".;", NULL};' >> multilib.h 163 echo 'static char *multilib_matches_raw[] = {NULL};' >> multilib.h 164 echo 'static char *multilib_extra = "";' >> multilib.h 165 166#----------------------------------------------------------------------- 167# General things. 168 169SRCS+= ${GENSRCS} 170CLEANFILES+= ${GENSRCS} 171 172all: ${SRCS} 173 174.include <bsd.prog.mk> 175 176#----------------------------------------------------------------------- 177# Fixups. 178 179# Set OBJS the same as bsd.prog.mk would do if we defined PROG. We can't 180# define PROG because we have multiple programs. 181# 182OBJS+= ${SRCS:N*.h:R:S/$/.o/g} 183 184.if !exists(${DEPENDFILE}) 185# Fudge pre-dependfile dependencies of objects the same as bsd.prog.mk 186# would do if we defined PROG, except for leaving out dependencies on 187# insn-*.h because these dependencies would be circular. 188# 189${OBJS}: ${SRCS:M*.h:Ninsn-*.h:Ntree-check.h:Ngenrtl.h} 190 191# Give all dependencies on insn-*.h explicitly 192# This suffices for `make -j<any> depend', and after that all 193# the dependencies will be in .depend since all .c source files are in 194# SRCS. 195# 196genattrtab.o genextract.o: insn-config.h 197insn-attrtab.o: insn-attr.h insn-config.h 198insn-emit.o: insn-codes.h insn-config.h insn-flags.h 199insn-opinit.o: insn-codes.h insn-config.h insn-flags.h 200insn-output.o: insn-attr.h insn-codes.h insn-config.h insn-flags.h 201insn-recog.o: insn-config.h 202 203genattr.o gencodes.o genconfig.o genemit.o genextract.o genflags.o genopinit.o genoutput.o genpeep.o genrecog.o: genrtl.h 204.endif 205