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.
4 .include "../Makefile.inc"
5 .include "../../Makefile.langs"
7 NXCXXFLAGS+= -DGENERATOR_FILE -I${.OBJDIR}
8 BUILD_LIBS= ../libiberty/libiberty.na
9 BUILD_LIBS_genmatch= ../libcpp/libcpp.na
12 MIC= sh ${GCCDIR}/move-if-change
22 BUILD_ERRORS= errors.no
23 BUILD_GTYPE= gengtype-lex.no \
27 BUILD_MATCH= hash-table.no
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
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}
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
48 # All these programs need to report errors.
49 ${NO_PROGERR}: ${BUILD_ERRORS}
51 .for f in ${genprogrtl}
52 gen${f}.nx: ${BUILD_RTL}
55 .for f in ${genprogmd}
56 gen${f}.nx: ${BUILD_MD}
59 .for f in ${genprogerr}
60 gen${f}.nx: ${BUILD_ERRORS}
67 # For some reason, gcov-iov is an oddball
68 GENTOOLS+= gcov-iov.nx
71 gengtype.nx: ${BUILD_GTYPE}
72 genmatch.nx: ${BUILD_MATCH} vec.no
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}
80 .for nofile in ${NO_LIST}
81 ${nofile}: ${nofile:.no=.c}
82 ${NXCXX} ${NXCXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
85 gencheck.no: tm.h insn-constants.h
86 gencondmd.no: insn-constants.h
88 MD_DEPS= ${GCCDIR}/gcc/common.md ${md_file}
89 MD_DEPS_PLUS= ${MD_DEPS} insn-conditions.md
92 ${MIC} ${.TARGET}.tmp ${.TARGET}
94 ${.OBJDIR}/${.ALLSRC:M*.nx} > ${.TARGET}.tmp
95 ${MIC} ${.TARGET}.tmp ${.TARGET}
97 ${.OBJDIR}/${.ALLSRC:M*.nx} ${MD_DEPS} > ${.TARGET}.tmp
98 ${MIC} ${.TARGET}.tmp ${.TARGET}
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
105 # only when HAVE_peephole (newer gcc will need it)
106 #simple_rtl_generated_c+= insn-peep.c
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
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
118 insn-modes.h: genmodes.nx _MIC
119 ${.OBJDIR}/${.ALLSRC:M*.nx} -h > ${.TARGET}.tmp
120 gtyp-input.list: _MIC
122 for f in ${GTFILES}; do \
123 echo "$$f" >> ${.TARGET}.tmp; \
125 gtype.state: gengtype.nx gtyp-input.list ${GTFILES:N[*]} _MIC
126 ${.OBJDIR}/${.ALLSRC:M*.nx} -S ${GCCDIR}/gcc -I ${.ALLSRC:M*.list} \
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
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
167 gimple-match.c: genmatch.nx match.pd _MIC
168 ${.OBJDIR}/${.ALLSRC:M*.nx} --gimple ${GCCDIR}/gcc/match.pd \
170 generic-match.c: genmatch.nx match.pd _MIC
171 ${.OBJDIR}/${.ALLSRC:M*.nx} --generic ${GCCDIR}/gcc/match.pd \
173 genmatch.c hash-table.c: gtype-desc.h
175 pass-instances.def: ${GCCDIR}/gcc/passes.def
176 /usr/bin/awk -f ${GCCDIR}/gcc/gen-pass-instances.awk \
177 ${.ALLSRC} > ${.TARGET}
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
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
195 mkdir -p common c-family
197 genfiles: dossier ${GENTOOLS} ${GENFILES}
200 .include <bsd.obj.mk>
201 .include <bsd.dep.mk>