Makefile revision 45582
1# 2# $Id: Makefile,v 1.25 1999/04/09 18:46:48 bde 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 20CFLAGS+= -I${GCCDIR}/objc 21 22.PATH: ${GCCDIR} ${GCCDIR}/cp 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 check genrtl 50build-tools: gen$i 51 52gen$i: gen$i.o 53 ${CC} -static ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} 54 55GENSRCS+= gen$i.c 56CLEANFILES+= gen$i 57.endfor 58 59.ORDER: genrtl.c genrtl.h 60genrtl.h genrtl.c: gengenrtl 61 ./gengenrtl genrtl.h genrtl.c 62 63GENSRCS+= genrtl.c genrtl.h 64 65.for i in attrtab 66build-tools: gen$i 67 68gen$i: gen$i.o rtl.o rtlanal.o print-rtl.o obstack.o bitmap.o 69 ${CC} -static ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} 70 71GENSRCS+= gen$i.c 72CLEANFILES+= gen$i 73.endfor 74 75SRCS+= bitmap.c print-rtl.c rtl.c rtlanal.c obstack.c 76#----------------------------------------------------------------------- 77# C hash codes 78c-gperf.h: c-parse.gperf 79 gperf -p -j1 -i 1 -g -o -t -G -N is_reserved_word -k1,3,$$ \ 80 ${GCCDIR}/c-parse.gperf > ${.TARGET} 81GENSRCS+= c-gperf.h 82 83#----------------------------------------------------------------------- 84# C++ hash codes 85hash.h: gxx.gperf 86 gperf -p -j1 -g -o -t -N is_reserved_word '-k1,4,7,$$' \ 87 ${GCCDIR}/cp/gxx.gperf >hash.h 88GENSRCS+= hash.h 89 90#----------------------------------------------------------------------- 91# common parser stuff 92 93tree-check.h: gencheck 94 ./gencheck > ${.TARGET} 95GENSRCS+= tree-check.h 96 97#----------------------------------------------------------------------- 98# C parser 99.ORDER: c-parse.c c-parse.h 100c-parse.c c-parse.h: c-parse.in 101 sed -e "/^ifobjc$$/,/^end ifobjc$$/d" \ 102 -e "/^ifc$$/d" -e "/^end ifc$$/d" \ 103 ${GCCDIR}/c-parse.in > c-parse.y 104 ${BISON} -d c-parse.y -o c-parse.c 105 rm -f c-parse.y 106 107GENSRCS+= c-parse.c c-parse.h 108CLEANFILES+= c-parse.y # insurance 109 110#----------------------------------------------------------------------- 111# objc parser 112.ORDER: objc-parse.c objc-parse.h 113objc-parse.c objc-parse.h: c-parse.in 114 sed -e "/^ifc$$/,/^end ifc$$/d" \ 115 -e "/^ifobjc$$/d" -e "/^end ifobjc$$/d" \ 116 ${GCCDIR}/c-parse.in > objc-parse.y 117 ${BISON} -d objc-parse.y -o objc-parse.c 118 rm -f objc-parse.y 119 120GENSRCS+= objc-parse.c objc-parse.h 121CLEANFILES+= objc-parse.y # insurance 122 123#----------------------------------------------------------------------- 124# C++ parser done in its own makefile 125#----------------------------------------------------------------------- 126# CPP parser done in its own makefile 127#----------------------------------------------------------------------- 128# the host/target compiler config. 129 130COMMONHDRS= config.h hconfig.h options.h specs.h tconfig.h tm.h multilib.h 131GENSRCS+= ${COMMONHDRS} 132 133config.h hconfig.h: 134 echo '#include "auto-host.h"' > ${.TARGET} 135 echo '#include "${MACHINE_ARCH}/xm-${MACHINE_ARCH}.h"' >> ${.TARGET} 136 137tconfig.h: 138 echo '#include "${MACHINE_ARCH}/xm-${MACHINE_ARCH}.h"' > ${.TARGET} 139 140options.h: 141 echo '#include "cp/lang-options.h"' > ${.TARGET} 142 #echo '#include "f/lang-options.h"' >> ${.TARGET} 143 144specs.h: 145 echo '#include "cp/lang-specs.h"' > ${.TARGET} 146 #echo '#include "f/lang-specs.h"' >> ${.TARGET} 147 148tm.h: 149 echo '#include "${MACHINE_ARCH}/${MACHINE_ARCH}.h"' > ${.TARGET} 150.if ${MACHINE_ARCH} == "i386" 151 echo '#include "${MACHINE_ARCH}/att.h"' >> ${.TARGET} 152.endif 153 echo '#include "${MACHINE_ARCH}/freebsd.h"' >> ${.TARGET} 154.if ${MACHINE_ARCH} == "i386" 155 echo '#include "${MACHINE_ARCH}/perform.h"' >> ${.TARGET} 156.endif 157 158multilib.h: genmultilib 159 echo 'static char *multilib_raw[] = {"aout maout;", "elf !maout;", NULL};' > multilib.h 160 echo 'static char *multilib_matches_raw[] = {"maout maout;", "melf melf;", NULL};' >> multilib.h 161 echo 'static char *multilib_extra = "";' >> multilib.h 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