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