gcc50: Trim sources that create empty objects.
[dragonfly.git] / gnu / usr.bin / cc50 / cc_tools / tools / Makefile
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
7 NXCXXFLAGS+=            -DGENERATOR_FILE -I${.OBJDIR}
8 BUILD_LIBS=             ../libiberty/libiberty.na
9 BUILD_LIBS_genmatch=    ../libcpp/libcpp.na
10 NXLD_genautomata=       -lm
11
12 MIC=            sh ${GCCDIR}/move-if-change
13
14 BUILD_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
21 BUILD_MD=       read-md.no
22 BUILD_ERRORS=   errors.no
23 BUILD_GTYPE=    gengtype-lex.no \
24                 gengtype-parse.no \
25                 gengtype-state.no \
26                 version.no
27 BUILD_MATCH=    hash-table.no
28
29 genprogrtl=     attr attr-common attrtab automata codes conditions config \
30                 emit extract flags opinit output peep preds recog mddump
31 genprogmd=      $(genprogrtl) mddeps constants enums
32 genprogerr=     $(genprogmd) genrtl modes gtype hooks match
33 genprog=        $(genprogerr) check checksum condmd
34
35 NO_RTL=         ${genprogrtl:S/^/gen/g:S/$/.no/g}
36 NO_MD=          ${genprogmd:S/^/gen/g:S/$/.no/g}
37 NO_PROGERR=     ${genprogerr:S/^/gen/g:S/$/.no/g}
38 NO_PROG=        ${genprog:S/^/gen/g:S/$/.no/g}
39 NO_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}
52 gen${f}.nx: ${BUILD_RTL}
53 .endfor
54
55 .for f in ${genprogmd}
56 gen${f}.nx: ${BUILD_MD}
57 .endfor
58
59 .for f in ${genprogerr}
60 gen${f}.nx: ${BUILD_ERRORS}
61 .endfor
62
63 .for f in ${genprog}
64 GENTOOLS+= gen${f}.nx
65 .endfor
66
67 # For some reason, gcov-iov is an oddball
68 GENTOOLS+=      gcov-iov.nx
69 NO_LIST+=       gcov-iov.no
70
71 gengtype.nx: ${BUILD_GTYPE}
72 genmatch.nx: ${BUILD_MATCH} vec.no
73
74 .for f in ${GENTOOLS}
75 $f: ${f:.nx=.no} ${BUILD_LIBS_${f:R}} ${BUILD_LIBS}
76         ${NXCXX} ${NXCXXFLAGS} ${NXLDFLAGS} ${.ALLSRC:M*.n[oa]} \
77                 ${NXLD_${f:R}} -o ${.TARGET}
78 .endfor
79
80 .for nofile in ${NO_LIST}
81 ${nofile}: ${nofile:.no=.c}
82         ${NXCXX} ${NXCXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
83 .endfor
84
85 gencheck.no: tm.h insn-constants.h
86 gencondmd.no: insn-constants.h
87
88 MD_DEPS=        ${GCCDIR}/gcc/common.md ${md_file}
89 MD_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
100 simple_rtl_generated_h= insn-attr.h insn-attr-common.h insn-codes.h \
101                         insn-config.h insn-flags.h
102 simple_rtl_generated_c= insn-automata.c insn-emit.c insn-extract.c \
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
108 simple_generated_h=     $(simple_rtl_generated_h) insn-constants.h
109 simple_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
118 insn-modes.h: genmodes.nx _MIC
119         ${.OBJDIR}/${.ALLSRC:M*.nx} -h > ${.TARGET}.tmp
120 gtyp-input.list: _MIC
121         rm -f ${.TARGET}.tmp
122         for f in ${GTFILES}; do \
123                 echo "$$f" >> ${.TARGET}.tmp; \
124         done
125 gtype.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
128 gtype-desc.c gtype-desc.h: gengtype.nx gtype.state
129         ${.OBJDIR}/${.ALLSRC:M*.nx} -r gtype.state
130 genrtl.h: gengenrtl.nx _MIC
131         ${.OBJDIR}/${.ALLSRC:M*.nx} > ${.TARGET}.tmp
132 min-insn-modes.c: genmodes.nx _MIC
133         ${.OBJDIR}/${.ALLSRC:M*.nx} -m > ${.TARGET}.tmp
134 tm-preds.h: genpreds.nx ${MD_DEPS} _MIC
135         ${.OBJDIR}/${.ALLSRC:M*.nx} -h ${MD_DEPS} > ${.TARGET}.tmp
136 tm-constrs.h: genpreds.nx ${MD_DEPS} _MIC
137         ${.OBJDIR}/${.ALLSRC:M*.nx} -c ${MD_DEPS} > ${.TARGET}.tmp
138 insn-constants.h:   genconstants.nx ${MD_DEPS} _MD
139 insn-enums.c:       genenums.nx ${MD_DEPS} _MD
140 insn-preds.c:       genpreds.nx ${MD_DEPS} _MD
141 gencondmd.c:        genconditions.nx ${MD_DEPS} tm-preds.h tm-constrs.h _MD
142 insn-conditions.md: gencondmd.nx _PL
143 insn-modes.c:       genmodes.nx _PL
144 tree-check.h:       gencheck.nx _PL
145 gcov-iov.h: gcov-iov.nx BASE-VER _MIC
146         ${.OBJDIR}/${.ALLSRC:M*.nx} '${GCCCOMPLETEVER}' '' > ${.TARGET}.tmp
147 target-hooks-def.h: genhooks.nx _MIC
148         ${.OBJDIR}/${.ALLSRC:M*.nx} "Target Hook" > ${.TARGET}.tmp
149 common/common-target-hooks-def.h: genhooks.nx _MIC
150         ${.OBJDIR}/${.ALLSRC:M*.nx} "Common Target Hook" > ${.TARGET}.tmp
151 c-family/c-target-hooks-def.h: genhooks.nx _MIC
152         ${.OBJDIR}/${.ALLSRC:M*.nx} "C Target Hook" > ${.TARGET}.tmp
153 stamp-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
159 stamp-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
167 gimple-match.c: genmatch.nx match.pd _MIC
168         ${.OBJDIR}/${.ALLSRC:M*.nx} --gimple ${GCCDIR}/gcc/match.pd \
169         > ${.TARGET}.tmp
170 generic-match.c: genmatch.nx match.pd _MIC
171         ${.OBJDIR}/${.ALLSRC:M*.nx} --generic ${GCCDIR}/gcc/match.pd \
172         > ${.TARGET}.tmp
173 genmatch.c hash-table.c: gtype-desc.h
174
175 pass-instances.def: ${GCCDIR}/gcc/passes.def
176         /usr/bin/awk -f ${GCCDIR}/gcc/gen-pass-instances.awk \
177                 ${.ALLSRC} > ${.TARGET}
178
179 GENFILES=       ${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
188 CLEANFILES+=    ${GENTOOLS} ${NO_LIST} gengtype-lex.c
189 CLEANFILES+=    ${GENFILES} gtyp-input.list gtype.state
190 CLEANFILES+=    gt-* gtype-*.h pass-instances.def
191 CLEANFILES+=    insn-opinit.[ch] insn-*tab.c
192 CLEANDIRS+=     common c-family
193
194 dossier:
195         mkdir -p common c-family
196
197 genfiles: dossier ${GENTOOLS} ${GENFILES}
198 depend all: genfiles
199
200 .include <bsd.obj.mk>
201 .include <bsd.dep.mk>