Home | History | Annotate | Line # | Download | only in backend
Makefile revision 1.18
      1 #	$NetBSD: Makefile,v 1.18 2023/06/03 21:31:46 lukem Exp $
      2 
      3 HOSTPROG_CXX=	1
      4 LIBISPRIVATE=	yes
      5 
      6 # For ../Makefile.inc and bsd.own.mk
      7 .include <bsd.init.mk>
      8 
      9 LIB=		backend
     10 
     11 SRCS=		${G_OBJS:S,analyzer/,,} ${G_out_file:T} regsub.c
     12 
     13 # XXX: something misses these.
     14 CLEANDIRFILES+=	${G_OBJS:.o=.d}
     15 
     16 # Make sure we use the pre-generated C files
     17 .l.c:
     18 	@true
     19 
     20 BOTH_CPPFLAGS+=	-I. -I${GCCARCH} ${G_ALL_CFLAGS:M-D*} ${G_INCLUDES:M-I*:N-I.*}
     21 CPPFLAGS+=	${BOTH_CPPFLAGS} -DTARGET_NAME=\"${MACHINE_GNU_PLATFORM}\"
     22 HOST_CPPFLAGS+=	-I${HOST_LIBIBERTYOBJ}/libiberty
     23 HOST_CPPFLAGS+=	${BOTH_CPPFLAGS} -DGENERATOR_FILE
     24 DPSRCS+=	insn-attr.h insn-codes.h insn-config.h insn-flags.h tree-check.h
     25 DPSRCS+=	${DIST}/gcc/BASE-VER
     26 CPPFLAGS+=	-I${DIST}/libgcc
     27 CPPFLAGS+=	-I${.CURDIR}/../../lib/libgcc/libgcov/arch/${MACHINE_ARCH}
     28 
     29 CPPFLAGS.cppdefault.c+=	-DPREFIX=\"/usr\" \
     30 			-DNATIVE_SYSTEM_HEADER_DIR=\"${G_NATIVE_SYSTEM_HEADER_DIR}\"
     31 CPPFLAGS.lto-streamer-in.c+=	-DTARGET_MACHINE=\"${MACHINE_GNU_PLATFORM}\"
     32 
     33 HOST_CXXFLAGS+=	-std=gnu++98
     34 
     35 HOST_LIBIBERTYOBJ!=	cd ${.CURDIR}/../host-libiberty && ${PRINTOBJDIR}
     36 
     37 .include <bsd.lib.mk>
     38 
     39 # Force using C++ for this
     40 ORIGHOST_CC:=	${HOST_CC}
     41 HOST_CC:=	${HOST_CXX}
     42 CC:=		${CXX}
     43 CFLAGS:=	${CXXFLAGS}
     44 
     45 # Check PREPROCESSOR_DEFINES for cppbuiltin.c and cppdefault.c
     46 CPPFLAGS.cppbuiltin.c+=	-DBASEVER="\"${BASEVER}"\"
     47 
     48 #
     49 # Independent generation programs.
     50 #
     51 CLEANFILES+=	gengenrtl genrtl.h \
     52 		gengtype gtyp-gen.h gtype-brig.h gtype-desc.c gtype-desc.h \
     53 		gtype-c.h gtype-cp.h gtype-f.h gtype-objc.h \
     54 		genflags genflags.h \
     55 		gencheck tree-check.h \
     56 		insn-preds.c genpreds tm-preds.h tm_p.h cs-tm_p.h \
     57 		auto-host.h \
     58 		gt-*.h *.o *.lo \
     59 		cs-config.h \
     60 		gcov-iov gcov-iov.h \
     61 		gtype-go.h gtype.state \
     62 		pass-instances.def
     63 
     64 # XXX
     65 COPTS.varasm.c=			-Wno-error
     66 
     67 # XXX Override the normal rule to use HOST_COMPILE.cc
     68 .c.lo:
     69 	${_MKTARGET_COMPILE}
     70 	${HOST_COMPILE.cc} -o ${.TARGET}.o ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC}
     71 	mv ${.TARGET}.o ${.TARGET}
     72 
     73 # Headers that host objects depend on (except gen*rtl*)
     74 HH_NORTL=	${G_tm_file_list} ${G_build_xm_include_list}
     75 HH=		${HH_NORTL} genrtl.h insn-modes.h insn-modes-inline.h \
     76 		gensupport.h read-md.h optabs.def
     77 
     78 #
     79 # Generate the various header files we need.
     80 #
     81 genrtl.h: gengenrtl
     82 	${_MKTARGET_CREATE}
     83 	./gengenrtl >${.TARGET}
     84 gengenrtl.lo: ${HH_NORTL}
     85 gengenrtl: gengenrtl.lo build-errors.lo
     86 	${_MKTARGET_LINK}
     87 	${HOST_LINK.cc} -o ${.TARGET} ${.ALLSRC} ${NBCOMPATLIB} ${HOSTLIBIBERTY}
     88 
     89 insn-preds.c: genpreds ${G_md_file}
     90 	${_MKTARGET_CREATE}
     91 	./genpreds ${G_md_file} >${.TARGET}
     92 tm-preds.h: genpreds ${G_md_file}
     93 	${_MKTARGET_CREATE}
     94 	./genpreds -h ${G_md_file} >${.TARGET}
     95 tm-constrs.h: genpreds ${G_md_file}
     96 	${_MKTARGET_CREATE}
     97 	./genpreds -c ${G_md_file} >${.TARGET}
     98 
     99 # be nice to generate this entirely; but difficult.
    100 gtyp-input.list.tmp: ${GCCARCH}/gtyp-input.list
    101 	sed s#SRCDIR#${DIST}# < ${.ALLSRC} > ${.TARGET}
    102 CLEANFILES+=	gtyp-input.list.tmp
    103 
    104 # XXX
    105 CLEANFILES+=	gtype-lto.h gtype-objcp.h tm-constrs.h gtype-jit.h
    106 
    107 gtype-desc.c: gtype-desc.h
    108 gtype-desc.h: gengtype gtyp-input.list.tmp
    109 	${_MKTARGET_CREATE}
    110 	rm -f auto-host.h
    111 	ln -s ${.CURDIR}/../gcc/arch/${GCC_MACHINE_ARCH}/auto-host.h .
    112 	if [ -f ${.CURDIR}/../gcc/arch/${GCC_MACHINE_ARCH}/sysroot-suffix.h ]; then \
    113 	  rm -f sysroot-suffix.h; \
    114 	  ln -s ${.CURDIR}/../gcc/arch/${GCC_MACHINE_ARCH}/sysroot-suffix.h ; \
    115 	fi
    116 	./gengtype -S ${DIST}/gcc -I gtyp-input.list.tmp -w gtype.state
    117 	./gengtype -r gtype.state
    118 	# GCC 4.8 installs gtype-state and gengtype as a plugin
    119 
    120 # gengtype is the real need for options.h
    121 gengtype.lo gengtype-lex.lo gengtype-parse.lo gengtype-state.lo version.lo: ${HH} gtyp-gen.h config.h options.h
    122 gengtype: gengtype.lo gengtype-lex.lo gengtype-parse.lo gengtype-state.lo build-errors.lo version.lo
    123 	${_MKTARGET_LINK}
    124 	${HOST_LINK.cc} -o ${.TARGET} ${.ALLSRC} ${NBCOMPATLIB} ${HOSTLIBIBERTY}
    125 
    126 # XXX fix this by properly marking all the files that should
    127 # XXX be built with -DGENERATOR_FILE
    128 COPTS.gengtype-lex.c=	-UGENERATOR_FILE -DHOST_GENERATOR_FILE
    129 COPTS.gengtype-parse.c=	-UGENERATOR_FILE -DHOST_GENERATOR_FILE
    130 COPTS.gengtype-state.c=	-UGENERATOR_FILE -DHOST_GENERATOR_FILE
    131 COPTS.gengtype.c=	-UGENERATOR_FILE -DHOST_GENERATOR_FILE
    132 
    133 gtyp-gen.h: Makefile
    134 	${_MKTARGET_CREATE}
    135 	(\
    136 	unset empty							; \
    137 	echo "static const char *srcdir = \"$(G_GTFILES_SRCDIR)\";"	; \
    138 	echo "static const char *lang_files[] = {"			; \
    139 	for f in $$empty $(G_GTFILES_FILES_FILES); do echo "\"$$f\", "; done ; \
    140 	echo "NULL };"							; \
    141 	echo "static const char *langs_for_lang_files[] = {"		; \
    142 	for f in $$empty $(G_GTFILES_FILES_LANGS); do echo "\"$$f\", "; done ; \
    143 	echo "NULL };"							; \
    144 	echo "static const char *all_files[] = {"			; \
    145 	for f in $$empty $(G_GTFILES); do echo "\"$$f\", "; done	; \
    146 	echo " NULL };"							; \
    147 	echo "static const char *lang_dir_names[] = {"			; \
    148 	for f in c $(G_GTFILES_LANG_DIR_NAMES); do echo "\"$$f\", "; done ; \
    149 	echo "NULL };"							; \
    150 	) >${.TARGET}
    151 
    152 insn-modes.c: genmodes
    153 	${_MKTARGET_CREATE}
    154 	./genmodes >${.TARGET}
    155 insn-modes.h-test: genmodes
    156 	${_MKTARGET_CREATE}
    157 	./genmodes -h >${.TARGET}
    158 	# Ensure that the checked in version matches
    159 	if ! cmp ${.TARGET} ${.CURDIR}/../gcc/arch/${MACHINE_ARCH}/insn-modes.h; then
    160 		echo "Checked in insn-modes.h does not match; rerun mknative-gcc." 1>&2
    161 		false
    162 	fi
    163 min-insn-modes.c: genmodes
    164 	${_MKTARGET_CREATE}
    165 	./genmodes -m >${.TARGET}
    166 insn-modes-inline.h: genmodes
    167 	${_MKTARGET_CREATE}
    168 	./genmodes -i >${.TARGET}
    169 genmodes.lo: ${HH_NORTL}
    170 genmodes: genmodes.lo build-errors.lo
    171 	${_MKTARGET_LINK}
    172 	${HOST_LINK.cc} -o ${.TARGET} ${.ALLSRC} ${NBCOMPATLIB} ${HOSTLIBIBERTY}
    173 
    174 CLEANFILES+=	genmodes insn-modes.c insn-modes.h-test min-insn-modes.c insn-modes-inline.h
    175 
    176 gimple-match.c: genmatch cfn-operators.pd
    177 	./genmatch --gimple ${GNUHOSTDIST}/gcc/match.pd > gimple-match.c.tmp
    178 	mv gimple-match.c.tmp gimple-match.c
    179 generic-match.c: genmatch cfn-operators.pd
    180 	./genmatch --generic ${GNUHOSTDIST}/gcc/match.pd > generic-match.c.tmp
    181 	mv generic-match.c.tmp generic-match.c
    182 genmatch.lo: ${HH_NORTL} ${G_GGC_H} case-cfn-macros.h
    183 genmatch: genmatch.lo build-errors.lo build-vec.lo build-hash-table.lo build-sort.lo
    184 	${_MKTARGET_LINK}
    185 	${HOST_LINK.cc} -o ${.TARGET} ${.ALLSRC} ${NBCOMPATLIB} ${HOSTLIBCPP} ${HOSTLIBIBERTY}
    186 
    187 CLEANFILES+=	genmatch gimple-match.c generic-match.c
    188 
    189 gcov-iov.h: gcov-iov
    190 	${_MKTARGET_CREATE}
    191 	./gcov-iov "${BASEVER}" "${DEVPHASE}" >${.TARGET}
    192 gcov-iov.lo: ${HH_NORTL}
    193 gcov-iov: gcov-iov.lo
    194 	${_MKTARGET_CREATE}
    195 	${HOST_LINK.cc} -o ${.TARGET} ${.ALLSRC} ${NBCOMPATLIB} ${HOSTLIBIBERTY}
    196 
    197 tm_p.h: Makefile tm-preds.h
    198 	${_MKTARGET_CREATE}
    199 	TARGET_CPU_DEFAULT="" \
    200 	HEADERS="$(G_tm_p_include_list)" DEFINES="" \
    201 	${HOST_SH} ${GNUHOSTDIST}/gcc/mkconfig.sh ${.TARGET}
    202 
    203 # XXX crude
    204 ${G_OBJS} ${G_OBJS:.o=.d}:	tm.h tm_p.h insn-opinit.h
    205 
    206 .include "../Makefile.options"
    207 
    208 # Yuck, we have to run configure to generate this one...
    209 # We use ORIGHOST_CC here because GCC's ./configure expects (and
    210 # depends upon) it.
    211 CLEANFILES+=	auto-build.h
    212 HOST_CFLAGS+= -I${.OBJDIR}
    213 HOST_CXXFLAGS+= -I${.OBJDIR}
    214 
    215 # Set this to "true" to leave .ab around
    216 HOST_AB_CLEAN?=	rm -rf .ab
    217 
    218 auto-build.h: gmp.h Makefile
    219 	${_MKTARGET_CREATE}
    220 	rm -rf .ab && \
    221 	mkdir .ab && \
    222 	(cd .ab && \
    223 		AWK=${TOOL_AWK:Q} \
    224 		CC=${ORIGHOST_CC:Q} CFLAGS=${HOST_CFLAGS:Q} \
    225 		CPPFLAGS=${HOST_CPPFLAGS:Q} \
    226 		CXX=${HOST_CXX:Q} CXXFLAGS=${HOST_CXXFLAGS:Q} \
    227 		MAKE=${TOOL_GMAKE:Q} \
    228 		CONFIG_SHELL=${HOST_SH:Q} \
    229 		gcc_cv_ld=${LD:Q} \
    230 		gcc_cv_as=${AS:Q} \
    231 		${HOST_SH} ${GNUHOSTDIST}/gcc/configure \
    232 			--build=`${HOST_SH} ${GNUHOSTDIST}/config.guess` \
    233 			--host=`${HOST_SH} ${GNUHOSTDIST}/config.guess` \
    234 			--target=${MACHINE_GNU_PLATFORM} && \
    235 		mv auto-host.h ../auto-build.h) && \
    236 	${HOST_AB_CLEAN}
    237 
    238 pass-instances.def: passes.def gen-pass-instances.awk
    239 	${_MKTARGET_CREATE}
    240 	${TOOL_AWK} -f ${GNUHOSTDIST}/gcc/gen-pass-instances.awk \
    241 	  ${GNUHOSTDIST}/gcc/passes.def > pass-instances.def
    242 CLEANFILES+=	pass-instances.def
    243 
    244 #
    245 # These are copies of files we build for the build host that are used
    246 # by the genfoo programs.
    247 #
    248 
    249 build-rtl.c: rtl.c \
    250   ${G_RTL_H} real.h ${G_GCC_H} ${G_RTL_BASE_H} ${G_GGC_H} errors.h
    251 	${_MKTARGET_CREATE}
    252 	rm -f build-rtl.c
    253 	${TOOL_SED} -e 's/<config[.]h/hconfig.h/' \
    254 		${GNUHOSTDIST}/gcc/rtl.c >${.TARGET}
    255 build-rtl.lo: ${HH} insn-constants.h
    256 CLEANFILES+=	build-rtl.c
    257 
    258 build-print-rtl.c: print-rtl.c \
    259   ${G_RTL_BASE_H} ${G_GTM_H} hard-reg-set.h
    260 	${_MKTARGET_CREATE}
    261 	rm -f build-print-rtl.c
    262 	${TOOL_SED} -e 's/<config[.]h/hconfig.h/' \
    263 		${GNUHOSTDIST}/gcc/print-rtl.c >${.TARGET}
    264 build-print-rtl.lo: ${HH}
    265 build-print-rtl.o: print-rtl.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h     \
    266   ${GTM_H} ${G_RTL_BASE_H}
    267 CLEANFILES+=	build-print-rtl.c
    268 
    269 build-bitmap.c: bitmap.c \
    270   ${G_RTL_H} flags.h ${G_BASIC_BLOCK_H} ${REGS_H} ${G_GCC_H} ${G_GGC_H}
    271 	${_MKTARGET_CREATE}
    272 	rm -f build-bitmap.c
    273 	${TOOL_SED} -e 's/<config[.]h/hconfig.h/' \
    274 		${GNUHOSTDIST}/gcc/bitmap.c >${.TARGET}
    275 build-bitmap.lo: ${HH}
    276 CLEANFILES+=	build-bitmap.c
    277 
    278 build-errors.c: errors.c errors.h
    279 	${_MKTARGET_CREATE}
    280 	rm -f build-errors.c
    281 	cat ${GNUHOSTDIST}/gcc/errors.c >${.TARGET}
    282 build-errors.lo: ${HH_NORTL}
    283 CLEANFILES+=	build-errors.c
    284 
    285 build-varray.c: varray.c \
    286   ${G_RTL_H} ${G_GCC_H} ${TREE_H} bitmap.h errors.h
    287 	${_MKTARGET_CREATE}
    288 	rm -f build-varray.c
    289 	${TOOL_SED} -e 's/<config[.]h/hconfig.h/' \
    290 		${GNUHOSTDIST}/gcc/varray.c >${.TARGET}
    291 build-varray.lo: ${HH} gtype-desc.h
    292 CLEANFILES+=	build-varray.c
    293 
    294 build-ggc-none.c: ggc-none.c \
    295   ${G_GCC_H} gtype-desc.h
    296 	${_MKTARGET_CREATE}
    297 	rm -f build-ggc-none.c
    298 	${TOOL_SED} -e 's/<config[.]h/hconfig.h/' \
    299 		${GNUHOSTDIST}/gcc/ggc-none.c >${.TARGET}
    300 build-ggc-none.lo: ${HH}
    301 CLEANFILES+=	build-ggc-none.c
    302 
    303 build-hash-table.c: hash-table.c hash-table.h ${G_HASH_TABLE_H} ${HH}
    304 	${_MKTARGET_CREATE}
    305 	rm -f build-hash-table.c
    306 	cat ${GNUHOSTDIST}/gcc/hash-table.c >${.TARGET}
    307 build-hash-table.lo: ${HH_NORTL}
    308 CLEANFILES+=	build-hash-table.c
    309 
    310 build-vec.c: vec.c vec.h ${G_HASH_TABLE_H} ${HH}
    311 	${_MKTARGET_CREATE}
    312 	rm -f build-vec.c
    313 	cat ${GNUHOSTDIST}/gcc/vec.c >${.TARGET}
    314 build-vec.lo: ${HH_NORTL}
    315 CLEANFILES+=	build-vec.c
    316 
    317 build-sort.cc: sort.cc sort.h ${G_GGC_H}
    318 	${_MKTARGET_CREATE}
    319 	rm -f build-sort.cc
    320 	cat ${GNUHOSTDIST}/gcc/sort.cc >${.TARGET}
    321 build-sort.lo: ${HH_NORTL}
    322 CLEANFILES+=	build-sort.cc
    323 
    324 build-genattrtab.o: ${G_GGC_H}
    325 
    326 #
    327 # The normal insn-foo generators
    328 #
    329 .for f in gensupport.c read-rtl.c dummy-conditions.c read-md.c
    330 ${f:R}.lo: ${HH}
    331 .endfor
    332 
    333 #
    334 # There are 5 main classes of generator programs.  Ones
    335 # that are self contained, ones that use error reporting
    336 # mechanisms, ones that use the MD reader, and ones that
    337 # use the RTL reader.
    338 #
    339 GENPROG_ERROR_DEPENDS=	${G_BUILD_ERRORS:.o=.lo}
    340 GENPROG_READER_DEPENDS=	${G_BUILD_MD:.o=.lo} ${GENPROG_ERROR_DEPENDS}
    341 GENPROG_RTL_DEPENDS=	${G_BUILD_RTL:.o=.lo} ${GENPROG_READER_DEPENDS} ${GENPROG_ERROR_DEPENDS}
    342 
    343 #
    344 # First we generate the rules for the generators.
    345 #
    346 .for f in attr attr-common attrtab automata codes conditions config emit \
    347 	  extract flags opinit output peep preds recog mddump condmd \
    348 	  target-def cfn-macros
    349 gen${f}.lo: ${HH} gen${f}.c ${G_RTL_BASE_H} build-sort.lo
    350 gen${f}: gen${f}.lo ${GENPROG_RTL_DEPENDS} 
    351 	${_MKTARGET_LINK}
    352 	${HOST_LINK.cc} -o ${.TARGET} ${.ALLSRC} ${NBCOMPATLIB} ${HOSTLIBIBERTY} ${LDFLAGS.${.TARGET}} build-sort.lo
    353 CLEANFILES+=	gen${f} gen${f}.lo
    354 .endfor
    355 
    356 .for f in mddeps constants enums
    357 gen${f}.lo: ${HH} gen${f}.c ${G_RTL_BASE_H}
    358 gen${f}: gen${f}.lo ${GENPROG_READER_DEPENDS}
    359 	${_MKTARGET_LINK}
    360 	${HOST_LINK.cc} -o ${.TARGET} ${.ALLSRC} ${NBCOMPATLIB} ${HOSTLIBIBERTY} ${LDFLAGS.${.TARGET}}
    361 CLEANFILES+=	gen${f} gen${f}.lo
    362 .endfor
    363 
    364 .for f in check checksum
    365 gen${f}.lo: ${HH} gen${f}.c ${G_RTL_BASE_H}
    366 gen${f}: gen${f}.lo
    367 	${_MKTARGET_LINK}
    368 	${HOST_LINK.cc} -o ${.TARGET} ${.ALLSRC} ${NBCOMPATLIB} ${HOSTLIBIBERTY} ${LDFLAGS.${.TARGET}}
    369 CLEANFILES+=	gen${f} gen${f}.lo
    370 .endfor
    371 
    372 .include "../../Makefile.hooks"
    373 
    374 #
    375 # Second we generate the rules for the generated files.  There
    376 # are 3 main classes:  RTL based or not, plus special cases.
    377 #
    378 # The special cases are:  gencheck, genattrtab, genopinit,
    379 # gencondmd
    380 #
    381 
    382 # RTL based files
    383 .for f in attr.h attr-common.h codes.h config.h flags.h \
    384 	  automata.c emit.c extract.c output.c peep.c recog.c \
    385 	  target-def.h
    386 insn-${f}: gen${f:R} ${G_md_file} insn-conditions.md
    387 	${_MKTARGET_CREATE}
    388 	./gen${f:R} ${G_md_file} insn-conditions.md >${.TARGET}
    389 CLEANFILES+=	insn-${f}
    390 .endfor
    391 
    392 # normal files
    393 .for f in constants.h enums.c
    394 insn-${f}: gen${f:R} ${G_md_file}
    395 	${_MKTARGET_CREATE}
    396 	./gen${f:R} ${G_md_file} >${.TARGET}
    397 CLEANFILES+=	insn-${f}
    398 .endfor
    399 
    400 # genconditions outputs gencondmd.c
    401 gencondmd.c: genconditions ${G_md_file}
    402 	${_MKTARGET_CREATE}
    403 	./genconditions ${G_md_file} >${.TARGET}
    404 CLEANFILES+=	gencondmd.c
    405 
    406 # gencheck outputs tree-check.h
    407 tree-check.h: gencheck
    408 	${_MKTARGET_CREATE}
    409 	./gencheck >${.TARGET}
    410 CLEANFILES+=	tree-check.h
    411 
    412 # genattrtab has three output files
    413 insn-dfatab.c insn-latencytab.c: insn-attrtab.c
    414 	cp -p ${.TARGET}.tmp ${.TARGET}
    415 insn-attrtab.c: genattrtab ${G_md_file} insn-conditions.md 
    416 	${_MKTARGET_CREATE}
    417 	./genattrtab ${G_md_file} insn-conditions.md \
    418 		-A${.TARGET}.tmp -Dinsn-dfatab.c.tmp -Linsn-latencytab.c.tmp && \
    419 	mv ${.TARGET}.tmp ${.TARGET}
    420 CLEANFILES+=	insn-attrtab.c insn-dfatab.c insn-latencytab.c \
    421 		insn-dfatab.c.tmp insn-latencytab.c.tmp
    422 
    423 # genopinit has two output files
    424 insn-opinit.h: insn-opinit.c
    425 	cp -p ${.TARGET}.tmp ${.TARGET}
    426 insn-opinit.c: genopinit ${G_md_file} insn-conditions.md
    427 	${_MKTARGET_CREATE}
    428 	./genopinit ${G_md_file} insn-conditions.md \
    429 		-hinsn-opinit.h.tmp -c${.TARGET}.tmp && \
    430 	mv ${.TARGET}.tmp ${.TARGET}
    431 CLEANFILES+=	insn-opinit.h insn-opinit.c insn-opinit.h.tmp
    432 
    433 LDFLAGS.genautomata+=	-lm
    434 
    435 # gencondmd outputs a special .md file
    436 insn-conditions.md: gencondmd
    437 	./gencondmd >${.TARGET}
    438 CLEANFILES+=	insn-conditions.md 
    439 
    440 # build case-cfn-macros.h and cfn-operators.pd
    441 case-cfn-macros.h: gencfn-macros
    442 	./gencfn-macros -c > case-cfn-macros.h.tmp && \
    443 	mv case-cfn-macros.h.tmp case-cfn-macros.h
    444 cfn-operators.pd: gencfn-macros
    445 	./gencfn-macros -o > cfn-operators.pd.tmp && \
    446 	mv cfn-operators.pd.tmp cfn-operators.pd
    447 CLEANFILES+=	case-cfn-macros.h.tmp case-cfn-macros.h \
    448 		cfn-operators.pd.tmp cfn-operators.pd
    449 
    450 CASECFNDEPS=	aarch64-builtins.c arm-builtins.c i386.c rs6000.c \
    451 		riscv-builtins.c builtins.c \
    452 		fold-const.c tree-ssa-math-opts.c tree-ssa-reassoc.c \
    453 		tree-vect-patterns.c tree-vrp.c generic-match-head.c \
    454 		gimple-match-head.c ChangeLog-2015 fold-const-call.c \
    455 		gimple-ssa-backprop.c
    456 ${CASECFNDEPS}: case-cfn-macros.h
    457 
    458 aarch64-builtin-iterators.h: ${DIST}/gcc/config/aarch64/geniterators.sh \
    459     ${DIST}/gcc/config/aarch64/iterators.md
    460 	$(HOST_SH) ${.ALLSRC} > ${.TARGET}
    461 
    462 CLEANFILES+=	aarch-builtin-iterators.h
    463 
    464 #
    465 # Required hard-coded dependancies.
    466 #
    467 aarch64-builtins.o: aarch64-builtin-iterators.h
    468 tm.h: insn-constants.h
    469 genextract.lo: insn-config.h
    470 gencondmd.lo: tm_p.h tm-constrs.h
    471 read-rtl.lo gencodes.lo genattrtab.lo genautomata.lo: tm.h gtype-desc.h
    472 genattr-common.lo gensupport.lo genconditions.lo gentarget-def.lo: tm.h
    473 genattr.lo genflags.lo genemit.lo genconfig.lo gencheck.lo: gtype-desc.h tm.h
    474 genopinit.lo genrecog.lo genpreds.lo genoutput.lo genpeep.lo: tm.h
    475 build-ggc-none.lo: gtype-desc.h
    476 ggc-none.o: gtype-desc.h
    477 insn-attrtab.o: insn-config.h
    478 insn-extract.o: insn-config.h
    479 toplev.d toplev.o: options.h
    480 coverage.d: gcov-iov.h
    481 gcov-io.h: gcov-iov.h
    482 cgraph.d cgraphunit.d cgraphunit.o: gcov-io.h
    483 vec.lo: gtype-desc.h
    484 insn-emit.d insn-emit.o: tm-constrs.h
    485 insn-attr.h: insn-attr-common.h
    486 gcov-io.h: gcov-iov.h
    487 df-scan.d df-scan.o: target-hooks-def.h
    488 read-md.d read-md.o read-md.lo: auto-build.h
    489 hash-table.d hash-table.o hash-table.lo: auto-build.h gtype-desc.h
    490 gencfn-macros.d gencfn-macros.o gencfn-macros.lo: gtype-desc.h
    491 pass_manager.h passes.c: pass-instances.def
    492 context.d coverage.d lto-cgraph.d passes.d statistics.d toplev.d cgraphunit.d: pass_manager.h
    493 context.o coverage.o lto-cgraph.o passes.o statistics.o toplev.o cgraphunit.o: pass_manager.h
    494 insn-opinit.o insn-opinit.d: insn-flags.h
    495 gensupport.o: ${G_HASH_TABLE_H}
    496 vec.o: ${G_HASH_TABLE_H}
    497 .for _f in insn-attrtab insn-automata insn-dfatab insn-latencytab insn-output
    498 ${_f}.o ${_f}.d: insn-attr-common.h insn-attr.h
    499 .endfor
    500 .for _f in insn-attrtab insn-automata insn-dfatab insn-emit insn-extract \
    501 	   insn-latencytab insn-opinit insn-output insn-peep insn-preds \
    502 	   insn-recog
    503 ${_f}.o ${_f}.d: insn-codes.h insn-config.h insn-constants.h insn-flags.h
    504 .endfor
    505 .for _f in insn-enums insn-modes
    506 ${_f}.o ${_f}.d: insn-constants.h
    507 .endfor
    508 .for _f in data-streamer data-streamer-out coverage gcov-dump gcov-io \
    509 	   gcov-iov gcov libgcov lto-cgraph mcf modulo-sched profile value-prof
    510 ${_f}.o ${_f}.d: gcov-io.h
    511 .endfor
    512 
    513 ${G_out_file:T:.c=.o}: insn-target-def.h target-hooks-def.h tm-constrs.h
    514 
    515 # XXX make all hooks generated for now.
    516 final.o: target-hooks-def.h c-family/c-target-hooks-def.h common/common-target-hooks-def.h
    517 
    518 COPTS.ira-color.c+= -Wno-error=int-in-bool-context
    519 
    520 .if ${MACHINE_CPU} == "arm"
    521 # XXX insn-recog.c:10304:7: error: this decimal constant is unsigned only in ISO C90 [-Werror]
    522 COPTS.insn-recog.c+=-Wno-error
    523 .endif
    524 
    525 .if ${GCC_MACHINE_ARCH} == "i386" || ${GCC_MACHINE_ARCH} == "x86_64"
    526 i386.d i386.o: pass_manager.h
    527 .endif
    528 
    529 .if ${MACHINE_CPU} == "mips"
    530 # XXX mips.md:3474:11: error: this decimal constant is unsigned only in ISO C90 [-Werror]
    531 COPTS.insn-recog.c+=-Wno-error
    532 .endif
    533 
    534 .if ${GCC_MACHINE_ARCH} == "vax"
    535 CPPFLAGS+=-I${.CURDIR}/../../lib/libgcc/libgcov/arch/${GCC_MACHINE_ARCH}
    536 COPTS.builtins.c+=-O0
    537 COPTS.calls.c+=-O0
    538 COPTS.convert.c+=-O0
    539 COPTS.data-streamer-out.c+=-O0
    540 COPTS.dse.c+=-O0					# XXX port-vax/51967
    541 COPTS.dwarf2out.c+=-O0
    542 COPTS.expmed.c+=-O0
    543 COPTS.expr.c+=-O0 -Wno-error=tautological-compare
    544 COPTS.fixed-value.c+=-O0
    545 COPTS.fold-const.c+=-O0
    546 COPTS.generic-match.c+=-O0
    547 COPTS.gimple-fold.c+=-O0
    548 COPTS.gimple-match.c+=-O0
    549 COPTS.gimple-ssa-strength-reduction.c+=-O0
    550 COPTS.gimple-ssa-warn-restrict.c+=-O0
    551 COPTS.gimple.c+=-O0
    552 COPTS.internal-fn.c+=-O0
    553 COPTS.lto-streamer-out.c+=-O0
    554 COPTS.omp-low.c+=-O0
    555 COPTS.predict.c+=-O0
    556 COPTS.range-op.cc+=-O0
    557 COPTS.recog.c+=-O0
    558 COPTS.sanopt.c+=-O0
    559 COPTS.stmt.c+=-O0
    560 COPTS.stor-layout.c+=-O0
    561 COPTS.targhooks.c+=-O0
    562 COPTS.tree-affine.c+=-O0
    563 COPTS.tree-cfg.c+=-O0
    564 COPTS.tree-data-ref.c+=-O0
    565 COPTS.tree-eh.c+=-O0
    566 COPTS.tree-if-conv.c+=-O0
    567 COPTS.tree-object-size.c+=-O0
    568 COPTS.tree-parloops.c+=-O0
    569 COPTS.tree-predcom.c+=-O0
    570 COPTS.tree-pretty-print.c+=-O0
    571 COPTS.tree-ssa-alias.c+=-O0
    572 COPTS.tree-ssa-ccp.c+=-O0
    573 COPTS.tree-ssa-forwprop.c+=-O0
    574 COPTS.tree-ssa-loop-ivopts.c+=-O0
    575 COPTS.tree-ssa-loop-manip.c+=-O0
    576 COPTS.tree-ssa-loop-niter.c+=-O0
    577 COPTS.tree-ssa-math-opts.c+=-O0
    578 COPTS.tree-ssa-phiopt.c+= -O0
    579 COPTS.tree-ssa-pre.c+=-O0
    580 COPTS.tree-ssa-reassoc.c+=-O0
    581 COPTS.tree-ssa-strlen.c+=-O0
    582 COPTS.tree-ssa-uninit.c+=-O0
    583 COPTS.tree-ssa.c+=-O0
    584 COPTS.tree-switch-conversion.c+=-O0
    585 COPTS.tree-vect-data-refs.c+=-O0
    586 COPTS.tree-vect-loop-manip.c+=-O0
    587 COPTS.tree-vect-loop.c+=-O0
    588 COPTS.tree-vect-patterns.c+=-O0
    589 COPTS.tree-vect-stmts.c+=-O0
    590 COPTS.tree-vrp.c+=-O0
    591 COPTS.tree.c+=-O0
    592 COPTS.ubsan.c+=-O0
    593 COPTS.varasm.c+=-O0
    594 COPTS.vr-values.c+=-O0
    595 COPTS.web.c+=-O0
    596 COPTS.wide-int-range.cc+=-O0
    597 COPTS.wide-int.cc+=-O0
    598 .else
    599 COPTS.tree.c=	${${ACTIVE_CC} == "clang" :? -O0 :}
    600 .endif
    601 
    602 CFLAGS+=	-Wno-stack-protector
    603 
    604 COPTS.dwarf2out.c+=${CC_WNO_MAYBE_UNINITIALIZED}
    605 
    606 .if ${GCC_MACHINE_ARCH} == "m68000" || ${GCC_MACHINE_ARCH} == "m68k" || \
    607 	${GCC_MACHINE_ARCH} == "coldfire"
    608 COPTS.tree-loop-distribution.c+=-O2
    609 COPTS.generic-match.c+=-fno-jump-tables
    610 COPTS.gimple-match.c+=-fno-jump-tables
    611 .endif
    612 
    613 # Don't fight with decimal128Local.h.
    614 # The GCC build only ignores the warning?
    615 COPTS.dfp.c+=	-fno-strict-aliasing
    616 
    617 CFLAGS+= -fno-exceptions -fno-rtti -fasynchronous-unwind-tables
    618 
    619 .PATH: ${DIST}/gcc ${DIST}/libiberty ${GCCARCH} ${G_out_file:H} ${DIST}/include
    620 .PATH: ${DIST}/gcc/config
    621 .PATH: ${DIST}/gcc/analyzer
    622 .if ${MACHINE_CPU} == "aarch64"
    623 .PATH: ${DIST}/gcc/config/arm
    624 .endif
    625