Makefile revision 1.15 1 # $NetBSD: Makefile,v 1.15 2021/04/09 23:15:51 mrg Exp $
2
3 LIBISPRIVATE= yes
4
5 LIB= backend
6
7 SRCS= ${G_OBJS} ${G_out_file:T} regsub.c
8
9 # XXX: something misses these.
10 CLEANDIRFILES+= ${G_OBJS:.o=.d}
11
12 # Make sure we use the pre-generated C files
13 .l.c:
14 @true
15
16 BOTH_CPPFLAGS+= -I. -I${GCCARCH} ${G_ALL_CFLAGS:M-D*} ${G_INCLUDES:M-I*:N-I.*}
17 CPPFLAGS+= ${BOTH_CPPFLAGS} -DTARGET_NAME=\"${MACHINE_GNU_PLATFORM}\"
18 HOST_CPPFLAGS+= -I${HOST_LIBIBERTYOBJ}/libiberty
19 HOST_CPPFLAGS+= ${BOTH_CPPFLAGS} -DGENERATOR_FILE
20 DPSRCS+= insn-attr.h insn-codes.h insn-config.h insn-flags.h tree-check.h
21 DPSRCS+= ${DIST}/gcc/BASE-VER
22 CPPFLAGS+= -I${DIST}/libgcc
23 CPPFLAGS+= -I${.CURDIR}/../../lib/libgcc/libgcov/arch/${MACHINE_ARCH}
24
25 CPPFLAGS.cppdefault.c+= -DPREFIX=\"/usr\" \
26 -DNATIVE_SYSTEM_HEADER_DIR=\"${G_NATIVE_SYSTEM_HEADER_DIR}\"
27
28 HOST_CXXFLAGS+= -std=gnu++98
29
30 HOSTPROG_CXX= 1
31
32 .include <bsd.init.mk>
33
34 HOST_LIBIBERTYOBJ!= cd ${.CURDIR}/../host-libiberty && ${PRINTOBJDIR}
35
36 .include <bsd.lib.mk>
37
38 # Force using C++ for this
39 ORIGHOST_CC:= ${HOST_CC}
40 HOST_CC:= ${HOST_CXX}
41 CC:= ${CXX}
42 CFLAGS:= ${CXXFLAGS}
43
44 # Check PREPROCESSOR_DEFINES for cppbuiltin.c and cppdefault.c
45 CPPFLAGS.cppbuiltin.c+= -DBASEVER="\"${BASEVER}"\"
46
47 #
48 # Independent generation programs.
49 #
50 CLEANFILES+= 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
64 COPTS.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*)
73 HH_NORTL= ${G_tm_file_list} ${G_build_xm_include_list}
74 HH= ${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 #
80 genrtl.h: gengenrtl
81 ${_MKTARGET_CREATE}
82 ./gengenrtl >${.TARGET}
83 gengenrtl.lo: ${HH_NORTL}
84 gengenrtl: gengenrtl.lo build-errors.lo
85 ${_MKTARGET_LINK}
86 ${HOST_LINK.cc} -o ${.TARGET} ${.ALLSRC} ${NBCOMPATLIB} ${HOSTLIBIBERTY}
87
88 insn-preds.c: genpreds ${G_md_file}
89 ${_MKTARGET_CREATE}
90 ./genpreds ${G_md_file} >${.TARGET}
91 tm-preds.h: genpreds ${G_md_file}
92 ${_MKTARGET_CREATE}
93 ./genpreds -h ${G_md_file} >${.TARGET}
94 tm-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.
99 gtyp-input.list.tmp: ${GCCARCH}/gtyp-input.list
100 sed s#SRCDIR#${DIST}# < ${.ALLSRC} > ${.TARGET}
101 CLEANFILES+= gtyp-input.list.tmp
102
103 # XXX
104 CLEANFILES+= gtype-lto.h gtype-objcp.h tm-constrs.h gtype-jit.h
105
106 gtype-desc.c: gtype-desc.h
107 gtype-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
120 gengtype.lo gengtype-lex.lo gengtype-parse.lo gengtype-state.lo version.lo: ${HH} gtyp-gen.h config.h options.h
121 gengtype: 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
127 COPTS.gengtype-lex.c= -UGENERATOR_FILE -DHOST_GENERATOR_FILE
128 COPTS.gengtype-parse.c= -UGENERATOR_FILE -DHOST_GENERATOR_FILE
129 COPTS.gengtype-state.c= -UGENERATOR_FILE -DHOST_GENERATOR_FILE
130 COPTS.gengtype.c= -UGENERATOR_FILE -DHOST_GENERATOR_FILE
131
132 gtyp-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
151 insn-modes.c: genmodes
152 ${_MKTARGET_CREATE}
153 ./genmodes >${.TARGET}
154 insn-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
162 min-insn-modes.c: genmodes
163 ${_MKTARGET_CREATE}
164 ./genmodes -m >${.TARGET}
165 insn-modes-inline.h: genmodes
166 ${_MKTARGET_CREATE}
167 ./genmodes -i >${.TARGET}
168 genmodes.lo: ${HH_NORTL}
169 genmodes: genmodes.lo build-errors.lo
170 ${_MKTARGET_LINK}
171 ${HOST_LINK.cc} -o ${.TARGET} ${.ALLSRC} ${NBCOMPATLIB} ${HOSTLIBIBERTY}
172
173 CLEANFILES+= genmodes insn-modes.c insn-modes.h-test min-insn-modes.c insn-modes-inline.h
174
175 gimple-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
178 generic-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
181 genmatch.lo: ${HH_NORTL} ${G_GGC_H} case-cfn-macros.h
182 genmatch: 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
186 CLEANFILES+= genmatch gimple-match.c generic-match.c
187
188 gcov-iov.h: gcov-iov
189 ${_MKTARGET_CREATE}
190 ./gcov-iov "${BASEVER}" "${DEVPHASE}" >${.TARGET}
191 gcov-iov.lo: ${HH_NORTL}
192 gcov-iov: gcov-iov.lo
193 ${_MKTARGET_CREATE}
194 ${HOST_LINK.cc} -o ${.TARGET} ${.ALLSRC} ${NBCOMPATLIB} ${HOSTLIBIBERTY}
195
196 tm_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.
210 CLEANFILES+= auto-build.h
211 HOST_CFLAGS+= -I${.OBJDIR}
212 HOST_CXXFLAGS+= -I${.OBJDIR}
213
214 # Set this to "true" to leave .ab around
215 HOST_AB_CLEAN?= rm -rf .ab
216
217 auto-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
236 pass-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
240 CLEANFILES+= 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
247 build-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}
253 build-rtl.lo: ${HH} insn-constants.h
254 CLEANFILES+= build-rtl.c
255
256 build-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}
262 build-print-rtl.lo: ${HH}
263 build-print-rtl.o: print-rtl.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h \
264 ${GTM_H} ${G_RTL_BASE_H}
265 CLEANFILES+= build-print-rtl.c
266
267 build-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}
273 build-bitmap.lo: ${HH}
274 CLEANFILES+= build-bitmap.c
275
276 build-errors.c: errors.c errors.h
277 ${_MKTARGET_CREATE}
278 rm -f build-errors.c
279 cat ${GNUHOSTDIST}/gcc/errors.c >${.TARGET}
280 build-errors.lo: ${HH_NORTL}
281 CLEANFILES+= build-errors.c
282
283 build-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}
289 build-varray.lo: ${HH} gtype-desc.h
290 CLEANFILES+= build-varray.c
291
292 build-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}
298 build-ggc-none.lo: ${HH}
299 CLEANFILES+= build-ggc-none.c
300
301 build-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}
305 build-hash-table.lo: ${HH_NORTL}
306 CLEANFILES+= build-hash-table.c
307
308 build-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}
312 build-vec.lo: ${HH_NORTL}
313 CLEANFILES+= build-vec.c
314
315 build-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}
319 build-sort.lo: ${HH_NORTL}
320 CLEANFILES+= build-sort.cc
321
322 build-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 #
337 GENPROG_ERROR_DEPENDS= ${G_BUILD_ERRORS:.o=.lo}
338 GENPROG_READER_DEPENDS= ${G_BUILD_MD:.o=.lo} ${GENPROG_ERROR_DEPENDS}
339 GENPROG_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
347 gen${f}.lo: ${HH} gen${f}.c ${G_RTL_BASE_H} build-sort.lo
348 gen${f}: gen${f}.lo ${GENPROG_RTL_DEPENDS}
349 ${_MKTARGET_LINK}
350 ${HOST_LINK.cc} -o ${.TARGET} ${.ALLSRC} ${NBCOMPATLIB} ${HOSTLIBIBERTY} ${LDFLAGS.${.TARGET}} build-sort.lo
351 CLEANFILES+= gen${f} gen${f}.lo
352 .endfor
353
354 .for f in mddeps constants enums
355 gen${f}.lo: ${HH} gen${f}.c ${G_RTL_BASE_H}
356 gen${f}: gen${f}.lo ${GENPROG_READER_DEPENDS}
357 ${_MKTARGET_LINK}
358 ${HOST_LINK.cc} -o ${.TARGET} ${.ALLSRC} ${NBCOMPATLIB} ${HOSTLIBIBERTY} ${LDFLAGS.${.TARGET}}
359 CLEANFILES+= gen${f} gen${f}.lo
360 .endfor
361
362 .for f in check checksum
363 gen${f}.lo: ${HH} gen${f}.c ${G_RTL_BASE_H}
364 gen${f}: gen${f}.lo
365 ${_MKTARGET_LINK}
366 ${HOST_LINK.cc} -o ${.TARGET} ${.ALLSRC} ${NBCOMPATLIB} ${HOSTLIBIBERTY} ${LDFLAGS.${.TARGET}}
367 CLEANFILES+= 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
384 insn-${f}: gen${f:R} ${G_md_file} insn-conditions.md
385 ${_MKTARGET_CREATE}
386 ./gen${f:R} ${G_md_file} insn-conditions.md >${.TARGET}
387 CLEANFILES+= insn-${f}
388 .endfor
389
390 # normal files
391 .for f in constants.h enums.c
392 insn-${f}: gen${f:R} ${G_md_file}
393 ${_MKTARGET_CREATE}
394 ./gen${f:R} ${G_md_file} >${.TARGET}
395 CLEANFILES+= insn-${f}
396 .endfor
397
398 # genconditions outputs gencondmd.c
399 gencondmd.c: genconditions ${G_md_file}
400 ${_MKTARGET_CREATE}
401 ./genconditions ${G_md_file} >${.TARGET}
402 CLEANFILES+= gencondmd.c
403
404 # gencheck outputs tree-check.h
405 tree-check.h: gencheck
406 ${_MKTARGET_CREATE}
407 ./gencheck >${.TARGET}
408 CLEANFILES+= tree-check.h
409
410 # genattrtab has three output files
411 insn-dfatab.c insn-latencytab.c: insn-attrtab.c
412 cp -p ${.TARGET}.tmp ${.TARGET}
413 insn-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}
418 CLEANFILES+= 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
422 insn-opinit.h: insn-opinit.c
423 cp -p ${.TARGET}.tmp ${.TARGET}
424 insn-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}
429 CLEANFILES+= insn-opinit.h insn-opinit.c insn-opinit.h.tmp
430
431 LDFLAGS.genautomata+= -lm
432
433 # gencondmd outputs a special .md file
434 insn-conditions.md: gencondmd
435 ./gencondmd >${.TARGET}
436 CLEANFILES+= insn-conditions.md
437
438 # build params.list for params.h.
439 params.h: params.list
440 ${SRCS}: params.list
441 params-list.h: params.def
442 params.list: params-list.h
443 ${CPP} ${.ALLSRC} | sed 's/^#.*//;/^$$/d' > params.list.tmp && \
444 mv params.list.tmp params.list
445 CLEANFILES+= params.list.tmp params.list
446
447 # build case-cfn-macros.h and cfn-operators.pd
448 case-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
451 cfn-operators.pd: gencfn-macros
452 ./gencfn-macros -o > cfn-operators.pd.tmp && \
453 mv cfn-operators.pd.tmp cfn-operators.pd
454 CLEANFILES+= case-cfn-macros.h.tmp case-cfn-macros.h \
455 cfn-operators.pd.tmp cfn-operators.pd
456
457 CASECFNDEPS= 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
465 aarch64-builtin-iterators.h: ${DIST}/gcc/config/aarch64/geniterators.sh \
466 ${DIST}/gcc/config/aarch64/iterators.md
467 $(HOST_SH) ${.ALLSRC} > ${.TARGET}
468
469 CLEANFILES+= aarch-builtin-iterators.h
470
471 #
472 # Required hard-coded dependancies.
473 #
474 aarch64-builtins.o: aarch64-builtin-iterators.h
475 tm.h: insn-constants.h
476 genextract.lo: insn-config.h
477 gencondmd.lo: tm_p.h tm-constrs.h
478 read-rtl.lo gencodes.lo genattrtab.lo genautomata.lo: tm.h gtype-desc.h
479 genattr-common.lo gensupport.lo genconditions.lo gentarget-def.lo: tm.h
480 genattr.lo genflags.lo genemit.lo genconfig.lo gencheck.lo: gtype-desc.h tm.h
481 genopinit.lo genrecog.lo genpreds.lo genoutput.lo genpeep.lo: tm.h
482 build-ggc-none.lo: gtype-desc.h
483 ggc-none.o: gtype-desc.h
484 insn-attrtab.o: insn-config.h
485 insn-extract.o: insn-config.h
486 toplev.d toplev.o: options.h
487 coverage.d: gcov-iov.h
488 gcov-io.h: gcov-iov.h
489 cgraph.d cgraphunit.d cgraphunit.o: gcov-io.h
490 vec.lo: gtype-desc.h
491 insn-emit.d insn-emit.o: tm-constrs.h
492 insn-attr.h: insn-attr-common.h
493 gcov-io.h: gcov-iov.h
494 df-scan.d df-scan.o: target-hooks-def.h
495 read-md.d read-md.o read-md.lo: auto-build.h
496 hash-table.d hash-table.o hash-table.lo: auto-build.h gtype-desc.h
497 gencfn-macros.d gencfn-macros.o gencfn-macros.lo: gtype-desc.h
498 pass_manager.h passes.c: pass-instances.def
499 context.d coverage.d lto-cgraph.d passes.d statistics.d toplev.d cgraphunit.d: pass_manager.h
500 context.o coverage.o lto-cgraph.o passes.o statistics.o toplev.o cgraphunit.o: pass_manager.h
501 insn-opinit.o insn-opinit.d: insn-flags.h
502 gensupport.o: ${G_HASH_TABLE_H}
503 vec.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.
523 final.o: target-hooks-def.h c-family/c-target-hooks-def.h common/common-target-hooks-def.h
524
525 COPTS.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]
529 COPTS.insn-recog.c+=-Wno-error
530 .endif
531
532 .if ${GCC_MACHINE_ARCH} == "i386" || ${GCC_MACHINE_ARCH} == "x86_64"
533 i386.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]
538 COPTS.insn-recog.c+=-Wno-error
539 .endif
540
541 .if ${GCC_MACHINE_ARCH} == "vax"
542 CPPFLAGS+=-I${.CURDIR}/../../lib/libgcc/libgcov/arch/${GCC_MACHINE_ARCH}
543 COPTS.builtins.c+=-O0
544 COPTS.calls.c+=-O0
545 COPTS.convert.c+=-O0
546 COPTS.data-streamer-out.c+=-O0
547 COPTS.dse.c+=-O0 # XXX port-vax/51967
548 COPTS.dwarf2out.c+=-O0
549 COPTS.expmed.c+=-O0
550 COPTS.expr.c+=-O0 -Wno-error=tautological-compare
551 COPTS.fixed-value.c+=-O0
552 COPTS.fold-const.c+=-O0
553 COPTS.generic-match.c+=-O0
554 COPTS.gimple-fold.c+=-O0
555 COPTS.gimple-match.c+=-O0
556 COPTS.gimple-ssa-strength-reduction.c+=-O0
557 COPTS.gimple-ssa-warn-restrict.c+=-O0
558 COPTS.gimple.c+=-O0
559 COPTS.internal-fn.c+=-O0
560 COPTS.lto-streamer-out.c+=-O0
561 COPTS.omp-low.c+=-O0
562 COPTS.predict.c+=-O0
563 COPTS.recog.c+=-O0
564 COPTS.sanopt.c+=-O0
565 COPTS.stmt.c+=-O0
566 COPTS.stor-layout.c+=-O0
567 COPTS.targhooks.c+=-O0
568 COPTS.tree-affine.c+=-O0
569 COPTS.tree-cfg.c+=-O0
570 COPTS.tree-data-ref.c+=-O0
571 COPTS.tree-eh.c+=-O0
572 COPTS.tree-if-conv.c+=-O0
573 COPTS.tree-object-size.c+=-O0
574 COPTS.tree-parloops.c+=-O0
575 COPTS.tree-predcom.c+=-O0
576 COPTS.tree-pretty-print.c+=-O0
577 COPTS.tree-ssa-alias.c+=-O0
578 COPTS.tree-ssa-ccp.c+=-O0
579 COPTS.tree-ssa-forwprop.c+=-O0
580 COPTS.tree-ssa-loop-ivopts.c+=-O0
581 COPTS.tree-ssa-loop-manip.c+=-O0
582 COPTS.tree-ssa-loop-niter.c+=-O0
583 COPTS.tree-ssa-math-opts.c+=-O0
584 COPTS.tree-ssa-phiopt.c+= -O0
585 COPTS.tree-ssa-pre.c+=-O0
586 COPTS.tree-ssa-reassoc.c+=-O0
587 COPTS.tree-ssa-strlen.c+=-O0
588 COPTS.tree-ssa-uninit.c+=-O0
589 COPTS.tree-ssa.c+=-O0
590 COPTS.tree-switch-conversion.c+=-O0
591 COPTS.tree-vect-data-refs.c+=-O0
592 COPTS.tree-vect-loop-manip.c+=-O0
593 COPTS.tree-vect-loop.c+=-O0
594 COPTS.tree-vect-patterns.c+=-O0
595 COPTS.tree-vect-stmts.c+=-O0
596 COPTS.tree-vrp.c+=-O0
597 COPTS.tree.c+=-O0
598 COPTS.ubsan.c+=-O0
599 COPTS.varasm.c+=-O0
600 COPTS.vr-values.c+=-O0
601 COPTS.web.c+=-O0
602 COPTS.wide-int.cc+=-O0
603 COPTS.wide-int-range.cc+=-O0
604 .else
605 COPTS.tree.c= ${${ACTIVE_CC} == "clang" :? -O0 :}
606 .endif
607
608 CFLAGS+= -Wno-stack-protector
609
610 COPTS.dwarf2out.c+=-Wno-error=maybe-uninitialized
611
612 .if ${GCC_MACHINE_ARCH} == "m68000" || ${GCC_MACHINE_ARCH} == "m68k" || \
613 ${GCC_MACHINE_ARCH} == "coldfire"
614 COPTS.tree-loop-distribution.c+=-O2
615 COPTS.generic-match.c+=-fno-jump-tables
616 COPTS.gimple-match.c+=-fno-jump-tables
617 .endif
618
619 # Don't fight with decimal128Local.h.
620 # The GCC build only ignores the warning?
621 COPTS.dfp.c+= -fno-strict-aliasing
622
623 CFLAGS+= -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