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