Makefile revision 50472
1# $FreeBSD: head/gnu/usr.bin/cc/cc_tools/Makefile 50472 1999-08-27 23:37:10Z peter $ 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 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 84hash.h: gxx.gperf 85 gperf -p -j1 -g -o -t -N is_reserved_word '-k1,4,7,$$' \ 86 ${GCCDIR}/cp/gxx.gperf >hash.h 87GENSRCS+= hash.h 88 89#----------------------------------------------------------------------- 90# Common parser stuff. 91 92tree-check.h: gencheck 93 ./gencheck > ${.TARGET} 94GENSRCS+= tree-check.h 95 96#----------------------------------------------------------------------- 97# C parser 98.ORDER: c-parse.c c-parse.h 99c-parse.c c-parse.h: c-parse.in 100 sed -e "/^ifobjc$$/,/^end ifobjc$$/d" \ 101 -e "/^ifc$$/d" -e "/^end ifc$$/d" \ 102 ${GCCDIR}/c-parse.in > c-parse.y 103 ${YACC} -d -o c-parse.c c-parse.y 104 mv c-parse.y c-parse.y.out 105 106GENSRCS+= c-parse.c c-parse.h 107CLEANFILES+= c-parse.y c-parse.y.out # insurance 108 109#----------------------------------------------------------------------- 110# objc parser 111.ORDER: objc-parse.c objc-parse.h 112objc-parse.c objc-parse.h: c-parse.in 113 sed -e "/^ifc$$/,/^end ifc$$/d" \ 114 -e "/^ifobjc$$/d" -e "/^end ifobjc$$/d" \ 115 ${GCCDIR}/c-parse.in > objc-parse.y 116 ${YACC} -d -o objc-parse.c objc-parse.y 117 mv objc-parse.y objc-parse.y.out 118 119GENSRCS+= objc-parse.c objc-parse.h 120CLEANFILES+= objc-parse.y objc-parse.y.out # insurance 121 122#----------------------------------------------------------------------- 123# C++ parser done in its own makefile 124#----------------------------------------------------------------------- 125# CPP parser done in its own makefile 126#----------------------------------------------------------------------- 127# the host/target compiler config. 128 129COMMONHDRS= config.h hconfig.h multilib.h options.h specs.h tconfig.h tm.h 130GENSRCS+= ${COMMONHDRS} 131 132config.h hconfig.h: 133 echo '#include "auto-host.h"' > ${.TARGET} 134 echo '#include "${GCC_ARCH}/xm-${GCC_ARCH}.h"' >> ${.TARGET} 135 136multilib.h: 137 echo 'static char *multilib_raw[] = { \ 138 "aout maout;", "elf !maout;", NULL };' > ${.TARGET} 139 echo 'static char *multilib_matches_raw[] = { \ 140 "maout maout;", "melf melf;", NULL };' >> ${.TARGET} 141 echo 'static char *multilib_extra = "";' >> ${.TARGET} 142 143options.h: 144 echo '#include "cp/lang-options.h"' > ${.TARGET} 145 echo '#include "f/lang-options.h"' >> ${.TARGET} 146 147specs.h: 148 echo '#include "cp/lang-specs.h"' > ${.TARGET} 149 echo '#include "f/lang-specs.h"' >> ${.TARGET} 150 151tconfig.h: 152 echo '#include "${GCC_ARCH}/xm-${GCC_ARCH}.h"' > ${.TARGET} 153 154tm.h: 155 echo '#include "${GCC_ARCH}/${GCC_ARCH}.h"' > ${.TARGET} 156.if ${GCC_ARCH} == "i386" 157 echo '#include "${GCC_ARCH}/att.h"' >> ${.TARGET} 158 echo '#include "svr4.h"' >> ${.TARGET} 159.endif 160 echo '#include "${GCC_ARCH}/freebsd.h"' >> ${.TARGET} 161.if ${GCC_ARCH} == "i386" 162 echo '#include "${GCC_ARCH}/perform.h"' >> ${.TARGET} 163.endif 164 echo '#include <freebsd-native.h>' >> ${.TARGET} 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 in much the same way as 186# bsd.prog.mk would do if we defined PROG. There are complications to 187# avoid circular dependencies. First, only make most objects depend on 188# all headers. Filter out the objects that would cause problems (i.e., 189# objects that will be used to create programs that will generate headers). 190# 191${OBJS:Nbitmap.o:Ngenattr.o:Ngencheck.o:Ngencodes.o:Ngenconfig.o:Ngenflags.o:Ngengenrtl.o:Nobstack.o:Nrtl.o}: ${SRCS:M*.h} 192 193# Next, make each of the problematic objects depend on only most headers. 194# Filter out the headers that would cause problems (and a few more when it 195# is inconvenient to filter precisely). 196# 197bitmap.o genattr.o gencodes.o genconfig.o genflags.o obstack.o rtl.o: \ 198 ${SRCS:M*.h:Ninsn-*.h} 199gencheck.o: ${SRCS:M*.h:Ngenrtl.h:Ntree-check.h:Ninsn-*.h} 200gengenrtl.o: ${SRCS:M*.h:Ngenrtl.h:Ninsn-*.h} 201.endif 202