Makefile revision 35402
1# 2# $Id: Makefile,v 1.10 1998/03/23 11:50:38 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 20#----------------------------------------------------------------------- 21# Bytecode components 22 23.for i in arity opcode opname 24bc-$i.h: bi-$i bytecode.def 25 ./bi-$i < ${GCCDIR}/bytecode.def > bc-$i.h 26 27bi-$i: bi-$i.o bi-parser.o bi-lexer.o bi-reverse.o 28 ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} 29 30GENSRCS+= bc-$i.h bi-$i.c 31CLEANFILES+= bi-$i 32.endfor 33 34.ORDER: bi-parser.c bi-parser.h 35bi-parser.c bi-parser.h: bi-parser.y 36 ${BISON} ${BISONFLAGS} -d ${.ALLSRC} -o bi-parser.c 37 38SRCS+= bi-lexer.c bi-reverse.c 39GENSRCS+= bi-parser.c bi-parser.h 40 41#----------------------------------------------------------------------- 42# insn-* gunk 43 44.for i in attr codes config flags 45insn-$i.h: gen$i ${MD_FILE} 46 ./gen$i ${MD_FILE} > insn-$i.h 47GENSRCS+= insn-$i.h 48.endfor 49 50.for i in attrtab emit extract opinit output peep recog 51insn-$i.c: gen$i ${MD_FILE} 52 ./gen$i ${MD_FILE} > insn-$i.c 53GENSRCS+= insn-$i.c 54.endfor 55 56.for i in attr codes config emit extract flags opinit output peep recog 57gen$i: gen$i.o rtl.o obstack.o 58 ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} 59 60GENSRCS+= gen$i.c 61CLEANFILES+= gen$i 62.endfor 63 64.for i in attrtab 65gen$i: gen$i.o rtl.o rtlanal.o print-rtl.o obstack.o 66 ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} 67 68GENSRCS+= gen$i.c 69CLEANFILES+= gen$i 70.endfor 71 72SRCS+= print-rtl.c rtl.c rtlanal.c obstack.c 73 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# C parser 90.ORDER: c-parse.c c-parse.h 91c-parse.c c-parse.h: c-parse.in 92 sed -e "/^ifobjc$$/,/^end ifobjc$$/d" \ 93 -e "/^ifc$$/d" -e "/^end ifc$$/d" \ 94 ${GCCDIR}/c-parse.in > c-parse.y 95 ${BISON} -d c-parse.y -o c-parse.c 96 rm -f c-parse.y 97 98GENSRCS+= c-parse.c c-parse.h 99CLEANFILES+= c-parse.y # insurance 100 101#----------------------------------------------------------------------- 102# objc parser 103.ORDER: objc-parse.c objc-parse.h 104objc-parse.c objc-parse.h: c-parse.in 105 sed -e "/^ifc$$/,/^end ifc$$/d" \ 106 -e "/^ifobjc$$/d" -e "/^end ifobjc$$/d" \ 107 ${GCCDIR}/c-parse.in > objc-parse.y 108 ${BISON} -d objc-parse.y -o objc-parse.c 109 rm -f objc-parse.y 110 111GENSRCS+= objc-parse.c objc-parse.h 112CLEANFILES+= objc-parse.y # insurance 113 114#----------------------------------------------------------------------- 115# C++ parser done in its own makefile 116#----------------------------------------------------------------------- 117# CPP parser done in its own makefile 118#----------------------------------------------------------------------- 119# the host/target compiler config. 120 121COMMONHDRS= config.h hconfig.h tconfig.h tm.h options.h specs.h 122 123${COMMONHDRS}: 124 echo '#include "${MACHINE_ARCH}/freebsd.h"' > tm.h 125 echo '#include "${MACHINE_ARCH}/xm-freebsd.h"' > config.h 126 echo '#include "${MACHINE_ARCH}/xm-freebsd.h"' > hconfig.h 127 echo '#include "${MACHINE_ARCH}/xm-freebsd.h"' > tconfig.h 128 echo '#include "cp/lang-options.h"' > options.h 129 echo '#include "cp/lang-specs.h"' > specs.h 130 echo '#include "f2c-specs.h"' >> specs.h 131 132GENSRCS+= ${COMMONHDRS} 133 134#----------------------------------------------------------------------- 135# General things. 136 137SRCS+= ${GENSRCS} 138CLEANFILES+= ${GENSRCS} 139 140all: ${SRCS} 141 142.include <bsd.prog.mk> 143 144#----------------------------------------------------------------------- 145# Fixups. 146 147# Set OBJS the same as bsd.prog.mk would do if we defined PROG. We can't 148# define PROG because we have multiple programs. 149# 150OBJS+= ${SRCS:N*.h:R:S/$/.o/g} 151 152.if !exists(${DEPENDFILE}) 153# Fudge pre-dependfile dependencies of objects the same as bsd.prog.mk 154# would do if we defined PROG, except for leaving out dependencies on 155# bc-*.h and insn-*.h because these dependencies would be circular. 156# 157${OBJS}: ${SRCS:M*.h:Nbc-*.h:Ninsn-*.h} 158 159# Give all dependencies on bc-*.h and insn-*.h explicitly (none here for 160# bc-*.h). This suffices for `make -j<any> depend', and after that all 161# the dependencies will be in .depend since all .c source files are in 162# SRCS. 163# 164genattrtab.o genextract.o: insn-config.h 165insn-attrtab.o: insn-attr.h insn-config.h 166insn-emit.o: insn-codes.h insn-config.h insn-flags.h 167insn-opinit.o: insn-codes.h insn-config.h insn-flags.h 168insn-output.o: insn-attr.h insn-codes.h insn-config.h insn-flags.h 169insn-recog.o: insn-config.h 170.endif 171