1 # $NetBSD: Makefile,v 1.13 2008/10/25 22:27:35 apb Exp $
7 SRCS
= ${G_OBJS
:.o
=.c
} ${G_out_file
:T
}
9 CPPFLAGS
+= -I.
-I
${GCCARCH} ${G_ALL_CFLAGS
:M-D
*} ${G_INCLUDES
:M-I
*:N-I.
*} \
10 -DTARGET_NAME
=\"${MACHINE_GNU_PLATFORM}\"
11 HOST_CPPFLAGS
+= -I.
-I
${GCCARCH} ${G_ALL_CFLAGS
:M-D
*} ${G_INCLUDES
:M-I
*:N-I.
*}
12 DPSRCS
+= insn-attr.h insn-codes.h insn-config.h insn-flags.h tree-check.h
13 CPPFLAGS.
prefix.c
+= -DPREFIX
=\"/usr
\"
18 EXTRADEPENDSEARLY
= ${G_BUILD_EARLY_SUPPORT
:.o
=.lo
} ${G_BUILD_RTL
:.o
=.lo
} \
19 ${G_BUILD_ERRORS
:.o
=.lo
}
21 # Don't auto-frob .y or .l files.
26 # Independent generation programs.
28 CLEANFILES
+= gengenrtl genrtl.c genrtl.h \
29 gengtype gtyp-gen.h gtype-desc.c gtype-desc.h \
30 gtype-c.h gtype-cp.h gtype-f.h gtype-objc.h \
32 gencheck tree-check.h \
33 insn-preds.c genpreds tm-preds.h tm_p.h cs-tm_p.h \
34 genmodes insn-modes.c insn-modes.h min-insn-modes.c \
35 auto-host.h build-print-rtl.c \
36 build-rtl.c build-errors.c build-varray.c \
37 build-bitmap.c build-ggc-none.c \
43 # These files have special needs
46 build-errors build-ggc-none build-print-rtl build-rtl build-varray dummy-conditions gcov-iov genattr genattrtab genautomata gencheck genchecksum gencodes genconditions genconfig genconstants genemit genextract genflags gengenrtl gengtype gengtype-lex gengtype-yacc genmddeps genmodes genopinit genoutput genpeep genpreds genrecog gensupport insn-conditions min-insn-modes read-rtl
47 CPPFLAGS.
${f}.c
= -DGENERATOR_FILE
51 COPTS.varasm.c
= -Wno-error
54 # Headers that host objects depend on (except gen*rtl*)
55 HH_NORTL
= ${G_tm_file_list} ${G_build_xm_include_list}
56 HH
= ${HH_NORTL} genrtl.h insn-modes.h
59 # Generate the various header files we need.
63 .
/gengenrtl
>${.TARGET
}
66 .
/gengenrtl
-h
>${.TARGET
}
67 gengenrtl.lo
: ${HH_NORTL}
68 gengenrtl
: gengenrtl.lo build-errors.lo
70 ${HOST_LINK.c
} -o
${.TARGET
} ${.ALLSRC
} ${NBCOMPATLIB} ${HOSTLIBIBERTY}
72 tm-preds.h
: genpreds
${G_md_file}
74 .
/genpreds
-h
${G_md_file} >${.TARGET
}
75 insn-preds.c
: genpreds
${G_md_file}
77 .
/genpreds
${G_md_file} >${.TARGET
}
79 genpreds
: genpreds.lo
${EXTRADEPENDSEARLY}
81 ${HOST_LINK.c
} -o
${.TARGET
} ${.ALLSRC
} ${NBCOMPATLIB} ${HOSTLIBIBERTY}
83 tree-check.h
: gencheck
85 .
/gencheck
>${.TARGET
}
89 ${HOST_LINK.c
} -o
${.TARGET
} ${.ALLSRC
} ${NBCOMPATLIB} ${HOSTLIBIBERTY}
91 gtype-desc.c
: gtype-desc.h
92 gtype-desc.h
: gengtype
95 ln
-s
${.CURDIR
}/..
/arch
/${MACHINE_ARCH}/auto-host.h .
97 # gengtype is the real need for options.h
98 gengtype.lo gengtype-lex.lo gengtype-yacc.lo
: ${HH} gtyp-gen.h config.h options.h
99 gengtype
: gengtype.lo gengtype-lex.lo gengtype-yacc.lo build-errors.lo
101 ${HOST_LINK.c
} -o
${.TARGET
} ${.ALLSRC
} ${NBCOMPATLIB} ${HOSTLIBIBERTY}
106 echo
"static const char *srcdir = \"$(G_GTFILES_SRCDIR)\";" ; \
107 echo
"static const char *lang_files[] = {" ; \
108 for f in
$(G_GTFILES_FILES_FILES
); do echo
"\"$$f\", "; done
; \
110 echo
"static const char *langs_for_lang_files[] = {" ; \
111 for f in
$(G_GTFILES_FILES_LANGS
); do echo
"\"$$f\", "; done
; \
113 echo
"static const char *all_files[] = {" ; \
114 for f in
$(G_GTFILES
); do echo
"\"$$f\", "; done
; \
116 echo
"static const char *lang_dir_names[] = {" ; \
118 for f in
$(G_GTFILES_LANG_DIR_NAMES
); do echo
"\"$$f\", "; done
; \
122 insn-modes.c
: genmodes
124 .
/genmodes
>${.TARGET
}
125 insn-modes.h
: genmodes
127 .
/genmodes
-h
>${.TARGET
}
128 min-insn-modes.c
: genmodes
130 .
/genmodes
-m
>${.TARGET
}
131 genmodes.lo
: ${HH_NORTL}
132 genmodes
: genmodes.lo build-errors.lo
134 ${HOST_LINK.c
} -o
${.TARGET
} ${.ALLSRC
} ${NBCOMPATLIB} ${HOSTLIBIBERTY}
138 .
/gcov-iov
"${BASEVER}" "${DEVPHASE}" >${.TARGET
}
139 gcov-iov.lo
: ${HH_NORTL}
140 gcov-iov
: gcov-iov.lo
142 ${HOST_LINK.c
} -o
${.TARGET
} ${.ALLSRC
} ${NBCOMPATLIB} ${HOSTLIBIBERTY}
145 # ${_MKTARGET_CREATE}
146 # TM_DEFINES="$(G_tm_defines)" \
147 # HEADERS="$(G_host_xm_file)" XM_DEFINES="$(G_host_xm_defines)" \
148 # TARGET_CPU_DEFAULT="$(G_target_cpu_default)" \
149 # ${HOST_SH} ${GNUHOSTDIST}/gcc/mkconfig.sh ${.TARGET}
153 TARGET_CPU_DEFAULT
="" \
154 HEADERS
="$(G_tm_p_include_list)" DEFINES
="" \
155 ${HOST_SH} ${GNUHOSTDIST}/gcc
/mkconfig.sh
${.TARGET
}
157 CLEANFILES
+= options.h options.c optionlist
158 optionlist
: ${G_ALL_OPT_FILES} ${GCCARCH}/defs.mk Makefile
${DIST}/gcc
/opt-gather.awk
159 ${TOOL_AWK} -f
${DIST}/gcc
/opt-gather.awk
${G_ALL_OPT_FILES} > ${.TARGET
}
161 options.c
: optionlist
${DIST}/gcc
/opt-functions.awk
${DIST}/gcc
/optc-gen.awk
162 ${TOOL_AWK} -f
${DIST}/gcc
/opt-functions.awk
-f
${DIST}/gcc
/optc-gen.awk \
163 -v header_name
="config.h system.h coretypes.h tm.h" < optionlist
> ${.TARGET
}
165 options.h
: optionlist
${DIST}/gcc
/opt-functions.awk
${DIST}/gcc
/opth-gen.awk
166 ${TOOL_AWK} -f
${DIST}/gcc
/opt-functions.awk
-f
${DIST}/gcc
/opth-gen.awk \
167 < optionlist
> ${.TARGET
}
169 options.o
: options.c coretypes.h opts.h intl.h
170 #options.o: options.c ${G_CONFIG_H} ${G_SYSTEM_H} coretypes.h ${G_TM_H} opts.h intl.h
172 # Yuck, we have to run configure to generate this one...
173 CLEANFILES
+= auto-build.h
174 auto-build.h
: Makefile
180 CC
=${HOST_CC
:Q
} CFLAGS
=${HOST_CFLAGS
:Q
} \
182 CONFIG_SHELL
=${HOST_SH
:Q
} \
183 ${HOST_SH} ${GNUHOSTDIST}/gcc
/configure \
184 --build
=`${HOST_SH} ${GNUHOSTDIST}/config.guess` \
185 --host
=`${HOST_SH} ${GNUHOSTDIST}/config.guess` \
186 --target
=${MACHINE_GNU_PLATFORM} && \
187 mv auto-host.h ..
/auto-build.h
) && \
191 # These are copies of files we build for the build host that are used
192 # by the genfoo programs.
196 ${G_RTL_H} real.h
${G_GCC_H} errors.h gtype-desc.h
199 ${TOOL_SED} -e
's/<config[.]h/hconfig.h/' \
200 ${GNUHOSTDIST}/gcc
/rtl.c
>${.TARGET
}
203 build-print-rtl.c
: print-rtl.c \
204 ${G_RTL_H} ${G_TREE_H} hard-reg-set.h
${G_BASIC_BLOCK_H}
206 rm -f buid-print-rtl.c
207 ${TOOL_SED} -e
's/<config[.]h/hconfig.h/' \
208 ${GNUHOSTDIST}/gcc
/print-rtl.c
>${.TARGET
}
209 build-print-rtl.lo
: ${HH}
211 build-bitmap.c
: bitmap.c \
212 ${G_RTL_H} flags.h
${G_BASIC_BLOCK_H} ${REGS_H} ${G_GCC_H} gtype-desc.h
215 ${TOOL_SED} -e
's/<config[.]h/hconfig.h/' \
216 ${GNUHOSTDIST}/gcc
/bitmap.c
>${.TARGET
}
217 build-bitmap.lo
: ${HH}
219 build-errors.c
: errors.c errors.h
222 cat
${GNUHOSTDIST}/gcc
/errors.c
>${.TARGET
}
223 build-errors.lo
: ${HH_NORTL}
225 build-varray.c
: varray.c \
226 ${G_RTL_H} ${G_GCC_H} ${TREE_H} bitmap.h errors.h
229 ${TOOL_SED} -e
's/<config[.]h/hconfig.h/' \
230 ${GNUHOSTDIST}/gcc
/varray.c
>${.TARGET
}
231 build-varray.lo
: ${HH} gtype-desc.h
233 build-ggc-none.c
: ggc-none.c \
234 ${G_GCC_H} gtype-desc.h
236 rm -f build-ggc-none.c
237 ${TOOL_SED} -e
's/<config[.]h/hconfig.h/' \
238 ${GNUHOSTDIST}/gcc
/ggc-none.c
>${.TARGET
}
239 build-ggc-none.lo
: ${HH}
242 # The `early' insn-foo generators
244 .for f in conditions.c constants.h
245 CLEANFILES
+= gen
${f
:R
} insn-
${f}
247 gen
${f
:R
}.lo
: gen
${f
:R
}.c
${HH}
248 gen
${f
:R
}: gen
${f
:R
}.lo
${EXTRADEPENDSEARLY}
250 ${HOST_LINK.c
} -o
${.TARGET
} ${.ALLSRC
} ${NBCOMPATLIB} ${HOSTLIBIBERTY}
251 insn-
${f}: gen
${f
:R
} ${G_md_file}
253 .
/gen
${f
:R
} ${G_md_file} >${.TARGET
}
257 # The normal insn-foo generators
259 .for f in gensupport.c read-rtl.c dummy-conditions.c
263 EXTRADEPENDS
= ${G_BUILD_RTL
:.o
=.lo
} ${G_BUILD_SUPPORT
:.o
=.lo
} \
264 ${G_BUILD_PRINT
:.o
=.lo
} ${G_BUILD_ERRORS
:.o
=.lo
}
265 .for f in attr.h codes.h config.h emit.c extract.c flags.h opinit.c output.c \
267 CLEANFILES
+= gen
${f
:R
} insn-
${f}
270 gen
${f
:R
}: gen
${f
:R
}.lo
${EXTRADEPENDS}
272 ${HOST_LINK.c
} -o
${.TARGET
} ${.ALLSRC
} ${NBCOMPATLIB} ${HOSTLIBIBERTY}
273 insn-
${f}: gen
${f
:R
} ${G_md_file}
275 .
/gen
${f
:R
} ${G_md_file} >${.TARGET
}
279 # "One of these things is not like the other"
281 CLEANFILES
+= genattrtab insn-attrtab.c
282 genattrtab.lo
: ${HH} gtype-desc.h
283 genautomata.lo
: ${HH}
284 genattrtab
: genattrtab.lo genautomata.lo
${EXTRADEPENDS} ${G_BUILD_VARRAY
:.o
=.lo
}
286 ${HOST_LINK.c
} -o
${.TARGET
} ${.ALLSRC
} ${NBCOMPATLIB} ${HOSTLIBIBERTY} -lm
287 insn-attrtab.c
: genattrtab
${G_md_file}
289 .
/genattrtab
${G_md_file} >${.TARGET
}
292 # Required hard-coded dependancies.
294 genextract.lo
: insn-config.h
295 insn-conditions.lo
: insn-constants.h tm_p.h tm-preds.h
296 build-ggc-none.lo
: gtype-desc.h
297 ggc-none.o
: gtype-desc.h
299 insn-attrtab.o
: insn-config.h
300 insn-extract.o
: insn-config.h
301 toplev.d toplev.o
: options.h
302 coverage.d
: gcov-iov.h
303 gcov-io.h
: gcov-iov.h
305 COPTS
+=-Wno-stack-protector
307 .PATH
: ${DIST}/gcc
${DIST}/libiberty
${GCCARCH} ${G_out_file
:H
} ${DIST}/include