gcc80: Shorten build time in libraries target.
[dragonfly.git] / gnu / usr.bin / cc47 / cc_tools / tools / Makefile
1 .include "../Makefile.inc"
2 .include "../../Makefile.langs"
3
4 NXCFLAGS+=      -DGENERATOR_FILE -I${.OBJDIR}
5 NXLDLIBS+=      -lm
6
7 MIC= sh ${GCCDIR}/move-if-change
8
9 BUILD_LIBS=     ../libiberty/libiberty.na
10 BUILD_RTL=      rtl.no \
11                 read-rtl.no \
12                 ggc-none.no \
13                 vec.no \
14                 min-insn-modes.no \
15                 gensupport.no \
16                 print-rtl.no
17 BUILD_MD=       read-md.no
18 BUILD_ERRORS=   errors.no
19
20
21 ${BUILD_RTL}: tm.h insn-modes.h gtype-desc.h insn-constants.h
22
23 genprogrtl = attr attr-common attrtab automata codes conditions config emit \
24              extract flags opinit output peep preds recog
25 genprogmd  = $(genprogrtl) mddeps constants enums
26 genprogerr = $(genprogmd) genrtl modes gtype hooks
27
28 # All these programs use the RTL reader ($(BUILD_RTL)).
29 ${genprogrtl:S/^/gen/g:S/$/.no/g}: ${BUILD_RTL}
30 # All these programs use the MD reader
31 ${genprogmd:S/^/gen/g:S/$/.no/g}: ${BUILD_MD}
32 # All these programs need to report errors.
33 ${genprogerr:S/^/gen/g:S/$/.no/g}: ${BUILD_ERRORS}
34
35 .for f in ${genprogrtl}
36 gen${f}.nx: ${BUILD_RTL}
37 .endfor
38
39 .for f in ${genprogmd}
40 gen${f}.nx: ${BUILD_MD}
41 .endfor
42
43 .for f in ${genprogerr}
44 gen${f}.nx: ${BUILD_ERRORS}
45 GENTOOLS+= gen${f}.nx
46 .endfor
47
48 gengtype.nx: gengtype-lex.no gengtype-parse.no gengtype-state.no version.no
49
50 genattrtab.o ggc-none.no vec.no: gtype-desc.h
51
52 GENTOOLS+= gencheck.nx gencondmd.nx gcov-iov.nx genchecksum.nx
53
54 .for f in ${GENTOOLS}
55 $f: ${f:.nx=.no} ${BUILD_LIBS}
56         ${NXCC} ${NXCFLAGS} ${NXLDFLAGS} ${.ALLSRC:M*.n[oa]} ${NXLDLIBS} -o ${.TARGET}
57 .endfor
58
59 gencheck.no: tm.h insn-constants.h
60 gencondmd.no: tree-check.h insn-constants.h
61
62 CLEANFILES+=    ${GENTOOLS} ${GENTOOLS:.nx=.no}
63 CLEANFILES+=    gengtype-lex.c gengtype-lex.no gengtype-parse.no
64 CLEANFILES+=    gengtype-state.no version.no
65 CLEANFILES+=    ${BUILD_RTL} ${BUILD_MD} ${BUILD_ERRORS}
66
67
68 MD_DEPS=        ${md_file}
69
70 _MIC: .USE
71         ${MIC} ${.TARGET}.tmp ${.TARGET}
72 _PL: .USE
73         ${.OBJDIR}/${.ALLSRC:M*.nx} > ${.TARGET}.tmp
74         ${MIC} ${.TARGET}.tmp ${.TARGET}
75 _MD: .USE
76         ${.OBJDIR}/${.ALLSRC:M*.nx} ${md_file} > ${.TARGET}.tmp
77         ${MIC} ${.TARGET}.tmp ${.TARGET}
78
79 simple_generated_h = insn-attr.h insn-codes.h insn-config.h insn-flags.h \
80                      insn-attr-common.h
81
82 simple_generated_c = insn-attrtab.c insn-automata.c insn-emit.c \
83                      insn-extract.c insn-opinit.c insn-output.c \
84                      insn-peep.c insn-recog.c
85
86 .for f in ${simple_generated_h} ${simple_generated_c}
87 .for p in gen${f:R:S/^insn-//}.nx
88 $f: $p ${MD_DEPS} insn-conditions.md _MIC
89         ${.OBJDIR}/$p ${md_file} insn-conditions.md > ${.TARGET}.tmp
90 .endfor
91 .endfor
92
93 insn-constants.h: genconstants.nx ${MD_DEPS} _MD
94 tree-check.h: gencheck.nx _PL
95 gencondmd.c: genconditions.nx ${MD_DEPS} tm-preds.h tm-constrs.h _MD
96 insn-conditions.md: gencondmd.nx _PL
97 genrtl.c: gengenrtl.nx _PL
98 genrtl.h: gengenrtl.nx _MIC
99         ${.OBJDIR}/${.ALLSRC:M*.nx} -h > ${.TARGET}.tmp
100 insn-modes.c: genmodes.nx _PL
101 insn-modes.h: genmodes.nx _MIC
102         ${.OBJDIR}/${.ALLSRC:M*.nx} -h > ${.TARGET}.tmp
103 min-insn-modes.c: genmodes.nx _MIC
104         ${.OBJDIR}/${.ALLSRC:M*.nx} -m > ${.TARGET}.tmp
105 insn-preds.c: genpreds.nx _MD
106 insn-enums.c: genenums.nx _MD
107 tm-preds.h: genpreds.nx _MIC
108         ${.OBJDIR}/${.ALLSRC:M*.nx} -h ${md_file} > ${.TARGET}.tmp
109 tm-constrs.h: genpreds.nx _MIC
110         ${.OBJDIR}/${.ALLSRC:M*.nx} -c ${md_file} > ${.TARGET}.tmp
111 gtype.state: gengtype.nx gtyp-input.list ${GTFILES:N[*]} _MIC
112         ${.OBJDIR}/${.ALLSRC:M*.nx} -S ${GCCDIR}/gcc -I ${.ALLSRC:M*.list} \
113           -w gtype.state.tmp
114 gtype-desc.c gtype-desc.h: gengtype.nx gtype.state
115         ${.OBJDIR}/${.ALLSRC:M*.nx} -r gtype.state
116 gcov-iov.h: gcov-iov.nx BASE-VER _MIC
117         ${.OBJDIR}/${.ALLSRC:M*.nx} "$$(cat ${.ALLSRC:M*BASE-VER})" "" > ${.TARGET}.tmp
118 target-hooks-def.h: genhooks.nx _MIC
119         ${.OBJDIR}/${.ALLSRC:M*.nx} "Target Hook" > ${.TARGET}.tmp
120 c-family/c-target-hooks-def.h: genhooks.nx _MIC
121         ${.OBJDIR}/${.ALLSRC:M*.nx} "C Target Hook" > ${.TARGET}.tmp
122 common/common-target-hooks-def.h: genhooks.nx _MIC
123         ${.OBJDIR}/${.ALLSRC:M*.nx} "Common Target Hook" > ${.TARGET}.tmp
124
125 gtyp-input.list: _MIC
126         rm -f ${.TARGET}.tmp
127         for f in ${GTFILES}; do \
128                 echo "$$f" >> ${.TARGET}.tmp; \
129         done
130
131 GENFILES= \
132         ${simple_generated_h} ${simple_generated_c} \
133         insn-constants.h tree-check.h gencondmd.c insn-conditions.md \
134         genrtl.c genrtl.h insn-modes.c insn-modes.h min-insn-modes.c \
135         insn-preds.c tm-preds.h tm-constrs.h gtype-desc.c gtype-desc.h \
136         gcov-iov.h insn-enums.c target-hooks-def.h \
137         c-family/c-target-hooks-def.h \
138         common/common-target-hooks-def.h
139
140 CLEANFILES+=    ${GENFILES} gtyp-input.list gtype.state
141 CLEANFILES+=    gt-* gtype-*.h
142 CLEANDIRS+=     common c-family
143
144 dossier:
145         mkdir -p common c-family
146
147 .if defined(LIBGCC_ONLY)
148 genfiles: ${GENTOOLS:Mgcov-iov*} ${GENFILES:Mgcov-io*}
149 .else
150 genfiles: ${GENTOOLS} ${GENFILES}
151 .endif
152 depend all: dossier genfiles
153
154 .include <bsd.obj.mk>
155 .include <bsd.dep.mk>
156 .include <bsd.sys.mk>