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