gcc50: Plug in WARNS framework for tools.
[dragonfly.git] / gnu / usr.bin / cc80 / cc_tools / tools / Makefile
... / ...
CommitLineData
1# Despite the source files ending in ".c", the c++ compiler needs to build
2# everything. We have to roll our own targets to properly support this.
3
4.include "../Makefile.inc"
5.include "../../Makefile.langs"
6
7NXCXXFLAGS+= -DGENERATOR_FILE -I${.OBJDIR}
8BUILD_LIBS= ../libiberty/libiberty.na
9BUILD_LIBS_genmatch= ../libcpp/libcpp.na
10LEX_HEAD= ../../cc_prep/gengtype-lex.head
11NXLD_genautomata= -lm
12
13MIC= sh ${GCCDIR}/move-if-change
14
15BUILD_RTL= rtl.no \
16 read-rtl.no \
17 ggc-none.no \
18 vec.no \
19 min-insn-modes.no \
20 gensupport.no \
21 print-rtl.no \
22 hash-table.no
23BUILD_MD= read-md.no
24BUILD_ERRORS= errors.no
25BUILD_GTYPE= gengtype-lex.no \
26 gengtype-parse.no \
27 gengtype-state.no \
28 version.no
29
30genprogrtl= attr attr-common attrtab automata codes conditions config emit \
31 extract flags opinit output peep preds recog mddump target-def
32genprogmd= $(genprogrtl) mddeps constants enums
33genprogerr= $(genprogmd) genrtl modes gtype hooks cfn-macros match
34genprog= $(genprogerr) check checksum condmd
35
36NO_RTL= ${genprogrtl:S/^/gen/g:S/$/.no/g}
37NO_MD= ${genprogmd:S/^/gen/g:S/$/.no/g}
38NO_PROGERR= ${genprogerr:S/^/gen/g:S/$/.no/g}
39NO_PROG= ${genprog:S/^/gen/g:S/$/.no/g}
40NO_LIST= ${BUILD_RTL} ${BUILD_MD} ${BUILD_ERRORS} \
41 ${BUILD_GTYPE} ${NO_PROG}
42
43# All these RTL objects needs common headers (tbc)
44${BUILD_RTL}: tm.h insn-modes.h insn-modes-inline.h gtype-desc.h insn-constants.h
45# All these programs use the RTL reader ($(BUILD_RTL)).
46${NO_RTL}: ${BUILD_RTL}
47# All these programs use the MD reader
48${NO_MD}: ${BUILD_MD}
49# All these programs need to report errors.
50${NO_PROGERR}: ${BUILD_ERRORS}
51
52.for f in ${genprogrtl}
53gen${f}.nx: ${BUILD_RTL}
54.endfor
55
56.for f in ${genprogmd}
57gen${f}.nx: ${BUILD_MD}
58.endfor
59
60.for f in ${genprogerr}
61gen${f}.nx: ${BUILD_ERRORS}
62.endfor
63
64.for f in ${genprog}
65GENTOOLS+= gen${f}.nx
66.endfor
67
68# For some reason, gcov-iov is an oddball
69GENTOOLS+= gcov-iov.nx
70NO_LIST+= gcov-iov.no
71
72gengtype.nx: ${BUILD_GTYPE}
73genmatch.nx: hash-table.no vec.no
74gencfn-macros.nx: hash-table.no vec.no ggc-none.no
75
76.for f in ${GENTOOLS}
77$f: ${f:.nx=.no} ${BUILD_LIBS_${f:R}} ${BUILD_LIBS}
78 ${NXCXX} ${NXCXXFLAGS:N-flto} ${NXLDFLAGS} ${.ALLSRC:M*.n[oa]} \
79 ${NXLD_${f:R}} -o ${.TARGET}
80.endfor
81
82.for nofile in ${NO_LIST}
83${nofile}: ${nofile:.no=.c}
84 ${NXCXX} ${NXCXXFLAGS:N-flto} -c ${.IMPSRC} -o ${.TARGET}
85.endfor
86
87gencheck.no: tm.h insn-constants.h
88gencondmd.no: insn-constants.h
89read-md.no: insn-modes.h insn-modes-inline.h
90gencfn-macros.no: insn-modes.h gtype-desc.h
91
92MD_DEPS= ${GCCDIR}/gcc/common.md ${md_file}
93MD_DEPS_PLUS= ${MD_DEPS} insn-conditions.md
94
95_MIC: .USE
96 ${MIC} ${.TARGET}.tmp ${.TARGET}
97_PL: .USE
98 ${.OBJDIR}/${.ALLSRC:M*.nx} > ${.TARGET}.tmp
99 ${MIC} ${.TARGET}.tmp ${.TARGET}
100_MD: .USE
101 ${.OBJDIR}/${.ALLSRC:M*.nx} ${MD_DEPS} > ${.TARGET}.tmp
102 ${MIC} ${.TARGET}.tmp ${.TARGET}
103
104simple_rtl_generated_h= insn-attr.h insn-attr-common.h insn-codes.h \
105 insn-config.h insn-flags.h insn-target-def.h
106simple_rtl_generated_c= insn-automata.c insn-emit.c insn-extract.c \
107 insn-output.c insn-peep.c insn-recog.c
108
109simple_generated_h= $(simple_rtl_generated_h) insn-constants.h
110simple_generated_c= $(simple_rtl_generated_c) insn-enums.c insn-preds.c
111
112.for f in ${simple_rtl_generated_h} ${simple_rtl_generated_c}
113. for generator in gen${f:R:S/^insn-//}.nx
114$f: ${generator} ${MD_DEPS_PLUS} _MIC
115 ${.OBJDIR}/${generator} ${MD_DEPS_PLUS} > ${.TARGET}.tmp
116. endfor
117.endfor
118
119insn-modes.h: genmodes.nx _MIC
120 ${.OBJDIR}/${.ALLSRC:M*.nx} -h > ${.TARGET}.tmp
121insn-modes-inline.h: genmodes.nx _MIC
122 ${.OBJDIR}/${.ALLSRC:M*.nx} -i > ${.TARGET}.tmp
123gtyp-input.list: _MIC
124 rm -f ${.TARGET}.tmp
125 for f in ${GTFILES}; do \
126 echo "$$f" >> ${.TARGET}.tmp; \
127 done
128gtype.state: gengtype.nx gtyp-input.list ${GTFILES:N[*]} _MIC
129 ${.OBJDIR}/${.ALLSRC:M*.nx} -S ${GCCDIR}/gcc -I ${.ALLSRC:M*.list} \
130 -w gtype.state.tmp
131gtype-desc.c gtype-desc.h: gengtype.nx gtype.state
132 ${.OBJDIR}/${.ALLSRC:M*.nx} -r gtype.state
133genrtl.h: gengenrtl.nx _MIC
134 ${.OBJDIR}/${.ALLSRC:M*.nx} > ${.TARGET}.tmp
135min-insn-modes.c: genmodes.nx _MIC
136 ${.OBJDIR}/${.ALLSRC:M*.nx} -m > ${.TARGET}.tmp
137tm-preds.h: genpreds.nx ${MD_DEPS} _MIC
138 ${.OBJDIR}/${.ALLSRC:M*.nx} -h ${MD_DEPS} > ${.TARGET}.tmp
139tm-constrs.h: genpreds.nx ${MD_DEPS} _MIC
140 ${.OBJDIR}/${.ALLSRC:M*.nx} -c ${MD_DEPS} > ${.TARGET}.tmp
141case-cfn-macros.h: gencfn-macros.nx _MIC
142 ${.OBJDIR}/${.ALLSRC:M*.nx} -c > ${.TARGET}.tmp
143cfn-operators.pd: gencfn-macros.nx _MIC
144 ${.OBJDIR}/${.ALLSRC:M*.nx} -o > ${.TARGET}.tmp
145insn-constants.h: genconstants.nx ${MD_DEPS} _MD
146insn-enums.c: genenums.nx ${MD_DEPS} _MD
147insn-preds.c: genpreds.nx ${MD_DEPS} _MD
148gencondmd.c: genconditions.nx ${MD_DEPS} tm-preds.h tm-constrs.h _MD
149insn-conditions.md: gencondmd.nx _PL
150insn-modes.c: genmodes.nx _PL
151tree-check.h: gencheck.nx _PL
152gcov-iov.h: gcov-iov.nx BASE-VER _MIC
153 ${.OBJDIR}/${.ALLSRC:M*.nx} '${GCCCOMPLETEVER}' '' > ${.TARGET}.tmp
154target-hooks-def.h: genhooks.nx _MIC
155 ${.OBJDIR}/${.ALLSRC:M*.nx} "Target Hook" > ${.TARGET}.tmp
156common/common-target-hooks-def.h: genhooks.nx _MIC
157 ${.OBJDIR}/${.ALLSRC:M*.nx} "Common Target Hook" > ${.TARGET}.tmp
158c-family/c-target-hooks-def.h: genhooks.nx _MIC
159 ${.OBJDIR}/${.ALLSRC:M*.nx} "C Target Hook" > ${.TARGET}.tmp
160stamp-opinit: genopinit.nx ${MD_DEPS_PLUS}
161 ${.OBJDIR}/${.ALLSRC:M*.nx} ${.ALLSRC:M*.md} \
162 -hinsn-opinit.h.tmp -cinsn-opinit.c.tmp
163 ${MIC} insn-opinit.h.tmp insn-opinit.h
164 ${MIC} insn-opinit.c.tmp insn-opinit.c
165 touch stamp-opinit
166stamp-tabs: genattrtab.nx ${MD_DEPS_PLUS}
167 ${.OBJDIR}/${.ALLSRC:M*.nx} ${.ALLSRC:M*.md} \
168 -Ainsn-attrtab.c.tmp -Dinsn-dfatab.c.tmp \
169 -Linsn-latencytab.c.tmp
170 ${MIC} insn-attrtab.c.tmp insn-attrtab.c
171 ${MIC} insn-dfatab.c.tmp insn-dfatab.c
172 ${MIC} insn-latencytab.c.tmp insn-latencytab.c
173 touch stamp-tabs
174gimple-match.c: genmatch.nx match.pd cfn-operators.pd gimple-match-head.c _MIC
175 ${.OBJDIR}/${.ALLSRC:M*.nx} --gimple ${GCCDIR}/gcc/match.pd \
176 > ${.TARGET}.tmp
177generic-match.c: genmatch.nx match.pd cfn-operators.pd generic-match-head.c _MIC
178 ${.OBJDIR}/${.ALLSRC:M*.nx} --generic ${GCCDIR}/gcc/match.pd \
179 > ${.TARGET}.tmp
180genmatch.c hash-table.c: gtype-desc.h
181
182pass-instances.def: ${GCCDIR}/gcc/passes.def $(PASSES_EXTRA)
183 /usr/bin/awk -f ${GCCDIR}/gcc/gen-pass-instances.awk \
184 ${.ALLSRC} > ${.TARGET}
185
186# XXX plain cpp(1) safe? also /usr/bin/awk?
187params.list: ${GCCDIR}/gcc/params-list.h ${GCCDIR}/gcc/params.def
188 cpp ${GCCDIR}/gcc/params-list.h | sed 's/^#.*//;/^$$/d' \
189 > tmp-params.list
190 ${MIC} tmp-params.list params.list
191
192params.options: ${GCCDIR}/gcc/params-options.h ${GCCDIR}/gcc/params.def
193 cpp ${GCCDIR}/gcc/params-options.h | sed 's/^#.*//;/^$$/d' \
194 > tmp-params.options
195 ${MIC} tmp-params.options params.options
196
197# This is gold, don't ask.
198gengtype-lex.c: gengtype-lex.l ${LEX_HEAD}
199 ${LEX} ${LFLAGS} -o${.TARGET}.tmp ${.IMPSRC}
200 cat ${LEX_HEAD} ${.TARGET}.tmp > ${.TARGET}
201
202GENFILES= ${simple_generated_h} ${simple_generated_c} \
203 tree-check.h genrtl.h insn-modes.h insn-modes-inline.h \
204 tm-preds.h tm-constrs.h \
205 gtype-desc.c gtype-desc.h gcov-iov.h target-hooks-def.h \
206 common/common-target-hooks-def.h pass-instances.def \
207 c-family/c-target-hooks-def.h min-insn-modes.c \
208 insn-modes.c insn-constants.h insn-conditions.md \
209 gencondmd.c gimple-match.c generic-match.c \
210 case-cfn-macros.h cfn-operators.pd \
211 params.list params.options \
212 stamp-opinit stamp-tabs
213
214CLEANFILES+= ${GENTOOLS} ${NO_LIST}
215CLEANFILES+= gengtype-lex.c gengtype-lex.c.tmp
216CLEANFILES+= ${GENFILES} gtyp-input.list gtype.state
217CLEANFILES+= gt-* gtype-*.h pass-instances.def
218CLEANFILES+= insn-opinit.[ch] insn-*tab.c
219CLEANFILES+= params.list params.options tmp-params.list tmp-params.options
220CLEANDIRS+= common c-family
221
222dossier:
223 mkdir -p common c-family
224
225genfiles: dossier ${GENTOOLS} ${GENFILES}
226depend all: genfiles
227
228.include <bsd.obj.mk>
229.include <bsd.dep.mk>
230.include <bsd.sys.mk>