xref: /netbsd-src/external/gpl3/gcc.old/usr.bin/backend/Makefile (revision 7c76c2272ed33e9382ba21d8bb8c83a57d05f685)
1#	$NetBSD: Makefile,v 1.21 2023/10/07 12:15:51 rin Exp $
2
3HOSTPROG_CXX=	1
4LIBISPRIVATE=	yes
5
6# For ../Makefile.inc and bsd.own.mk
7.include <bsd.init.mk>
8
9LIB=		backend
10
11SRCS=		${G_OBJS:S,analyzer/,,} ${G_out_file:T} regsub.c
12
13# XXX: something misses these.
14CLEANDIRFILES+=	${G_OBJS:.o=.d}
15
16# Make sure we use the pre-generated C files
17.l.c:
18	@true
19
20BOTH_CPPFLAGS+=	-I. -I${GCCARCH} ${G_ALL_CFLAGS:M-D*} ${G_INCLUDES:M-I*:N-I.*}
21CPPFLAGS+=	${BOTH_CPPFLAGS} -DTARGET_NAME=\"${MACHINE_GNU_PLATFORM}\"
22HOST_CPPFLAGS+=	-I${HOST_LIBIBERTYOBJ}/libiberty
23HOST_CPPFLAGS+=	${BOTH_CPPFLAGS} -DGENERATOR_FILE
24DPSRCS+=	insn-attr.h insn-codes.h insn-config.h insn-flags.h tree-check.h
25DPSRCS+=	${DIST}/gcc/BASE-VER
26CPPFLAGS+=	-I${DIST}/libgcc
27CPPFLAGS+=	-I${.CURDIR}/../../lib/libgcc/libgcov/arch/${MACHINE_ARCH}
28
29CPPFLAGS.cppdefault.c+=	-DPREFIX=\"/usr\" \
30			-DNATIVE_SYSTEM_HEADER_DIR=\"${G_NATIVE_SYSTEM_HEADER_DIR}\"
31CPPFLAGS.lto-streamer-in.c+=	-DTARGET_MACHINE=\"${MACHINE_GNU_PLATFORM}\"
32
33HOST_CXXFLAGS+=	-std=gnu++98
34
35HOST_LIBIBERTYOBJ!=	cd ${.CURDIR}/../host-libiberty && ${PRINTOBJDIR}
36
37.include <bsd.lib.mk>
38
39# Force using C++ for this
40ORIGHOST_CC:=	${HOST_CC}
41HOST_CC:=	${HOST_CXX}
42CC:=		${CXX}
43CFLAGS:=	${CXXFLAGS}
44
45# Check PREPROCESSOR_DEFINES for cppbuiltin.c and cppdefault.c
46CPPFLAGS.cppbuiltin.c+=	-DBASEVER="\"${BASEVER}"\"
47
48#
49# Independent generation programs.
50#
51CLEANFILES+=	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
65COPTS.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*)
74HH_NORTL=	${G_tm_file_list} ${G_build_xm_include_list}
75HH=		${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#
81genrtl.h: gengenrtl
82	${_MKTARGET_CREATE}
83	./gengenrtl >${.TARGET}
84gengenrtl.lo: ${HH_NORTL}
85gengenrtl: gengenrtl.lo build-errors.lo
86	${_MKTARGET_LINK}
87	${HOST_LINK.cc} -o ${.TARGET} ${.ALLSRC} ${NBCOMPATLIB} ${HOSTLIBIBERTY}
88
89insn-preds.c: genpreds ${G_md_file}
90	${_MKTARGET_CREATE}
91	./genpreds ${G_md_file} >${.TARGET}
92tm-preds.h: genpreds ${G_md_file}
93	${_MKTARGET_CREATE}
94	./genpreds -h ${G_md_file} >${.TARGET}
95tm-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.
100gtyp-input.list.tmp: ${GCCARCH}/gtyp-input.list
101	sed s#SRCDIR#${DIST}# < ${.ALLSRC} > ${.TARGET}
102CLEANFILES+=	gtyp-input.list.tmp
103
104# XXX
105CLEANFILES+=	gtype-lto.h gtype-objcp.h tm-constrs.h gtype-jit.h
106
107gtype-desc.c: gtype-desc.h
108gtype-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
121gengtype.lo gengtype-lex.lo gengtype-parse.lo gengtype-state.lo version.lo: ${HH} gtyp-gen.h config.h options.h
122gengtype: 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
128COPTS.gengtype-lex.c=	-UGENERATOR_FILE -DHOST_GENERATOR_FILE
129COPTS.gengtype-parse.c=	-UGENERATOR_FILE -DHOST_GENERATOR_FILE
130COPTS.gengtype-state.c=	-UGENERATOR_FILE -DHOST_GENERATOR_FILE
131COPTS.gengtype.c=	-UGENERATOR_FILE -DHOST_GENERATOR_FILE
132
133gtyp-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
152insn-modes.c: genmodes
153	${_MKTARGET_CREATE}
154	./genmodes >${.TARGET}
155insn-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
163min-insn-modes.c: genmodes
164	${_MKTARGET_CREATE}
165	./genmodes -m >${.TARGET}
166insn-modes-inline.h: genmodes
167	${_MKTARGET_CREATE}
168	./genmodes -i >${.TARGET}
169genmodes.lo: ${HH_NORTL}
170genmodes: genmodes.lo build-errors.lo
171	${_MKTARGET_LINK}
172	${HOST_LINK.cc} -o ${.TARGET} ${.ALLSRC} ${NBCOMPATLIB} ${HOSTLIBIBERTY}
173
174CLEANFILES+=	genmodes insn-modes.c insn-modes.h-test min-insn-modes.c insn-modes-inline.h
175
176gimple-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
179generic-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
182genmatch.lo: ${HH_NORTL} ${G_GGC_H} case-cfn-macros.h
183genmatch: 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
187CLEANFILES+=	genmatch gimple-match.c generic-match.c
188
189gcov-iov.h: gcov-iov
190	${_MKTARGET_CREATE}
191	./gcov-iov "${BASEVER}" "${DEVPHASE}" >${.TARGET}
192gcov-iov.lo: ${HH_NORTL}
193gcov-iov: gcov-iov.lo
194	${_MKTARGET_CREATE}
195	${HOST_LINK.cc} -o ${.TARGET} ${.ALLSRC} ${NBCOMPATLIB} ${HOSTLIBIBERTY}
196
197tm_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.
211CLEANFILES+=	auto-build.h
212HOST_CFLAGS+= -I${.OBJDIR}
213HOST_CXXFLAGS+= -I${.OBJDIR}
214
215# Set this to "true" to leave .ab around
216HOST_AB_CLEAN?=	rm -rf .ab
217
218auto-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
238pass-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
242CLEANFILES+=	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
249build-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}
255build-rtl.lo: ${HH} insn-constants.h
256CLEANFILES+=	build-rtl.c
257
258build-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}
264build-print-rtl.lo: ${HH}
265build-print-rtl.o: print-rtl.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h     \
266  ${GTM_H} ${G_RTL_BASE_H}
267CLEANFILES+=	build-print-rtl.c
268
269build-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}
275build-bitmap.lo: ${HH}
276CLEANFILES+=	build-bitmap.c
277
278build-errors.c: errors.c errors.h
279	${_MKTARGET_CREATE}
280	rm -f build-errors.c
281	cat ${GNUHOSTDIST}/gcc/errors.c >${.TARGET}
282build-errors.lo: ${HH_NORTL}
283CLEANFILES+=	build-errors.c
284
285build-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}
291build-varray.lo: ${HH} gtype-desc.h
292CLEANFILES+=	build-varray.c
293
294build-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}
300build-ggc-none.lo: ${HH}
301CLEANFILES+=	build-ggc-none.c
302
303build-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}
307build-hash-table.lo: ${HH_NORTL}
308CLEANFILES+=	build-hash-table.c
309
310build-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}
314build-vec.lo: ${HH_NORTL}
315CLEANFILES+=	build-vec.c
316
317build-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}
321build-sort.lo: ${HH_NORTL}
322CLEANFILES+=	build-sort.cc
323
324build-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#
339GENPROG_ERROR_DEPENDS=	${G_BUILD_ERRORS:.o=.lo}
340GENPROG_READER_DEPENDS=	${G_BUILD_MD:.o=.lo} ${GENPROG_ERROR_DEPENDS}
341GENPROG_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
349gen${f}.lo: ${HH} gen${f}.c ${G_RTL_BASE_H} build-sort.lo
350gen${f}: gen${f}.lo ${GENPROG_RTL_DEPENDS}
351	${_MKTARGET_LINK}
352	${HOST_LINK.cc} -o ${.TARGET} ${.ALLSRC} ${NBCOMPATLIB} ${HOSTLIBIBERTY} ${LDFLAGS.${.TARGET}} build-sort.lo
353CLEANFILES+=	gen${f} gen${f}.lo
354.endfor
355
356.for f in mddeps constants enums
357gen${f}.lo: ${HH} gen${f}.c ${G_RTL_BASE_H}
358gen${f}: gen${f}.lo ${GENPROG_READER_DEPENDS}
359	${_MKTARGET_LINK}
360	${HOST_LINK.cc} -o ${.TARGET} ${.ALLSRC} ${NBCOMPATLIB} ${HOSTLIBIBERTY} ${LDFLAGS.${.TARGET}}
361CLEANFILES+=	gen${f} gen${f}.lo
362.endfor
363
364.for f in check checksum
365gen${f}.lo: ${HH} gen${f}.c ${G_RTL_BASE_H}
366gen${f}: gen${f}.lo
367	${_MKTARGET_LINK}
368	${HOST_LINK.cc} -o ${.TARGET} ${.ALLSRC} ${NBCOMPATLIB} ${HOSTLIBIBERTY} ${LDFLAGS.${.TARGET}}
369CLEANFILES+=	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
386insn-${f}: gen${f:R} ${G_md_file} insn-conditions.md
387	${_MKTARGET_CREATE}
388	./gen${f:R} ${G_md_file} insn-conditions.md >${.TARGET}
389CLEANFILES+=	insn-${f}
390.endfor
391
392# normal files
393.for f in constants.h enums.c
394insn-${f}: gen${f:R} ${G_md_file}
395	${_MKTARGET_CREATE}
396	./gen${f:R} ${G_md_file} >${.TARGET}
397CLEANFILES+=	insn-${f}
398.endfor
399
400# genconditions outputs gencondmd.c
401gencondmd.c: genconditions ${G_md_file}
402	${_MKTARGET_CREATE}
403	./genconditions ${G_md_file} >${.TARGET}
404CLEANFILES+=	gencondmd.c
405
406# gencheck outputs tree-check.h
407tree-check.h: gencheck
408	${_MKTARGET_CREATE}
409	./gencheck >${.TARGET}
410CLEANFILES+=	tree-check.h
411
412# genattrtab has three output files
413insn-dfatab.c insn-latencytab.c: insn-attrtab.c
414	cp -p ${.TARGET}.tmp ${.TARGET}
415insn-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}
420CLEANFILES+=	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
424insn-opinit.h: insn-opinit.c
425	cp -p ${.TARGET}.tmp ${.TARGET}
426insn-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}
431CLEANFILES+=	insn-opinit.h insn-opinit.c insn-opinit.h.tmp
432
433LDFLAGS.genautomata+=	-lm
434
435# gencondmd outputs a special .md file
436insn-conditions.md: gencondmd
437	./gencondmd >${.TARGET}
438CLEANFILES+=	insn-conditions.md
439
440# build case-cfn-macros.h and cfn-operators.pd
441case-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
444cfn-operators.pd: gencfn-macros
445	./gencfn-macros -o > cfn-operators.pd.tmp && \
446	mv cfn-operators.pd.tmp cfn-operators.pd
447CLEANFILES+=	case-cfn-macros.h.tmp case-cfn-macros.h \
448		cfn-operators.pd.tmp cfn-operators.pd
449
450CASECFNDEPS=	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
458aarch64-builtin-iterators.h: ${DIST}/gcc/config/aarch64/geniterators.sh \
459    ${DIST}/gcc/config/aarch64/iterators.md
460	$(HOST_SH) ${.ALLSRC} > ${.TARGET}
461
462CLEANFILES+=	aarch-builtin-iterators.h
463
464#
465# Required hard-coded dependancies.
466#
467aarch64-builtins.o: aarch64-builtin-iterators.h
468tm.h: insn-constants.h
469genextract.lo: insn-config.h
470gencondmd.lo: tm_p.h tm-constrs.h
471read-rtl.lo gencodes.lo genattrtab.lo genautomata.lo: tm.h gtype-desc.h
472genattr-common.lo gensupport.lo genconditions.lo gentarget-def.lo: tm.h
473genattr.lo genflags.lo genemit.lo genconfig.lo gencheck.lo: gtype-desc.h tm.h
474genopinit.lo genrecog.lo genpreds.lo genoutput.lo genpeep.lo: tm.h
475build-ggc-none.lo: gtype-desc.h
476ggc-none.o: gtype-desc.h
477insn-attrtab.o: insn-config.h
478insn-extract.o: insn-config.h
479toplev.d toplev.o: options.h
480coverage.d: gcov-iov.h
481gcov-io.h: gcov-iov.h
482cgraph.d cgraphunit.d cgraphunit.o: gcov-io.h
483vec.lo: gtype-desc.h
484insn-emit.d insn-emit.o: tm-constrs.h
485insn-attr.h: insn-attr-common.h
486gcov-io.h: gcov-iov.h
487df-scan.d df-scan.o: target-hooks-def.h
488read-md.d read-md.o read-md.lo: auto-build.h
489hash-table.d hash-table.o hash-table.lo: auto-build.h gtype-desc.h
490gencfn-macros.d gencfn-macros.o gencfn-macros.lo: gtype-desc.h
491pass_manager.h passes.c: pass-instances.def
492context.d coverage.d lto-cgraph.d passes.d statistics.d toplev.d cgraphunit.d: pass_manager.h
493context.o coverage.o lto-cgraph.o passes.o statistics.o toplev.o cgraphunit.o: pass_manager.h
494insn-opinit.o insn-opinit.d: insn-flags.h
495gensupport.o: ${G_HASH_TABLE_H}
496vec.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.
516final.o: target-hooks-def.h c-family/c-target-hooks-def.h common/common-target-hooks-def.h
517
518COPTS.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]
522COPTS.insn-recog.c+=-Wno-error
523.endif
524
525.if ${GCC_MACHINE_ARCH} == "i386" || ${GCC_MACHINE_ARCH} == "x86_64"
526i386.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]
531COPTS.insn-recog.c+=-Wno-error
532.endif
533
534.if ${GCC_MACHINE_ARCH} == "vax"
535CPPFLAGS+=-I${.CURDIR}/../../lib/libgcc/libgcov/arch/${GCC_MACHINE_ARCH}
536
537COPTS.expmed.c+=-Wno-error=tautological-compare
538COPTS.expr.c+=-Wno-error=tautological-compare
539.else
540COPTS.tree.c=	${${ACTIVE_CC} == "clang" :? -O0 :}
541.endif
542
543CFLAGS+=	-Wno-stack-protector
544
545COPTS.dwarf2out.c+=${CC_WNO_MAYBE_UNINITIALIZED}
546
547.if ${GCC_MACHINE_ARCH} == "m68000" || ${GCC_MACHINE_ARCH} == "m68k" || \
548	${GCC_MACHINE_ARCH} == "coldfire"
549COPTS.tree-loop-distribution.c+=-O2
550COPTS.generic-match.c+=-fno-jump-tables
551COPTS.gimple-match.c+=-fno-jump-tables
552.endif
553
554# Don't fight with decimal128Local.h.
555# The GCC build only ignores the warning?
556COPTS.dfp.c+=	-fno-strict-aliasing
557
558CFLAGS+= -fno-exceptions -fno-rtti -fasynchronous-unwind-tables
559
560.PATH: ${DIST}/gcc ${DIST}/libiberty ${GCCARCH} ${G_out_file:H} ${DIST}/include
561.PATH: ${DIST}/gcc/config
562.PATH: ${DIST}/gcc/analyzer
563.if ${MACHINE_CPU} == "aarch64"
564.PATH: ${DIST}/gcc/config/arm
565.endif
566
567.if ${MACHINE} == "vax"
568CPPFLAGS+=	-DNB_FIX_VAX_BACKEND
569.endif
570