Use .lo for host tool objects.

Use CPPFLAGS.file correctly (CPPFLAGS.foo.c _not_ CPPFLAGS.foo.o !)
Support MAKEVERBOSE.
Be consistent about make(1) variable use.
This commit is contained in:
lukem 2003-11-16 16:24:48 +00:00
parent 535a27811f
commit 59c9b264d0

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.11 2003/11/05 00:05:48 mrg Exp $ # $NetBSD: Makefile,v 1.12 2003/11/16 16:24:48 lukem Exp $
NOLINKLIB= # defined NOLINKLIB= # defined
NOLINT= # defined NOLINT= # defined
@ -23,24 +23,26 @@ DPSRCS+= insn-attr.h insn-codes.h insn-config.h insn-flags.h tree-check.h
# #
# Independent generation programs. # Independent generation programs.
# #
CLEANFILES+= gengenrtl gengenrtl.o genrtl.c genrtl.h \ CLEANFILES+= gengenrtl genrtl.c genrtl.h \
gengtype gtyp-gen.h gtype-desc.c gtype-desc.h \ gengtype gtyp-gen.h gtype-desc.c gtype-desc.h \
gtype-c.h gtype-cp.h gtype-f.h gtype-objc.h \ gtype-c.h gtype-cp.h gtype-f.h gtype-objc.h \
genflags genflags.h \ genflags genflags.h \
gencheck tree-check.h \ gencheck tree-check.h \
genpreds tm-preds.h tm_p.h cs-tm_p.h \ genpreds tm-preds.h tm_p.h cs-tm_p.h \
auto-host.h print-rtl1.c \ auto-host.h print-rtl1.c \
build-rtl.c build-errors.c build-varray.c build-bitmap.c build-ggc-none.c \ build-rtl.c build-errors.c build-varray.c \
gt-*.h *.o \ build-bitmap.c build-ggc-none.c \
gt-*.h *.o *.lo \
config.h cs-config.h \ config.h cs-config.h \
# #
# These files have special needs # These files have special needs
# #
COPTS.prefix.o= -DPREFIX=\"$(prefix)\" CPPFLAGS.build-errors.c= -DGENERATOR_FILE
COPTS.toplev.o= -DTARGET_NAME=\"$(target_alias)\" CPPFLAGS.build-ggc-none.c= -DGENERATOR_FILE
COPTS.insn-conditions.c= -DGENERATOR_FILE CPPFLAGS.build-rtl.c= -DGENERATOR_FILE
COPTS.sparc.o= -DTARGET_CPU_DEFAULT=${G_target_cpu_default} CPPFLAGS.insn-conditions.c= -DGENERATOR_FILE
CPPFLAGS.print-rtl1.c= -DGENERATOR_FILE
# XXX # XXX
.if ${MACHINE_ARCH} == "m68k" || ${MACHINE_ARCH} == "m68000" .if ${MACHINE_ARCH} == "m68k" || ${MACHINE_ARCH} == "m68000"
@ -54,84 +56,91 @@ HH= ${G_HCONFIG_H} genrtl.h
# Generate the various header files we need. # Generate the various header files we need.
# #
genrtl.c: gengenrtl genrtl.c: gengenrtl
./gengenrtl > genrtl.c ${_MKTARGET_CREATE}
./gengenrtl >${.TARGET}
genrtl.h: gengenrtl genrtl.h: gengenrtl
./gengenrtl -h > genrtl.h ${_MKTARGET_CREATE}
gengenrtl.o: gengenrtl.c ${G_HCONFIG_H} ./gengenrtl -h >${.TARGET}
${HOST_COMPILE.c} $< gengenrtl.lo: ${G_HCONFIG_H}
gengenrtl: gengenrtl.o gengenrtl: gengenrtl.lo
${HOST_LINK.c} -o $@ $> ${NBCOMPATLIB} ${HOSTLIBIBERTY} ${_MKTARGET_LINK}
${HOST_LINK.c} -o ${.TARGET} ${.ALLSRC} ${NBCOMPATLIB} ${HOSTLIBIBERTY}
tm-preds.h: genpreds tm-preds.h: genpreds
./genpreds > tm-preds.h ${_MKTARGET_CREATE}
genpreds.o: genpreds.c $(HH) ./genpreds >${.TARGET}
${HOST_COMPILE.c} $< genpreds.lo: ${HH}
genpreds: genpreds.o genpreds: genpreds.lo
${HOST_LINK.c} -o $@ $> ${NBCOMPATLIB} ${HOSTLIBIBERTY} ${_MKTARGET_LINK}
${HOST_LINK.c} -o ${.TARGET} ${.ALLSRC} ${NBCOMPATLIB} ${HOSTLIBIBERTY}
tree-check.h: gencheck tree-check.h: gencheck
./gencheck >$@ ${_MKTARGET_CREATE}
gencheck.o: gencheck.c $(HH) ./gencheck >${.TARGET}
${HOST_COMPILE.c} $< gencheck.lo: ${HH}
gencheck: gencheck.o gencheck: gencheck.lo
${HOST_LINK.c} -o $@ $> ${NBCOMPATLIB} ${HOSTLIBIBERTY} ${_MKTARGET_LINK}
${HOST_LINK.c} -o ${.TARGET} ${.ALLSRC} ${NBCOMPATLIB} ${HOSTLIBIBERTY}
gtype-desc.c: gtype-desc.h gtype-desc.c: gtype-desc.h
gtype-desc.h: gengtype gtype-desc.h: gengtype
${_MKTARGET_CREATE}
rm -f auto-host.h rm -f auto-host.h
ln -s ${.CURDIR}/../arch/${MACHINE_ARCH}/auto-host.h . ln -s ${.CURDIR}/../arch/${MACHINE_ARCH}/auto-host.h .
./gengtype ./gengtype
gengtype.o: gengtype.c gtyp-gen.h $(HH) gengtype.lo gengtype-lex.lo gengtype-yacc.lo: ${HH} gtyp-gen.h config.h
${HOST_COMPILE.c} $< gengtype: gengtype.lo gengtype-lex.lo gengtype-yacc.lo
gengtype-lex.o: gengtype-lex.c $(HH) ${_MKTARGET_LINK}
${HOST_COMPILE.c} $< ${HOST_LINK.c} -o ${.TARGET} ${.ALLSRC} ${NBCOMPATLIB} ${HOSTLIBIBERTY}
gengtype-yacc.o: gengtype-yacc.c $(HH)
${HOST_COMPILE.c} $<
gengtype: gengtype.o gtyp-gen.h gengtype-lex.o gengtype-yacc.o config.h
${HOST_LINK.c} -o $@ gengtype.o gengtype-lex.o gengtype-yacc.o ${NBCOMPATLIB} ${HOSTLIBIBERTY}
gtyp-gen.h: Makefile gtyp-gen.h: Makefile
( echo "static const char *srcdir = \"$(G_GTFILES_SRCDIR)\";" ; \ ${_MKTARGET_CREATE}
echo "static const char *lang_files[] = {" ; \ (\
for f in $(G_GTFILES_FILES_FILES); do echo "\"$$f\", "; done ; \ echo "static const char *srcdir = \"$(G_GTFILES_SRCDIR)\";" ; \
echo "NULL };" ; \ echo "static const char *lang_files[] = {" ; \
echo "static const char *langs_for_lang_files[] = {" ; \ for f in $(G_GTFILES_FILES_FILES); do echo "\"$$f\", "; done ; \
for f in $(G_GTFILES_FILES_LANGS); do echo "\"$$f\", "; done ; \ echo "NULL };" ; \
echo "NULL };" ; \ echo "static const char *langs_for_lang_files[] = {" ; \
echo "static const char *all_files[] = {" ; \ for f in $(G_GTFILES_FILES_LANGS); do echo "\"$$f\", "; done ; \
for f in $(G_GTFILES); do echo "\"$$f\", "; done ; \ echo "NULL };" ; \
echo " NULL };" ; \ echo "static const char *all_files[] = {" ; \
echo "static const char *lang_dir_names[] = {" ; \ for f in $(G_GTFILES); do echo "\"$$f\", "; done ; \
echo "\"c\", " ; \ echo " NULL };" ; \
for f in $(G_GTFILES_LANG_DIR_NAMES); do echo "\"$$f\", "; done ; \ echo "static const char *lang_dir_names[] = {" ; \
echo "NULL };" ; \ echo "\"c\", " ; \
) > gtyp-gen.h for f in $(G_GTFILES_LANG_DIR_NAMES); do echo "\"$$f\", "; done ; \
echo "NULL };" ; \
) >${.TARGET}
config.h: Makefile config.h: Makefile
${_MKTARGET_CREATE}
TM_DEFINES="$(G_tm_defines)" \ TM_DEFINES="$(G_tm_defines)" \
HEADERS="$(G_host_xm_file)" XM_DEFINES="$(G_host_xm_defines)" \ HEADERS="$(G_host_xm_file)" XM_DEFINES="$(G_host_xm_defines)" \
TARGET_CPU_DEFAULT="$(G_target_cpu_default)" \ TARGET_CPU_DEFAULT="$(G_target_cpu_default)" \
${HOST_SH} $(GNUHOSTDIST)/gcc/mkconfig.sh config.h ${HOST_SH} ${GNUHOSTDIST}/gcc/mkconfig.sh ${.TARGET}
tm_p.h: Makefile tm_p.h: Makefile
${_MKTARGET_CREATE}
TM_DEFINES="" \ TM_DEFINES="" \
HEADERS="$(G_tm_p_file)" XM_DEFINES="" TARGET_CPU_DEFAULT="" \ HEADERS="$(G_tm_p_file)" XM_DEFINES="" TARGET_CPU_DEFAULT="" \
${HOST_SH} $(GNUHOSTDIST)/gcc/mkconfig.sh tm_p.h ${HOST_SH} ${GNUHOSTDIST}/gcc/mkconfig.sh ${.TARGET}
CLEANFILES+= options.h CLEANFILES+= options.h
options.h: Makefile options.h: Makefile
${_MKTARGET_CREATE}
for f in $(lang_options_files) ""; do \ for f in $(lang_options_files) ""; do \
if [ -n "$$f" ] ; then echo "#include \"$$f\""; fi; \ if [ -n "$$f" ] ; then echo "#include \"$$f\""; fi; \
done | sed 's|$(GNUHOSTDIST)/gcc/||' > options.h done | sed 's|$(GNUHOSTDIST)/gcc/||' >${.TARGET}
# Yuck, we have to run configure to generate this one... # Yuck, we have to run configure to generate this one...
CLEANFILES+= auto-build.h CLEANFILES+= auto-build.h
auto-build.h: Makefile auto-build.h: Makefile
${_MKTARGET_CREATE}
rm -rf .ab && \ rm -rf .ab && \
mkdir .ab && \ mkdir .ab && \
(cd .ab && \ (cd .ab && \
${HOST_SH} $(GNUHOSTDIST)/gcc/configure \ ${HOST_SH} ${GNUHOSTDIST}/gcc/configure \
--build=`${.CURDIR}/../../../dist/gcc/config.guess` \ --build=`${.CURDIR}/../../../dist/gcc/config.guess` \
--host=`${.CURDIR}/../../../dist/gcc/config.guess` \ --host=`${.CURDIR}/../../../dist/gcc/config.guess` \
--target=${MACHINE_GNU_PLATFORM} && \ --target=${MACHINE_GNU_PLATFORM} && \
@ -142,101 +151,107 @@ auto-build.h: Makefile
# These are copies of files we build for the build host that are used # These are copies of files we build for the build host that are used
# by the genfoo programs. # by the genfoo programs.
# #
build-rtl.c: rtl.c \ build-rtl.c: rtl.c \
$(G_RTL_H) real.h $(G_GCC_H) errors.h gtype-desc.h ${G_RTL_H} real.h ${G_GCC_H} errors.h gtype-desc.h
${_MKTARGET_CREATE}
rm -f build-rtl.c rm -f build-rtl.c
sed -e 's/config[.]h/hconfig.h/' ${GNUHOSTDIST}/gcc/rtl.c > build-rtl.c sed -e 's/config[.]h/hconfig.h/' ${GNUHOSTDIST}/gcc/rtl.c >${.TARGET}
build-rtl.o: build-rtl.c $(HH) build-rtl.lo: ${HH}
${HOST_COMPILE.c} -DGENERATOR_FILE build-rtl.c
print-rtl1.c: print-rtl.c \ print-rtl1.c: print-rtl.c \
$(G_RTL_H) $(G_TREE_H) hard-reg-set.h $(G_BASIC_BLOCK_H) ${G_RTL_H} ${G_TREE_H} hard-reg-set.h ${G_BASIC_BLOCK_H}
${_MKTARGET_CREATE}
rm -f print-rtl1.c rm -f print-rtl1.c
sed -e 's/config[.]h/hconfig.h/' ${GNUHOSTDIST}/gcc/print-rtl.c > print-rtl1.c sed -e 's/config[.]h/hconfig.h/' ${GNUHOSTDIST}/gcc/print-rtl.c >${.TARGET}
print-rtl1.o: print-rtl.c $(HH) print-rtl1.lo: ${HH}
${HOST_COMPILE.c} -DGENERATOR_FILE print-rtl1.c
build-bitmap.c: bitmap.c \ build-bitmap.c: bitmap.c \
$(G_RTL_H) flags.h $(G_BASIC_BLOCK_H) $(REGS_H) $(G_GCC_H) gtype-desc.h ${G_RTL_H} flags.h ${G_BASIC_BLOCK_H} ${REGS_H} ${G_GCC_H} gtype-desc.h
${_MKTARGET_CREATE}
rm -f build-bitmap.c rm -f build-bitmap.c
sed -e 's/config[.]h/hconfig.h/' ${GNUHOSTDIST}/gcc/bitmap.c > build-bitmap.c sed -e 's/config[.]h/hconfig.h/' ${GNUHOSTDIST}/gcc/bitmap.c >${.TARGET}
build-bitmap.o: build-bitmap.c $(HH) build-bitmap.lo: ${HH}
${HOST_COMPILE.c} ${COPTS.${.IMPSRC:T}} build-bitmap.c
build-errors.c: errors.c errors.h build-errors.c: errors.c errors.h
${_MKTARGET_CREATE}
rm -f build-errors.c rm -f build-errors.c
sed -e 's/config[.]h/hconfig.h/' ${GNUHOSTDIST}/gcc/errors.c > build-errors.c sed -e 's/config[.]h/hconfig.h/' ${GNUHOSTDIST}/gcc/errors.c >${.TARGET}
build-errors.o: build-errors.c $(HH) build-errors.lo: ${HH}
${HOST_COMPILE.c} -DGENERATOR_FILE build-errors.c
build-varray.c: varray.c \ build-varray.c: varray.c \
$(G_RTL_H) $(G_GCC_H) $(TREE_H) bitmap.h errors.h ${G_RTL_H} ${G_GCC_H} ${TREE_H} bitmap.h errors.h
${_MKTARGET_CREATE}
rm -f build-varray.c rm -f build-varray.c
sed -e 's/config[.]h/hconfig.h/' ${GNUHOSTDIST}/gcc/varray.c > build-varray.c sed -e 's/config[.]h/hconfig.h/' ${GNUHOSTDIST}/gcc/varray.c >${.TARGET}
build-varray.o: build-varray.c $(HH) gtype-desc.h build-varray.lo: ${HH} gtype-desc.h
${HOST_COMPILE.c} ${COPTS.${.IMPSRC:T}} build-varray.c
build-ggc-none.c: ggc-none.c \ build-ggc-none.c: ggc-none.c \
$(G_GCC_H) gtype-desc.h ${G_GCC_H} gtype-desc.h
${_MKTARGET_CREATE}
rm -f build-ggc-none.c rm -f build-ggc-none.c
sed -e 's/config[.]h/hconfig.h/' ${GNUHOSTDIST}/gcc/ggc-none.c > build-ggc-none.c sed -e 's/config[.]h/hconfig.h/' ${GNUHOSTDIST}/gcc/ggc-none.c >${.TARGET}
build-ggc-none.o: build-ggc-none.c $(HH) build-ggc-none.lo: ${HH}
${HOST_COMPILE.c} -DGENERATOR_FILE build-ggc-none.c
# #
# The `early' insn-foo generators # The `early' insn-foo generators
# #
EXTRADEPENDSEARLY= ${G_HOST_EARLY_SUPPORT} ${G_HOST_RTL} ${G_HOST_ERRORS} EXTRADEPENDSEARLY= ${G_HOST_EARLY_SUPPORT:.o=.lo} ${G_HOST_RTL:.o=.lo} \
${G_HOST_ERRORS:.o=.lo}
.for f in conditions.c constants.h .for f in conditions.c constants.h
CLEANFILES+= gen${f:R} insn-${f} CLEANFILES+= gen${f:R} insn-${f}
gen${f:R}.o: gen${f:R}.c $(HH) gen${f:R}.lo: gen${f:R}.c ${HH}
${HOST_COMPILE.c} $< gen${f:R}: gen${f:R}.lo ${EXTRADEPENDSEARLY}
insn-${f:R}.o: ${_MKTARGET_LINK}
${HOST_COMPILE.c} ${COPTS.${.IMPSRC:T}} insn-${f:R}.c ${HOST_LINK.c} -o ${.TARGET} ${.ALLSRC} ${NBCOMPATLIB} ${HOSTLIBIBERTY}
insn-${f}: genrtl.h ${G_md_file} ${EXTRADEPENDSEARLY:.c=.o} gen${f:R}.o insn-${f}: gen${f:R} ${G_md_file}
${HOST_LINK.c} -o gen${f:R} gen${f:R}.o ${EXTRADEPENDSEARLY:.c=.o} ${NBCOMPATLIB} ${HOSTLIBIBERTY} ${_MKTARGET_CREATE}
./gen${f:R} ${G_md_file} >$@ ./gen${f:R} ${G_md_file} >${.TARGET}
.endfor .endfor
# #
# The normal insn-foo generators # The normal insn-foo generators
# #
.for f in gensupport.c read-rtl.c dummy-conditions.c .for f in gensupport.c read-rtl.c dummy-conditions.c
${f:R}.o: ${f:R}.c $(HH) ${f:R}.lo: ${HH}
${HOST_COMPILE.c} $<
.endfor .endfor
EXTRADEPENDS= ${G_HOST_RTL} ${G_HOST_SUPPORT} ${G_HOST_PRINT} ${G_HOST_ERRORS} EXTRADEPENDS= ${G_HOST_RTL:.o=.lo} ${G_HOST_SUPPORT:.o=.lo} \
${G_HOST_PRINT:.o=.lo} ${G_HOST_ERRORS:.o=.lo}
.for f in attr.h codes.h config.h emit.c extract.c flags.h opinit.c output.c \ .for f in attr.h codes.h config.h emit.c extract.c flags.h opinit.c output.c \
peep.c recog.c peep.c recog.c
CLEANFILES+= gen${f:R} insn-${f} CLEANFILES+= gen${f:R} insn-${f}
gen${f:R}.o: gen${f:R}.c $(HH) gen${f:R}.lo: ${HH}
${HOST_COMPILE.c} $< gen${f:R}: gen${f:R}.lo ${EXTRADEPENDS}
insn-${f}: genrtl.h ${G_md_file} ${EXTRADEPENDS:.c=.o} gen${f:R}.o ${_MKTARGET_LINK}
${HOST_LINK.c} -o gen${f:R} gen${f:R}.o ${EXTRADEPENDS:.c=.o} ${NBCOMPATLIB} ${HOSTLIBIBERTY} ${HOST_LINK.c} -o ${.TARGET} ${.ALLSRC} ${NBCOMPATLIB} ${HOSTLIBIBERTY}
./gen${f:R} ${G_md_file} >$@ insn-${f}: gen${f:R} ${G_md_file}
${_MKTARGET_CREATE}
./gen${f:R} ${G_md_file} >${.TARGET}
.endfor .endfor
# #
# "One of these things is not like the other" # "One of these things is not like the other"
# #
CLEANFILES+= genattrtab insn-attrtab.c CLEANFILES+= genattrtab insn-attrtab.c
genattrtab.o: genattrtab.c $(HH) gtype-desc.h genattrtab.lo: ${HH} gtype-desc.h
${HOST_COMPILE.c} $< genautomata.lo: ${HH}
genautomata.o: genautomata.c $(HH) genattrtab: genattrtab.lo genautomata.lo ${EXTRADEPENDS} ${G_HOST_VARRAY:.o=.lo}
${HOST_COMPILE.c} $< ${_MKTARGET_LINK}
insn-attrtab.c: genrtl.h ${G_md_file} ${EXTRADEPENDS:.c=.o} ${G_HOST_VARRAY:.c=.o} genattrtab.o genautomata.o ${HOST_LINK.c} -o ${.TARGET} ${.ALLSRC} ${NBCOMPATLIB} ${HOSTLIBIBERTY} -lm
${HOST_LINK.c} -o genattrtab genattrtab.o genautomata.o ${EXTRADEPENDS:.c=.o} ${G_HOST_VARRAY:.c=.o} ${NBCOMPATLIB} ${HOSTLIBIBERTY} -lm insn-attrtab.c: genattrtab ${G_md_file}
./genattrtab ${G_md_file} >$@ ${_MKTARGET_CREATE}
./genattrtab ${G_md_file} >${.TARGET}
# #
# Required hard-coded dependancies. # Required hard-coded dependancies.
# #
genextract.o: insn-config.h genextract.lo: insn-config.h
insn-conditions.lo: insn-constants.h tm_p.h tm-preds.h
insn-attrtab.o: insn-config.h ${G_HOST_RTLANAL:.o=.c} insn-attrtab.o: insn-config.h ${G_HOST_RTLANAL:.o=.c}
insn-conditions.o: insn-constants.h tm_p.h tm-preds.h
insn-extract.o: insn-config.h insn-extract.o: insn-config.h
toplev.d toplev.o: options.h toplev.d toplev.o: options.h