# # $Id: Makefile,v 1.21 1999/04/08 09:57:51 obrien Exp $ # # # This could probably be merged with ../cc_int/Makefile, but bsd.lib.mk # is such a !@#!*#% nightmare because of how it reprograms the dependencies, # suffix rules, SRCS, etc. It's easiest to cheat by using bsd.prog.mk and # SRCS to get dependencies. # # ../Makefile.inc will put an absolute path to our objdir in CFLAGS. # Prevent mkdep from using it, so that we don't have to give rules for # aliases of generated headers. # CFLAGS+= -I${GCCDIR}/objc .include "../Makefile.inc" .PATH: ${GCCDIR} ${GCCDIR}/cp #----------------------------------------------------------------------- # insn-* gunk .for i in attr codes config flags insn-$i.h: gen$i ${MD_FILE} ./gen$i ${MD_FILE} > insn-$i.h GENSRCS+= insn-$i.h .endfor .for i in attrtab emit extract opinit output peep recog insn-$i.c: gen$i ${MD_FILE} ./gen$i ${MD_FILE} > insn-$i.c GENSRCS+= insn-$i.c .endfor .for i in attr codes config emit extract flags opinit output peep recog build-tools: gen$i gen$i: gen$i.o rtl.o obstack.o bitmap.o ${CC} -static ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} GENSRCS+= gen$i.c CLEANFILES+= gen$i .endfor .for i in check genrtl build-tools: gen$i gen$i: gen$i.o ${CC} -static ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} GENSRCS+= gen$i.c CLEANFILES+= gen$i .endfor genrtl.h genrtl.c: gengenrtl ./gengenrtl genrtl.h genrtl.c GENSRCS+= genrtl.c genrtl.h .for i in attrtab build-tools: gen$i gen$i: gen$i.o rtl.o rtlanal.o print-rtl.o obstack.o bitmap.o ${CC} -static ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} GENSRCS+= gen$i.c CLEANFILES+= gen$i .endfor SRCS+= bitmap.c print-rtl.c rtl.c rtlanal.c obstack.c #----------------------------------------------------------------------- # C hash codes c-gperf.h: c-parse.gperf gperf -p -j1 -i 1 -g -o -t -G -N is_reserved_word -k1,3,$$ \ ${GCCDIR}/c-parse.gperf > ${.TARGET} GENSRCS+= c-gperf.h #----------------------------------------------------------------------- # C++ hash codes hash.h: gxx.gperf gperf -p -j1 -g -o -t -N is_reserved_word '-k1,4,7,$$' \ ${GCCDIR}/cp/gxx.gperf >hash.h GENSRCS+= hash.h #----------------------------------------------------------------------- # common parser stuff .for i in c objc $i-parse.c: tree-check.h .endfor tree-check.h: gencheck ./gencheck > ${.TARGET} CLEANFILES+= tree-check.h #----------------------------------------------------------------------- # C parser .ORDER: c-parse.c c-parse.h c-parse.c c-parse.h: c-parse.in sed -e "/^ifobjc$$/,/^end ifobjc$$/d" \ -e "/^ifc$$/d" -e "/^end ifc$$/d" \ ${GCCDIR}/c-parse.in > c-parse.y ${BISON} -d c-parse.y -o c-parse.c rm -f c-parse.y GENSRCS+= c-parse.c c-parse.h CLEANFILES+= c-parse.y # insurance #----------------------------------------------------------------------- # objc parser .ORDER: objc-parse.c objc-parse.h objc-parse.c objc-parse.h: c-parse.in sed -e "/^ifc$$/,/^end ifc$$/d" \ -e "/^ifobjc$$/d" -e "/^end ifobjc$$/d" \ ${GCCDIR}/c-parse.in > objc-parse.y ${BISON} -d objc-parse.y -o objc-parse.c rm -f objc-parse.y GENSRCS+= objc-parse.c objc-parse.h CLEANFILES+= objc-parse.y # insurance #----------------------------------------------------------------------- # C++ parser done in its own makefile #----------------------------------------------------------------------- # CPP parser done in its own makefile #----------------------------------------------------------------------- # the host/target compiler config. COMMONHDRS= config.h hconfig.h options.h specs.h tconfig.h tm.h multilib.h GENSRCS+= ${COMMONHDRS} config.h hconfig.h: echo '#include "auto-host.h"' > ${.TARGET} echo '#include "${MACHINE_ARCH}/xm-${MACHINE_ARCH}.h"' >> ${.TARGET} tconfig.h: echo '#include "${MACHINE_ARCH}/xm-${MACHINE_ARCH}.h"' > ${.TARGET} options.h: echo '#include "cp/lang-options.h"' > ${.TARGET} #echo '#include "f/lang-options.h"' >> ${.TARGET} specs.h: echo '#include "cp/lang-specs.h"' > ${.TARGET} #echo '#include "f/lang-specs.h"' >> ${.TARGET} tm.h: echo '#include "${MACHINE_ARCH}/${MACHINE_ARCH}.h"' > ${.TARGET} .if ${MACHINE_ARCH} == "i386" echo '#include "${MACHINE_ARCH}/att.h"' >> ${.TARGET} .endif echo '#include "${MACHINE_ARCH}/freebsd.h"' >> ${.TARGET} .if ${MACHINE_ARCH} == "i386" echo '#include "${MACHINE_ARCH}/perform.h"' >> ${.TARGET} .endif multilib.h: genmultilib echo 'static char *multilib_raw[] = {"aout maout;elf !maout;", NULL};' > multilib.h echo 'static char *orig_port_multilib_raw[] = {".;", NULL};' >> multilib.h echo 'static char *multilib_matches_raw[] = {NULL};' >> multilib.h echo 'static char *multilib_extra = "";' >> multilib.h #----------------------------------------------------------------------- # General things. SRCS+= ${GENSRCS} CLEANFILES+= ${GENSRCS} all: ${SRCS} .include #----------------------------------------------------------------------- # Fixups. # Set OBJS the same as bsd.prog.mk would do if we defined PROG. We can't # define PROG because we have multiple programs. # OBJS+= ${SRCS:N*.h:R:S/$/.o/g} .if !exists(${DEPENDFILE}) # Fudge pre-dependfile dependencies of objects the same as bsd.prog.mk # would do if we defined PROG, except for leaving out dependencies on # insn-*.h because these dependencies would be circular. # # XXX pre-egcs we used something simular to this line. Now it causes cycles... # ${OBJS}: ${SRCS:M*.h:Ninsn-*.h:Ntree-check.h:Ngenrtl.h} ${OBJS}: ${COMMONHDRS:M*.h} # Give all dependencies on insn-*.h explicitly # This suffices for `make -j depend', and after that all # the dependencies will be in .depend since all .c source files are in # SRCS. # genattrtab.o genextract.o: insn-config.h insn-attrtab.o: insn-attr.h insn-config.h insn-emit.o: insn-codes.h insn-config.h insn-flags.h insn-opinit.o: insn-codes.h insn-config.h insn-flags.h insn-output.o: insn-attr.h insn-codes.h insn-config.h insn-flags.h insn-recog.o: insn-config.h genattr.o gencodes.o genconfig.o genemit.o genextract.o genflags.o genopinit.o genoutput.o genpeep.o genrecog.o: genrtl.h .endif