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