gcc4X: rework some makefiles
[dragonfly.git] / gnu / usr.bin / cc44 / 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 read-rtl.no ggc-none.no vec.no \
11                 min-insn-modes.no gensupport.no print-rtl.no
12 BUILD_ERRORS=   errors.no
13
14
15 ${BUILD_RTL}: tm.h insn-modes.h gtype-desc.h
16
17
18 genprogmd = attr attrtab automata codes conditions config constants emit \
19             extract flags mddeps opinit output peep preds recog
20 .for f in ${genprogmd}
21 gen$f.nx: ${BUILD_RTL} ${BUILD_ERRORS}
22 GENTOOLS+=      gen$f.nx
23 .endfor
24 gengenrtl.nx: ${BUILD_ERRORS}
25 genmodes.nx: ${BUILD_ERRORS}
26 gengtype.nx: gengtype-lex.no gengtype-parse.no ${BUILD_ERRORS}
27
28 NEED_RTL=       support attr attrtab automata codes conditions config \
29                 constants emit extract flags mddeps opinit output peep \
30                 preds recog
31 ${NEED_RTL:S/^/gen/g:S/$/.no/g} print-rtl.no read-rtl.no: insn-modes.h
32
33 genattrtab.no ggc-none.no vec.no: gtype-desc.h
34
35
36 GENTOOLS+=      gengenrtl.nx genmodes.nx gengtype.nx gencheck.nx
37 GENTOOLS+=      gencondmd.nx gcov-iov.nx genchecksum.nx
38 .for f in ${GENTOOLS}
39 $f: ${f:.nx=.no} ${BUILD_LIBS}
40         ${NXCC} ${NXCFLAGS} ${NXLDFLAGS} ${.ALLSRC:M*.n[oa]} ${NXLDLIBS} -o ${.TARGET}
41 .endfor
42
43 gencondmd.no: tree-check.h insn-constants.h
44
45 CLEANFILES+=    ${GENTOOLS} ${GENTOOLS:.nx=.no}
46 CLEANFILES+=    gengtype-lex.c gengtype-lex.no gengtype-parse.no
47 CLEANFILES+=    ${BUILD_RTL} ${BUILD_ERRORS}
48
49
50 MD_DEPS=        ${md_file}
51
52 _MIC: .USE
53         ${MIC} ${.TARGET}.tmp ${.TARGET}
54 _PL: .USE
55         ${.OBJDIR}/${.ALLSRC:M*.nx} > ${.TARGET}.tmp
56         ${MIC} ${.TARGET}.tmp ${.TARGET}
57 _MD: .USE
58         ${.OBJDIR}/${.ALLSRC:M*.nx} ${md_file} > ${.TARGET}.tmp
59         ${MIC} ${.TARGET}.tmp ${.TARGET}
60
61 simple_generated_h = insn-attr.h insn-codes.h insn-config.h insn-flags.h
62
63 simple_generated_c = insn-attrtab.c insn-automata.c insn-emit.c \
64                      insn-extract.c insn-opinit.c insn-output.c \
65                      insn-peep.c insn-recog.c
66
67 .for f in ${simple_generated_h} ${simple_generated_c}
68 .for p in gen${f:R:S/^insn-//}.nx
69 $f: $p ${MD_DEPS} insn-conditions.md _MIC
70         ${.OBJDIR}/$p ${md_file} insn-conditions.md > ${.TARGET}.tmp
71 .endfor
72 .endfor
73
74 insn-constants.h: genconstants.nx ${MD_DEPS} _MD
75 tree-check.h: gencheck.nx _PL
76 gencondmd.c: genconditions.nx ${MD_DEPS} tm-preds.h tm-constrs.h _MD
77 insn-conditions.md: gencondmd.nx _PL
78 genrtl.c: gengenrtl.nx _PL
79 genrtl.h: gengenrtl.nx _MIC
80         ${.OBJDIR}/${.ALLSRC:M*.nx} -h > ${.TARGET}.tmp
81 insn-modes.c: genmodes.nx _PL
82 insn-modes.h: genmodes.nx _MIC
83         ${.OBJDIR}/${.ALLSRC:M*.nx} -h > ${.TARGET}.tmp
84 min-insn-modes.c: genmodes.nx _MIC
85         ${.OBJDIR}/${.ALLSRC:M*.nx} -m > ${.TARGET}.tmp
86 insn-preds.c: genpreds.nx _MD
87 tm-preds.h: genpreds.nx _MIC
88         ${.OBJDIR}/${.ALLSRC:M*.nx} -h ${md_file} > ${.TARGET}.tmp
89 tm-constrs.h: genpreds.nx _MIC
90         ${.OBJDIR}/${.ALLSRC:M*.nx} -c ${md_file} > ${.TARGET}.tmp
91 gtype-desc.c gtype-desc.h: gengtype.nx gtyp-input.list ${GTFILES:N[*]}
92         ${.OBJDIR}/${.ALLSRC:M*.nx} ${GCCDIR}/gcc ${.ALLSRC:M*.list}
93 gcov-iov.h: gcov-iov.nx BASE-VER _MIC
94         ${.OBJDIR}/${.ALLSRC:M*.nx} "$$(cat ${.ALLSRC:M*BASE-VER})" "" > ${.TARGET}.tmp
95
96 gtyp-input.list: _MIC
97         rm -f ${.TARGET}.tmp
98         for f in ${GTFILES}; \
99         do \
100                 echo "$$f" >> ${.TARGET}.tmp; \
101         done
102
103
104 GENFILES= \
105         ${simple_generated_h} ${simple_generated_c} \
106         insn-constants.h tree-check.h gencondmd.c insn-conditions.md \
107         genrtl.c genrtl.h insn-modes.c insn-modes.h min-insn-modes.c \
108         insn-preds.c tm-preds.h tm-constrs.h gtype-desc.c gtype-desc.h \
109         gcov-iov.h
110
111 CLEANFILES+=    ${GENFILES} gtyp-input.list
112 CLEANFILES+=    gt-* gtype-*.h
113
114 genfiles: ${GENTOOLS} ${GENFILES}
115 depend all: genfiles
116
117 .include <bsd.obj.mk>
118 .include <bsd.dep.mk>