2006-06-03 00:00:37 +04:00
|
|
|
# $NetBSD: Makefile,v 1.20 2006/06/02 20:00:38 mrg Exp $
|
2003-07-25 20:32:23 +04:00
|
|
|
|
2006-02-25 15:04:23 +03:00
|
|
|
MKPRIVATELIB= yes
|
2003-07-25 20:32:23 +04:00
|
|
|
|
|
|
|
LIB= backend
|
|
|
|
|
|
|
|
SRCS= ${G_OBJS:.o=.c} ${G_out_file:T}
|
|
|
|
|
|
|
|
CPPFLAGS+= -I. -I${GCCARCH} ${G_ALL_CFLAGS:M-D*} ${G_INCLUDES:M-I*:N-I.*} \
|
2003-07-25 21:19:22 +04:00
|
|
|
-DTARGET_NAME=\"${MACHINE_GNU_PLATFORM}\"
|
2003-07-25 20:32:23 +04:00
|
|
|
HOST_CPPFLAGS+= -I. -I${GCCARCH} ${G_ALL_CFLAGS:M-D*} ${G_INCLUDES:M-I*:N-I.*}
|
2003-08-01 21:03:41 +04:00
|
|
|
DPSRCS+= insn-attr.h insn-codes.h insn-config.h insn-flags.h tree-check.h
|
2003-07-25 20:32:23 +04:00
|
|
|
|
|
|
|
.include <bsd.lib.mk>
|
|
|
|
|
2003-10-16 07:33:28 +04:00
|
|
|
# Don't auto-frob .y or .l files.
|
|
|
|
.l.c .y.c .y.h:
|
|
|
|
@true
|
|
|
|
|
2003-07-25 20:32:23 +04:00
|
|
|
#
|
|
|
|
# Independent generation programs.
|
|
|
|
#
|
2003-11-16 19:24:48 +03:00
|
|
|
CLEANFILES+= gengenrtl genrtl.c genrtl.h \
|
2003-07-25 20:32:23 +04:00
|
|
|
gengtype gtyp-gen.h gtype-desc.c gtype-desc.h \
|
|
|
|
gtype-c.h gtype-cp.h gtype-f.h gtype-objc.h \
|
|
|
|
genflags genflags.h \
|
|
|
|
gencheck tree-check.h \
|
|
|
|
genpreds tm-preds.h tm_p.h cs-tm_p.h \
|
|
|
|
auto-host.h print-rtl1.c \
|
2003-11-16 19:24:48 +03:00
|
|
|
build-rtl.c build-errors.c build-varray.c \
|
|
|
|
build-bitmap.c build-ggc-none.c \
|
|
|
|
gt-*.h *.o *.lo \
|
2003-07-25 20:32:23 +04:00
|
|
|
config.h cs-config.h \
|
|
|
|
|
|
|
|
#
|
|
|
|
# These files have special needs
|
|
|
|
#
|
2003-11-16 19:24:48 +03:00
|
|
|
CPPFLAGS.build-errors.c= -DGENERATOR_FILE
|
|
|
|
CPPFLAGS.build-ggc-none.c= -DGENERATOR_FILE
|
|
|
|
CPPFLAGS.build-rtl.c= -DGENERATOR_FILE
|
|
|
|
CPPFLAGS.insn-conditions.c= -DGENERATOR_FILE
|
|
|
|
CPPFLAGS.print-rtl1.c= -DGENERATOR_FILE
|
2003-07-25 20:32:23 +04:00
|
|
|
|
2003-11-05 03:05:48 +03:00
|
|
|
# XXX
|
2006-05-08 18:42:22 +04:00
|
|
|
.if ${MACHINE_ARCH} == "m68000"
|
2003-11-05 03:05:48 +03:00
|
|
|
COPTS.ra-colorize.c= -O0
|
|
|
|
.endif
|
|
|
|
|
2003-12-07 22:56:59 +03:00
|
|
|
# XXX
|
|
|
|
.if ${MACHINE_CPU} == "sh5"
|
|
|
|
NOGCCERROR= # defined
|
|
|
|
COPTS.reload1.c= -O1
|
|
|
|
.endif
|
|
|
|
|
2004-02-22 04:24:25 +03:00
|
|
|
|
|
|
|
|
2003-08-11 11:34:03 +04:00
|
|
|
# Headers that host objects depend on (except gen*rtl*)
|
2003-08-22 07:06:32 +04:00
|
|
|
HH= ${G_HCONFIG_H} genrtl.h
|
2003-08-11 11:34:03 +04:00
|
|
|
|
2003-07-25 20:32:23 +04:00
|
|
|
#
|
|
|
|
# Generate the various header files we need.
|
|
|
|
#
|
2003-08-22 07:06:32 +04:00
|
|
|
genrtl.c: gengenrtl
|
2003-11-16 19:24:48 +03:00
|
|
|
${_MKTARGET_CREATE}
|
|
|
|
./gengenrtl >${.TARGET}
|
2003-08-22 07:06:32 +04:00
|
|
|
genrtl.h: gengenrtl
|
2003-11-16 19:24:48 +03:00
|
|
|
${_MKTARGET_CREATE}
|
|
|
|
./gengenrtl -h >${.TARGET}
|
2006-06-03 00:00:37 +04:00
|
|
|
gengenrtl.lo: ${G_HCONFIG_H} auto-build.h
|
2003-11-16 19:24:48 +03:00
|
|
|
gengenrtl: gengenrtl.lo
|
|
|
|
${_MKTARGET_LINK}
|
|
|
|
${HOST_LINK.c} -o ${.TARGET} ${.ALLSRC} ${NBCOMPATLIB} ${HOSTLIBIBERTY}
|
2003-07-25 20:32:23 +04:00
|
|
|
|
|
|
|
tm-preds.h: genpreds
|
2003-11-16 19:24:48 +03:00
|
|
|
${_MKTARGET_CREATE}
|
|
|
|
./genpreds >${.TARGET}
|
|
|
|
genpreds.lo: ${HH}
|
|
|
|
genpreds: genpreds.lo
|
|
|
|
${_MKTARGET_LINK}
|
|
|
|
${HOST_LINK.c} -o ${.TARGET} ${.ALLSRC} ${NBCOMPATLIB} ${HOSTLIBIBERTY}
|
2003-07-25 20:32:23 +04:00
|
|
|
|
2003-08-11 11:34:03 +04:00
|
|
|
tree-check.h: gencheck
|
2003-11-16 19:24:48 +03:00
|
|
|
${_MKTARGET_CREATE}
|
|
|
|
./gencheck >${.TARGET}
|
|
|
|
gencheck.lo: ${HH}
|
|
|
|
gencheck: gencheck.lo
|
|
|
|
${_MKTARGET_LINK}
|
|
|
|
${HOST_LINK.c} -o ${.TARGET} ${.ALLSRC} ${NBCOMPATLIB} ${HOSTLIBIBERTY}
|
2003-07-25 20:32:23 +04:00
|
|
|
|
|
|
|
gtype-desc.c: gtype-desc.h
|
|
|
|
gtype-desc.h: gengtype
|
2003-11-16 19:24:48 +03:00
|
|
|
${_MKTARGET_CREATE}
|
2003-07-25 20:32:23 +04:00
|
|
|
rm -f auto-host.h
|
|
|
|
ln -s ${.CURDIR}/../arch/${MACHINE_ARCH}/auto-host.h .
|
|
|
|
./gengtype
|
2003-11-16 19:24:48 +03:00
|
|
|
gengtype.lo gengtype-lex.lo gengtype-yacc.lo: ${HH} gtyp-gen.h config.h
|
|
|
|
gengtype: gengtype.lo gengtype-lex.lo gengtype-yacc.lo
|
|
|
|
${_MKTARGET_LINK}
|
|
|
|
${HOST_LINK.c} -o ${.TARGET} ${.ALLSRC} ${NBCOMPATLIB} ${HOSTLIBIBERTY}
|
2003-07-25 20:32:23 +04:00
|
|
|
|
|
|
|
gtyp-gen.h: Makefile
|
2003-11-16 19:24:48 +03:00
|
|
|
${_MKTARGET_CREATE}
|
|
|
|
(\
|
|
|
|
echo "static const char *srcdir = \"$(G_GTFILES_SRCDIR)\";" ; \
|
|
|
|
echo "static const char *lang_files[] = {" ; \
|
|
|
|
for f in $(G_GTFILES_FILES_FILES); do echo "\"$$f\", "; done ; \
|
|
|
|
echo "NULL };" ; \
|
|
|
|
echo "static const char *langs_for_lang_files[] = {" ; \
|
|
|
|
for f in $(G_GTFILES_FILES_LANGS); do echo "\"$$f\", "; done ; \
|
|
|
|
echo "NULL };" ; \
|
|
|
|
echo "static const char *all_files[] = {" ; \
|
|
|
|
for f in $(G_GTFILES); do echo "\"$$f\", "; done ; \
|
|
|
|
echo " NULL };" ; \
|
|
|
|
echo "static const char *lang_dir_names[] = {" ; \
|
|
|
|
echo "\"c\", " ; \
|
|
|
|
for f in $(G_GTFILES_LANG_DIR_NAMES); do echo "\"$$f\", "; done ; \
|
|
|
|
echo "NULL };" ; \
|
|
|
|
) >${.TARGET}
|
2003-07-25 20:32:23 +04:00
|
|
|
|
2003-08-11 11:34:03 +04:00
|
|
|
config.h: Makefile
|
2003-11-16 19:24:48 +03:00
|
|
|
${_MKTARGET_CREATE}
|
2003-07-25 20:32:23 +04:00
|
|
|
TM_DEFINES="$(G_tm_defines)" \
|
|
|
|
HEADERS="$(G_host_xm_file)" XM_DEFINES="$(G_host_xm_defines)" \
|
|
|
|
TARGET_CPU_DEFAULT="$(G_target_cpu_default)" \
|
2003-11-16 19:24:48 +03:00
|
|
|
${HOST_SH} ${GNUHOSTDIST}/gcc/mkconfig.sh ${.TARGET}
|
2003-07-25 20:32:23 +04:00
|
|
|
|
2003-08-11 11:34:03 +04:00
|
|
|
tm_p.h: Makefile
|
2003-11-16 19:24:48 +03:00
|
|
|
${_MKTARGET_CREATE}
|
2003-07-25 20:32:23 +04:00
|
|
|
TM_DEFINES="" \
|
|
|
|
HEADERS="$(G_tm_p_file)" XM_DEFINES="" TARGET_CPU_DEFAULT="" \
|
2003-11-16 19:24:48 +03:00
|
|
|
${HOST_SH} ${GNUHOSTDIST}/gcc/mkconfig.sh ${.TARGET}
|
2003-07-25 20:32:23 +04:00
|
|
|
|
2003-08-22 07:06:32 +04:00
|
|
|
CLEANFILES+= options.h
|
2003-07-25 20:32:23 +04:00
|
|
|
options.h: Makefile
|
2003-11-16 19:24:48 +03:00
|
|
|
${_MKTARGET_CREATE}
|
2003-10-25 06:42:00 +04:00
|
|
|
for f in $(lang_options_files) ""; do \
|
|
|
|
if [ -n "$$f" ] ; then echo "#include \"$$f\""; fi; \
|
2003-11-16 19:24:48 +03:00
|
|
|
done | sed 's|$(GNUHOSTDIST)/gcc/||' >${.TARGET}
|
2003-07-25 20:32:23 +04:00
|
|
|
|
2003-08-11 11:34:03 +04:00
|
|
|
|
|
|
|
# Yuck, we have to run configure to generate this one...
|
|
|
|
CLEANFILES+= auto-build.h
|
|
|
|
auto-build.h: Makefile
|
2003-11-16 19:24:48 +03:00
|
|
|
${_MKTARGET_CREATE}
|
2003-08-11 11:34:03 +04:00
|
|
|
rm -rf .ab && \
|
|
|
|
mkdir .ab && \
|
|
|
|
(cd .ab && \
|
2005-02-11 17:58:41 +03:00
|
|
|
CC=${HOST_CC} ${HOST_SH} ${GNUHOSTDIST}/gcc/configure \
|
2004-06-12 18:57:57 +04:00
|
|
|
--build=`${HOST_SH} ${.CURDIR}/../../../dist/gcc/config.guess` \
|
|
|
|
--host=`${HOST_SH} ${.CURDIR}/../../../dist/gcc/config.guess` \
|
2003-08-11 11:34:03 +04:00
|
|
|
--target=${MACHINE_GNU_PLATFORM} && \
|
|
|
|
mv auto-host.h ../auto-build.h) && \
|
|
|
|
rm -rf .ab
|
|
|
|
|
2003-07-25 20:32:23 +04:00
|
|
|
#
|
|
|
|
# These are copies of files we build for the build host that are used
|
|
|
|
# by the genfoo programs.
|
|
|
|
#
|
2003-11-16 19:24:48 +03:00
|
|
|
|
2003-07-25 20:32:23 +04:00
|
|
|
build-rtl.c: rtl.c \
|
2003-11-16 19:24:48 +03:00
|
|
|
${G_RTL_H} real.h ${G_GCC_H} errors.h gtype-desc.h
|
|
|
|
${_MKTARGET_CREATE}
|
2003-07-25 20:32:23 +04:00
|
|
|
rm -f build-rtl.c
|
2003-11-16 19:24:48 +03:00
|
|
|
sed -e 's/config[.]h/hconfig.h/' ${GNUHOSTDIST}/gcc/rtl.c >${.TARGET}
|
|
|
|
build-rtl.lo: ${HH}
|
2003-07-25 20:32:23 +04:00
|
|
|
|
|
|
|
print-rtl1.c: print-rtl.c \
|
2003-11-16 19:24:48 +03:00
|
|
|
${G_RTL_H} ${G_TREE_H} hard-reg-set.h ${G_BASIC_BLOCK_H}
|
|
|
|
${_MKTARGET_CREATE}
|
2003-07-25 20:32:23 +04:00
|
|
|
rm -f print-rtl1.c
|
2003-11-16 19:24:48 +03:00
|
|
|
sed -e 's/config[.]h/hconfig.h/' ${GNUHOSTDIST}/gcc/print-rtl.c >${.TARGET}
|
|
|
|
print-rtl1.lo: ${HH}
|
2003-07-25 20:32:23 +04:00
|
|
|
|
|
|
|
build-bitmap.c: bitmap.c \
|
2003-11-16 19:24:48 +03:00
|
|
|
${G_RTL_H} flags.h ${G_BASIC_BLOCK_H} ${REGS_H} ${G_GCC_H} gtype-desc.h
|
|
|
|
${_MKTARGET_CREATE}
|
2003-07-25 20:32:23 +04:00
|
|
|
rm -f build-bitmap.c
|
2003-11-16 19:24:48 +03:00
|
|
|
sed -e 's/config[.]h/hconfig.h/' ${GNUHOSTDIST}/gcc/bitmap.c >${.TARGET}
|
|
|
|
build-bitmap.lo: ${HH}
|
2003-07-25 20:32:23 +04:00
|
|
|
|
|
|
|
build-errors.c: errors.c errors.h
|
2003-11-16 19:24:48 +03:00
|
|
|
${_MKTARGET_CREATE}
|
2003-07-25 20:32:23 +04:00
|
|
|
rm -f build-errors.c
|
2003-11-16 19:24:48 +03:00
|
|
|
sed -e 's/config[.]h/hconfig.h/' ${GNUHOSTDIST}/gcc/errors.c >${.TARGET}
|
|
|
|
build-errors.lo: ${HH}
|
2003-07-25 20:32:23 +04:00
|
|
|
|
|
|
|
build-varray.c: varray.c \
|
2003-11-16 19:24:48 +03:00
|
|
|
${G_RTL_H} ${G_GCC_H} ${TREE_H} bitmap.h errors.h
|
|
|
|
${_MKTARGET_CREATE}
|
2003-07-25 20:32:23 +04:00
|
|
|
rm -f build-varray.c
|
2003-11-16 19:24:48 +03:00
|
|
|
sed -e 's/config[.]h/hconfig.h/' ${GNUHOSTDIST}/gcc/varray.c >${.TARGET}
|
|
|
|
build-varray.lo: ${HH} gtype-desc.h
|
2003-07-25 20:32:23 +04:00
|
|
|
|
|
|
|
build-ggc-none.c: ggc-none.c \
|
2003-11-16 19:24:48 +03:00
|
|
|
${G_GCC_H} gtype-desc.h
|
|
|
|
${_MKTARGET_CREATE}
|
2003-07-25 20:32:23 +04:00
|
|
|
rm -f build-ggc-none.c
|
2003-11-16 19:24:48 +03:00
|
|
|
sed -e 's/config[.]h/hconfig.h/' ${GNUHOSTDIST}/gcc/ggc-none.c >${.TARGET}
|
|
|
|
build-ggc-none.lo: ${HH}
|
2003-07-25 20:32:23 +04:00
|
|
|
|
|
|
|
#
|
|
|
|
# The `early' insn-foo generators
|
|
|
|
#
|
2003-11-16 19:24:48 +03:00
|
|
|
EXTRADEPENDSEARLY= ${G_HOST_EARLY_SUPPORT:.o=.lo} ${G_HOST_RTL:.o=.lo} \
|
|
|
|
${G_HOST_ERRORS:.o=.lo}
|
2003-07-25 20:32:23 +04:00
|
|
|
.for f in conditions.c constants.h
|
|
|
|
CLEANFILES+= gen${f:R} insn-${f}
|
|
|
|
|
2003-11-16 19:24:48 +03:00
|
|
|
gen${f:R}.lo: gen${f:R}.c ${HH}
|
|
|
|
gen${f:R}: gen${f:R}.lo ${EXTRADEPENDSEARLY}
|
|
|
|
${_MKTARGET_LINK}
|
|
|
|
${HOST_LINK.c} -o ${.TARGET} ${.ALLSRC} ${NBCOMPATLIB} ${HOSTLIBIBERTY}
|
|
|
|
insn-${f}: gen${f:R} ${G_md_file}
|
|
|
|
${_MKTARGET_CREATE}
|
|
|
|
./gen${f:R} ${G_md_file} >${.TARGET}
|
2003-07-25 20:32:23 +04:00
|
|
|
.endfor
|
|
|
|
|
|
|
|
#
|
|
|
|
# The normal insn-foo generators
|
|
|
|
#
|
2003-07-26 19:02:52 +04:00
|
|
|
.for f in gensupport.c read-rtl.c dummy-conditions.c
|
2003-11-16 19:24:48 +03:00
|
|
|
${f:R}.lo: ${HH}
|
2003-07-25 20:32:23 +04:00
|
|
|
.endfor
|
|
|
|
|
2003-11-16 19:24:48 +03:00
|
|
|
EXTRADEPENDS= ${G_HOST_RTL:.o=.lo} ${G_HOST_SUPPORT:.o=.lo} \
|
|
|
|
${G_HOST_PRINT:.o=.lo} ${G_HOST_ERRORS:.o=.lo}
|
2003-07-25 20:32:23 +04:00
|
|
|
.for f in attr.h codes.h config.h emit.c extract.c flags.h opinit.c output.c \
|
|
|
|
peep.c recog.c
|
|
|
|
CLEANFILES+= gen${f:R} insn-${f}
|
|
|
|
|
2003-11-16 19:24:48 +03:00
|
|
|
gen${f:R}.lo: ${HH}
|
|
|
|
gen${f:R}: gen${f:R}.lo ${EXTRADEPENDS}
|
|
|
|
${_MKTARGET_LINK}
|
|
|
|
${HOST_LINK.c} -o ${.TARGET} ${.ALLSRC} ${NBCOMPATLIB} ${HOSTLIBIBERTY}
|
|
|
|
insn-${f}: gen${f:R} ${G_md_file}
|
|
|
|
${_MKTARGET_CREATE}
|
|
|
|
./gen${f:R} ${G_md_file} >${.TARGET}
|
2003-07-25 20:32:23 +04:00
|
|
|
.endfor
|
|
|
|
|
|
|
|
#
|
|
|
|
# "One of these things is not like the other"
|
|
|
|
#
|
|
|
|
CLEANFILES+= genattrtab insn-attrtab.c
|
2003-11-16 19:24:48 +03:00
|
|
|
genattrtab.lo: ${HH} gtype-desc.h
|
|
|
|
genautomata.lo: ${HH}
|
|
|
|
genattrtab: genattrtab.lo genautomata.lo ${EXTRADEPENDS} ${G_HOST_VARRAY:.o=.lo}
|
|
|
|
${_MKTARGET_LINK}
|
|
|
|
${HOST_LINK.c} -o ${.TARGET} ${.ALLSRC} ${NBCOMPATLIB} ${HOSTLIBIBERTY} -lm
|
|
|
|
insn-attrtab.c: genattrtab ${G_md_file}
|
|
|
|
${_MKTARGET_CREATE}
|
|
|
|
./genattrtab ${G_md_file} >${.TARGET}
|
2003-07-25 20:32:23 +04:00
|
|
|
|
|
|
|
#
|
|
|
|
# Required hard-coded dependancies.
|
|
|
|
#
|
2003-11-16 19:24:48 +03:00
|
|
|
genextract.lo: insn-config.h
|
|
|
|
insn-conditions.lo: insn-constants.h tm_p.h tm-preds.h
|
|
|
|
|
2003-08-22 07:06:32 +04:00
|
|
|
insn-attrtab.o: insn-config.h ${G_HOST_RTLANAL:.o=.c}
|
|
|
|
insn-extract.o: insn-config.h
|
|
|
|
toplev.d toplev.o: options.h
|
2003-07-25 20:32:23 +04:00
|
|
|
|
2003-08-22 07:06:32 +04:00
|
|
|
.PATH: ${DIST}/gcc ${DIST}/libiberty ${GCCARCH} ${G_out_file:H}
|