Makefile revision 45519
1# 2# $Id: Makefile,v 1.24 1999/04/08 23:37:46 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${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 57.ORDER: genrtl.c genrtl.h 58genrtl.h genrtl.c: gengenrtl 59 ./gengenrtl genrtl.h genrtl.c 60 61GENSRCS+= genrtl.c genrtl.h 62 63.for i in attrtab 64build-tools: gen$i 65 66gen$i: gen$i.o rtl.o rtlanal.o print-rtl.o obstack.o bitmap.o 67 ${CC} -static ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} 68 69GENSRCS+= gen$i.c 70CLEANFILES+= gen$i 71.endfor 72 73SRCS+= bitmap.c print-rtl.c rtl.c rtlanal.c obstack.c 74#----------------------------------------------------------------------- 75# C hash codes 76c-gperf.h: c-parse.gperf 77 gperf -p -j1 -i 1 -g -o -t -G -N is_reserved_word -k1,3,$$ \ 78 ${GCCDIR}/c-parse.gperf > ${.TARGET} 79GENSRCS+= c-gperf.h 80 81#----------------------------------------------------------------------- 82# C++ hash codes 83hash.h: gxx.gperf 84 gperf -p -j1 -g -o -t -N is_reserved_word '-k1,4,7,$$' \ 85 ${GCCDIR}/cp/gxx.gperf >hash.h 86GENSRCS+= hash.h 87 88#----------------------------------------------------------------------- 89# common parser stuff 90 91tree-check.h: gencheck 92 ./gencheck > ${.TARGET} 93GENSRCS+= tree-check.h 94 95#----------------------------------------------------------------------- 96# C parser 97.ORDER: c-parse.c c-parse.h 98c-parse.c c-parse.h: c-parse.in 99 sed -e "/^ifobjc$$/,/^end ifobjc$$/d" \ 100 -e "/^ifc$$/d" -e "/^end ifc$$/d" \ 101 ${GCCDIR}/c-parse.in > c-parse.y 102 ${BISON} -d c-parse.y -o c-parse.c 103 rm -f c-parse.y 104 105GENSRCS+= c-parse.c c-parse.h 106CLEANFILES+= c-parse.y # insurance 107 108#----------------------------------------------------------------------- 109# objc parser 110.ORDER: objc-parse.c objc-parse.h 111objc-parse.c objc-parse.h: c-parse.in 112 sed -e "/^ifc$$/,/^end ifc$$/d" \ 113 -e "/^ifobjc$$/d" -e "/^end ifobjc$$/d" \ 114 ${GCCDIR}/c-parse.in > objc-parse.y 115 ${BISON} -d objc-parse.y -o objc-parse.c 116 rm -f objc-parse.y 117 118GENSRCS+= objc-parse.c objc-parse.h 119CLEANFILES+= objc-parse.y # insurance 120 121#----------------------------------------------------------------------- 122# C++ parser done in its own makefile 123#----------------------------------------------------------------------- 124# CPP parser done in its own makefile 125#----------------------------------------------------------------------- 126# the host/target compiler config. 127 128COMMONHDRS= config.h hconfig.h options.h specs.h tconfig.h tm.h multilib.h 129GENSRCS+= ${COMMONHDRS} 130 131config.h hconfig.h: 132 echo '#include "auto-host.h"' > ${.TARGET} 133 echo '#include "${MACHINE_ARCH}/xm-${MACHINE_ARCH}.h"' >> ${.TARGET} 134 135tconfig.h: 136 echo '#include "${MACHINE_ARCH}/xm-${MACHINE_ARCH}.h"' > ${.TARGET} 137 138options.h: 139 echo '#include "cp/lang-options.h"' > ${.TARGET} 140 #echo '#include "f/lang-options.h"' >> ${.TARGET} 141 142specs.h: 143 echo '#include "cp/lang-specs.h"' > ${.TARGET} 144 #echo '#include "f/lang-specs.h"' >> ${.TARGET} 145 146tm.h: 147 echo '#include "${MACHINE_ARCH}/${MACHINE_ARCH}.h"' > ${.TARGET} 148.if ${MACHINE_ARCH} == "i386" 149 echo '#include "${MACHINE_ARCH}/att.h"' >> ${.TARGET} 150.endif 151 echo '#include "${MACHINE_ARCH}/freebsd.h"' >> ${.TARGET} 152.if ${MACHINE_ARCH} == "i386" 153 echo '#include "${MACHINE_ARCH}/perform.h"' >> ${.TARGET} 154.endif 155 156multilib.h: genmultilib 157 echo 'static char *multilib_raw[] = {"aout maout;", "elf !maout;", NULL};' > multilib.h 158 echo 'static char *multilib_matches_raw[] = {"maout maout;", "melf melf;", NULL};' >> multilib.h 159 echo 'static char *multilib_extra = "";' >> multilib.h 160 161#----------------------------------------------------------------------- 162# General things. 163 164SRCS+= ${GENSRCS} 165CLEANFILES+= ${GENSRCS} 166 167all: ${SRCS} 168 169.include <bsd.prog.mk> 170 171#----------------------------------------------------------------------- 172# Fixups. 173 174# Set OBJS the same as bsd.prog.mk would do if we defined PROG. We can't 175# define PROG because we have multiple programs. 176# 177OBJS+= ${SRCS:N*.h:R:S/$/.o/g} 178 179.if !exists(${DEPENDFILE}) 180# Fudge pre-dependfile dependencies of objects in much the same way as 181# bsd.prog.mk would do if we defined PROG. There are complications to 182# avoid circular dependencies. First, only make most objects depend on 183# all headers. Filter out the objects that would cause problems (i.e., 184# objects that will be used to create programs that will generate headers). 185# 186${OBJS:Nbitmap.o:Ngenattr.o:Ngencheck.o:Ngencodes.o:Ngenconfig.o:Ngenflags.o:Ngengenrtl.o:Nobstack.o:Nrtl.o}: ${SRCS:M*.h} 187 188# Next, make each of the problematic objects depend on only most headers. 189# Filter out the headers that would cause problems (and a few more when it 190# is inconvenient to filter precisely). 191# 192bitmap.o genattr.o gencodes.o genconfig.o genflags.o obstack.o rtl.o: \ 193 ${SRCS:M*.h:Ninsn-*.h} 194gencheck.o: ${SRCS:M*.h:Ngenrtl.h:Ntree-check.h:Ninsn-*.h} 195gengenrtl.o: ${SRCS:M*.h:Ngenrtl.h:Ninsn-*.h} 196.endif 197