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