Makefile revision 37460
1117395Skan# 2117395Skan# $Id: Makefile,v 1.11 1998/04/23 16:30:51 bde Exp $ 3117395Skan# 4117395Skan 5117395Skan# 6117395Skan# This could probably be merged with ../cc_int/Makefile, but bsd.lib.mk 7117395Skan# is such a !@#!*#% nightmare because of how it reprograms the dependencies, 8117395Skan# suffix rules, SRCS, etc. It's easiest to cheat by using bsd.prog.mk and 9117395Skan# SRCS to get dependencies. 10117395Skan# 11117395Skan 12117395Skan# ../Makefile.inc will put an absolute path to our objdir in CFLAGS. 13117395Skan# Prevent mkdep from using it, so that we don't have to give rules for 14117395Skan# aliases of generated headers. 15117395Skan# 16117395SkanCFLAGS+= -I. 17117395Skan 18117395Skan.include "../Makefile.inc" 19117395Skan 20117395Skan#----------------------------------------------------------------------- 21117395Skan# Bytecode components 22117395Skan 23117395Skan.for i in arity opcode opname 24117395Skanbuild-tools: bi-$i 25117395Skan 26117395Skanbc-$i.h: bi-$i bytecode.def 27117395Skan ./bi-$i < ${GCCDIR}/bytecode.def > bc-$i.h 28117395Skan 29117395Skanbi-$i: bi-$i.o bi-parser.o bi-lexer.o bi-reverse.o 30117395Skan ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} 31117395Skan 32117395SkanGENSRCS+= bc-$i.h bi-$i.c 33117395SkanCLEANFILES+= bi-$i 34117395Skan.endfor 35117395Skan 36117395Skan.ORDER: bi-parser.c bi-parser.h 37117395Skanbi-parser.c bi-parser.h: bi-parser.y 38117395Skan ${BISON} ${BISONFLAGS} -d ${.ALLSRC} -o bi-parser.c 39117395Skan 40117395SkanSRCS+= bi-lexer.c bi-reverse.c 41117395SkanGENSRCS+= bi-parser.c bi-parser.h 42117395Skan 43117395Skan#----------------------------------------------------------------------- 44117395Skan# insn-* gunk 45117395Skan 46117395Skan.for i in attr codes config flags 47117395Skaninsn-$i.h: gen$i ${MD_FILE} 48117395Skan ./gen$i ${MD_FILE} > insn-$i.h 49117395SkanGENSRCS+= insn-$i.h 50117395Skan.endfor 51117395Skan 52117395Skan.for i in attrtab emit extract opinit output peep recog 53117395Skaninsn-$i.c: gen$i ${MD_FILE} 54117395Skan ./gen$i ${MD_FILE} > insn-$i.c 55117395SkanGENSRCS+= insn-$i.c 56117395Skan.endfor 57117395Skan 58117395Skan.for i in attr codes config emit extract flags opinit output peep recog 59117395Skanbuild-tools: gen$i 60117395Skan 61117395Skangen$i: gen$i.o rtl.o obstack.o 62117395Skan ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} 63117395Skan 64117395SkanGENSRCS+= gen$i.c 65117395SkanCLEANFILES+= gen$i 66117395Skan.endfor 67117395Skan 68117395Skan.for i in attrtab 69117395Skanbuild-tools: gen$i 70117395Skan 71117395Skangen$i: gen$i.o rtl.o rtlanal.o print-rtl.o obstack.o 72117395Skan ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} 73117395Skan 74117395SkanGENSRCS+= gen$i.c 75117395SkanCLEANFILES+= gen$i 76117395Skan.endfor 77117395Skan 78117395SkanSRCS+= print-rtl.c rtl.c rtlanal.c obstack.c 79117395Skan 80117395Skan#----------------------------------------------------------------------- 81117395Skan# C hash codes 82117395Skanc-gperf.h: c-parse.gperf 83117395Skan gperf -p -j1 -i 1 -g -o -t -G -N is_reserved_word -k1,3,$$ \ 84117395Skan ${GCCDIR}/c-parse.gperf > ${.TARGET} 85117395SkanGENSRCS+= c-gperf.h 86117395Skan 87117395Skan#----------------------------------------------------------------------- 88117395Skan# C++ hash codes 89117395Skanhash.h: gxx.gperf 90117395Skan gperf -p -j1 -g -o -t -N is_reserved_word '-k1,4,7,$$' \ 91117395Skan ${GCCDIR}/cp/gxx.gperf >hash.h 92117395SkanGENSRCS+= hash.h 93117395Skan 94117395Skan#----------------------------------------------------------------------- 95117395Skan# C parser 96117395Skan.ORDER: c-parse.c c-parse.h 97117395Skanc-parse.c c-parse.h: c-parse.in 98117395Skan sed -e "/^ifobjc$$/,/^end ifobjc$$/d" \ 99117395Skan -e "/^ifc$$/d" -e "/^end ifc$$/d" \ 100117395Skan ${GCCDIR}/c-parse.in > c-parse.y 101117395Skan ${BISON} -d c-parse.y -o c-parse.c 102117395Skan rm -f c-parse.y 103117395Skan 104117395SkanGENSRCS+= c-parse.c c-parse.h 105117395SkanCLEANFILES+= c-parse.y # insurance 106117395Skan 107117395Skan#----------------------------------------------------------------------- 108117395Skan# objc parser 109117395Skan.ORDER: objc-parse.c objc-parse.h 110117395Skanobjc-parse.c objc-parse.h: c-parse.in 111117395Skan sed -e "/^ifc$$/,/^end ifc$$/d" \ 112117395Skan -e "/^ifobjc$$/d" -e "/^end ifobjc$$/d" \ 113117395Skan ${GCCDIR}/c-parse.in > objc-parse.y 114117395Skan ${BISON} -d objc-parse.y -o objc-parse.c 115117395Skan rm -f objc-parse.y 116117395Skan 117117395SkanGENSRCS+= objc-parse.c objc-parse.h 118117395SkanCLEANFILES+= objc-parse.y # insurance 119117395Skan 120117395Skan#----------------------------------------------------------------------- 121117395Skan# C++ parser done in its own makefile 122117395Skan#----------------------------------------------------------------------- 123117395Skan# CPP parser done in its own makefile 124117395Skan#----------------------------------------------------------------------- 125117395Skan# the host/target compiler config. 126117395Skan 127117395SkanCOMMONHDRS= config.h hconfig.h tconfig.h tm.h options.h specs.h 128117395Skan 129117395Skan${COMMONHDRS}: 130117395Skan echo '#include "${MACHINE_ARCH}/freebsd.h"' > tm.h 131117395Skan echo '#include "${MACHINE_ARCH}/xm-freebsd.h"' > config.h 132117395Skan echo '#include "${MACHINE_ARCH}/xm-freebsd.h"' > hconfig.h 133117395Skan echo '#include "${MACHINE_ARCH}/xm-freebsd.h"' > tconfig.h 134117395Skan echo '#include "cp/lang-options.h"' > options.h 135117395Skan echo '#include "cp/lang-specs.h"' > specs.h 136117395Skan echo '#include "f2c-specs.h"' >> specs.h 137117395Skan 138117395SkanGENSRCS+= ${COMMONHDRS} 139117395Skan 140117395Skan#----------------------------------------------------------------------- 141117395Skan# General things. 142117395Skan 143117395SkanSRCS+= ${GENSRCS} 144117395SkanCLEANFILES+= ${GENSRCS} 145117395Skan 146117395Skanall: ${SRCS} 147117395Skan 148117395Skan.include <bsd.prog.mk> 149117395Skan 150117395Skan#----------------------------------------------------------------------- 151117395Skan# Fixups. 152117395Skan 153117395Skan# Set OBJS the same as bsd.prog.mk would do if we defined PROG. We can't 154117395Skan# define PROG because we have multiple programs. 155117395Skan# 156117395SkanOBJS+= ${SRCS:N*.h:R:S/$/.o/g} 157117395Skan 158117395Skan.if !exists(${DEPENDFILE}) 159117395Skan# Fudge pre-dependfile dependencies of objects the same as bsd.prog.mk 160117395Skan# would do if we defined PROG, except for leaving out dependencies on 161117395Skan# bc-*.h and insn-*.h because these dependencies would be circular. 162117395Skan# 163117395Skan${OBJS}: ${SRCS:M*.h:Nbc-*.h:Ninsn-*.h} 164117395Skan 165117395Skan# Give all dependencies on bc-*.h and insn-*.h explicitly (none here for 166117395Skan# bc-*.h). This suffices for `make -j<any> depend', and after that all 167117395Skan# the dependencies will be in .depend since all .c source files are in 168117395Skan# SRCS. 169117395Skan# 170117395Skangenattrtab.o genextract.o: insn-config.h 171117395Skaninsn-attrtab.o: insn-attr.h insn-config.h 172117395Skaninsn-emit.o: insn-codes.h insn-config.h insn-flags.h 173117395Skaninsn-opinit.o: insn-codes.h insn-config.h insn-flags.h 174117395Skaninsn-output.o: insn-attr.h insn-codes.h insn-config.h insn-flags.h 175117395Skaninsn-recog.o: insn-config.h 176117395Skan.endif 177117395Skan