gcc47: Add DragonFly READMEs and world makefiles
[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 _MIC
73         ${.OBJDIR}/${.ALLSRC:M*.nx} > ${.TARGET}.tmp
74 _MD: .USE _MIC
75         ${.OBJDIR}/${.ALLSRC:M*.nx} ${md_file} > ${.TARGET}.tmp
76
77 simple_generated_h = insn-attr.h insn-codes.h insn-config.h insn-flags.h \
78                      insn-attr-common.h
79
80 simple_generated_c = insn-attrtab.c insn-automata.c insn-emit.c \
81                      insn-extract.c insn-opinit.c insn-output.c \
82                      insn-peep.c insn-recog.c
83
84 .for f in ${simple_generated_h} ${simple_generated_c}
85 .for p in gen${f:R:S/^insn-//}.nx
86 $f: $p ${MD_DEPS} insn-conditions.md _MIC
87         ${.OBJDIR}/$p ${md_file} insn-conditions.md > ${.TARGET}.tmp
88 .endfor
89 .endfor
90
91 insn-constants.h: genconstants.nx ${MD_DEPS} _MD
92 tree-check.h: gencheck.nx _PL
93 gencondmd.c: genconditions.nx ${MD_DEPS} tm-preds.h tm-constrs.h _MD
94 insn-conditions.md: gencondmd.nx _PL
95 genrtl.c: gengenrtl.nx _PL
96 genrtl.h: gengenrtl.nx _MIC
97         ${.OBJDIR}/${.ALLSRC:M*.nx} -h > ${.TARGET}.tmp
98 insn-modes.c: genmodes.nx _PL
99 insn-modes.h: genmodes.nx _MIC
100         ${.OBJDIR}/${.ALLSRC:M*.nx} -h > ${.TARGET}.tmp
101 min-insn-modes.c: genmodes.nx _MIC
102         ${.OBJDIR}/${.ALLSRC:M*.nx} -m > ${.TARGET}.tmp
103 insn-preds.c: genpreds.nx _MD
104 insn-enums.c: genenums.nx _MD
105 tm-preds.h: genpreds.nx _MIC
106         ${.OBJDIR}/${.ALLSRC:M*.nx} -h ${md_file} > ${.TARGET}.tmp
107 tm-constrs.h: genpreds.nx _MIC
108         ${.OBJDIR}/${.ALLSRC:M*.nx} -c ${md_file} > ${.TARGET}.tmp
109 gtype.state: gengtype.nx gtyp-input.list ${GTFILES:N[*]} _MIC
110         ${.OBJDIR}/${.ALLSRC:M*.nx} -S ${GCCDIR}/gcc -I ${.ALLSRC:M*.list} \
111           -w gtype.state.tmp
112 gtype-desc.c gtype-desc.h: gengtype.nx gtype.state
113         ${.OBJDIR}/${.ALLSRC:M*.nx} -r gtype.state
114 gcov-iov.h: gcov-iov.nx BASE-VER _MIC
115         ${.OBJDIR}/${.ALLSRC:M*.nx} "$$(cat ${.ALLSRC:M*BASE-VER})" "" > ${.TARGET}.tmp
116 target-hooks-def.h: genhooks.nx _MIC
117         ${.OBJDIR}/${.ALLSRC:M*.nx} "Target Hook" > ${.TARGET}.tmp
118 c-family/c-target-hooks-def.h: genhooks.nx _MIC
119         ${.OBJDIR}/${.ALLSRC:M*.nx} "C Target Hook" > ${.TARGET}.tmp
120 common/common-target-hooks-def.h: genhooks.nx _MIC
121         ${.OBJDIR}/${.ALLSRC:M*.nx} "Common Target Hook" > ${.TARGET}.tmp
122
123 gtyp-input.list: _MIC
124         rm -f ${.TARGET}.tmp
125         for f in ${GTFILES}; do \
126                 echo "$$f" >> ${.TARGET}.tmp; \
127         done
128
129 GENFILES= \
130         ${simple_generated_h} ${simple_generated_c} \
131         insn-constants.h tree-check.h gencondmd.c insn-conditions.md \
132         genrtl.c genrtl.h insn-modes.c insn-modes.h min-insn-modes.c \
133         insn-preds.c tm-preds.h tm-constrs.h gtype-desc.c gtype-desc.h \
134         gcov-iov.h insn-enums.c target-hooks-def.h \
135         c-family/c-target-hooks-def.h \
136         common/common-target-hooks-def.h
137
138 CLEANFILES+=    ${GENFILES} gtyp-input.list gtype.state
139 CLEANFILES+=    gt-* gtype-*.h
140 CLEANDIRS+=     common c-family
141
142 dossier:
143         mkdir -p common c-family
144
145 genfiles: ${GENTOOLS} ${GENFILES}
146 depend all: dossier genfiles
147
148 .include <bsd.obj.mk>
149 .include <bsd.dep.mk>