Deleted Added
sdiff udiff text old ( 130325 ) new ( 132751 )
full compact
1# $FreeBSD: head/gnu/usr.bin/cc/cc_tools/Makefile 130325 2004-06-11 00:35:29Z peter $
2
3#
4# This could probably be merged with ../cc_int/Makefile, but bsd.lib.mk
5# is such a !@#!*#% nightmare because of how it reprograms the dependencies,
6# suffix rules, SRCS, etc. It's easiest to cheat by using bsd.prog.mk and
7# SRCS to get dependencies.
8#
9
10#
11# ../Makefile.inc will put an absolute path to our objdir in CFLAGS.
12# Prevent mkdep from using it, so that we don't have to give rules for
13# aliases of generated headers.
14#
15CFLAGS+= -I.
16
17.include "../Makefile.inc"
18
19.PATH: ${GCCDIR}
20
21CFLAGS+= -DGENERATOR_FILE
22
23#-----------------------------------------------------------------------
24# insn-* gunk
25
26.for F in attr codes config flags constants
27insn-$F.h: gen$F ${MD_FILE}
28 ./gen$F ${MD_FILE} > insn-$F.h
29GENSRCS+= insn-$F.h
30.endfor
31

--- 6 unchanged lines hidden (view full) ---

38GENSRCS+= gen-time-stamp
39gen-time-stamp: genattr genattrtab genconditions genconstants genemit \
40 genextract gengtype genopinit genoutput genpeep genrecog
41 touch ${.TARGET}
42
43.for F in attr codes config emit extract flags opinit output peep recog
44build-tools: gen$F
45
46gen$F: gen$F.o rtl.o obstack.o print-rtl.o bitmap.o errors.o gensupport.o \
47 ggc-none.o hashtab.o read-rtl.o concat.o insn-conditions.o
48 ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC}
49
50GENSRCS+= gen$F.c
51CLEANFILES+= gen$F
52.endfor
53
54#
55# genattrtab needs more complex build rule
56#
57build-tools: genattrtab
58
59genattrtab : genattrtab.o rtl.o obstack.o print-rtl.o bitmap.o errors.o \
60 gensupport.o ggc-none.o hashtab.o read-rtl.o concat.o \
61 insn-conditions.o genautomata.o varray.o getruntime.o
62 ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} -lm
63
64GENSRCS+= genattrtab.c
65CLEANFILES+= genattrtab
66
67#
68# genconstants and genconditions cannot depend on insn-conditions.o
69# they should be liked with dummy-conditions.o stubs instead
70#
71.for F in constants conditions
72build-tools: gen$F
73
74gen$F: gen$F.o rtl.o obstack.o bitmap.o errors.o gensupport.o \
75 ggc-none.o hashtab.o read-rtl.o concat.o dummy-conditions.o
76 ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC}
77
78GENSRCS+= gen$F.c
79CLEANFILES+= gen$F
80.endfor
81
82.for F in check genrtl preds
83build-tools: gen$F
84
85gen$F: gen$F.o
86 ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC}
87
88GENSRCS+= gen$F.c
89CLEANFILES+= gen$F
90.endfor
91
92.ORDER: genrtl.c genrtl.h
93genrtl.c genrtl.h: gengenrtl
94 ./gengenrtl > genrtl.c
95 ./gengenrtl -h > genrtl.h
96
97GENSRCS+= genrtl.c genrtl.h
98
99SRCS+= bitmap.c concat.c dummy-conditions.c errors.c genautomata.c \
100 gensupport.c getruntime.c ggc-none.c hashtab.c \
101 obstack.c physmem.c print-rtl.c read-rtl.c rtl.c varray.c xmemdup.c
102
103#-----------------------------------------------------------------------
104# Common parser stuff.
105
106tree-check.h: gencheck
107 ./gencheck > ${.TARGET}
108GENSRCS+= tree-check.h
109
110#-----------------------------------------------------------------------
111# Predicates stuff.

--- 19 unchanged lines hidden (view full) ---

131gengtype-yacc+%DIKED.c: gengtype-yacc.c
132 cat ${.ALLSRC} > ${.TARGET}
133 sed -e "s/xmalloc/malloc/g" \
134 -e "s/xrealloc/realloc/g" \
135 -e "s/malloc/xmalloc/g" \
136 -e "s/realloc/xrealloc/g" \
137 ${.ALLSRC} > ${.TARGET}
138
139gengtype: gengtype.o gengtype-yacc+%DIKED.o gengtype-lex.o xmemdup.o
140 ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC}
141
142GENSRCS+= gengtype.c
143CLEANFILES+= gengtype
144
145gengtype-lex.o: gengtype-yacc.h
146
147.ORDER: gtype-desc.c gtype-desc.h
148gtype-desc.c gtype-desc.h: gtype-time-stamp
149 @true
150
151GENSRCS+= gtype-time-stamp
152gtype-time-stamp: gengtype ${GTFILES}
153 ./gengtype
154 touch ${.TARGET}
155
156GENSRCS+= gtype-desc.c gtype-desc.h
157CLEANFILES+= gt-*.h gtype-*.h
158
159#-----------------------------------------------------------------------
160# Determine content of variables used by the target/host config files
161
162#
163# The list of headers to go into tconfig.h
164#
165TARGET_INC= ansidecl.h
166TARGET_INC+= ${GCC_CPU}/${GCC_CPU}.h
167.if ${TARGET_ARCH} == "i386" || ${TARGET_ARCH} == "amd64"
168TARGET_INC+= ${GCC_CPU}/unix.h
169TARGET_INC+= ${GCC_CPU}/att.h
170.endif
171.if ${TARGET_ARCH} != "alpha"
172TARGET_INC+= dbxelf.h
173TARGET_INC+= elfos.h

--- 10 unchanged lines hidden (view full) ---

184.endif
185.endif
186TARGET_INC+= ${GCC_CPU}/freebsd.h
187.if ${TARGET_ARCH} == "amd64"
188TARGET_INC+= ${GCC_CPU}/x86-64.h
189TARGET_INC+= ${GCC_CPU}/freebsd64.h
190TARGET_INC+= freebsd64-fix.h
191.endif
192TARGET_INC+= defaults.h
193
194#
195# Use TARGET_INC as a template and build a list of target specific
196# include files for gengtype to scan
197#
198GCONFIG_H= ${.OBJDIR}/tconfig.h ${.CURDIR}/auto-host.h
199
200.for H in ${TARGET_INC}
201.for D in ${GCCDIR}/config ${GCCDIR} ${.CURDIR}
202.if exists($D/$H)
203GCONFIG_H+= $D/$H
204.endif
205.endfor
206.endfor
207
208#
209# Define some variables to make blocks copied from Makefile.in happy
210#
211srcdir= ${GCCDIR}
212HASHTAB_H= ${GCCDIR}/hashtab.h
213out_file= ${GCCDIR}/config/${GCC_CPU}/${GCC_CPU}.c
214GTFILES_SRCDIR= ${GCCDIR}
215
216#
217# Copied unchanged from gcc/Makefile.in
218#
219GTFILES = $(GCONFIG_H) $(srcdir)/location.h \
220 $(HASHTAB_H) \
221 $(srcdir)/bitmap.h $(srcdir)/function.h $(srcdir)/rtl.h $(srcdir)/optabs.h \
222 $(srcdir)/tree.h $(srcdir)/libfuncs.h $(srcdir)/hashtable.h $(srcdir)/real.h \
223 $(srcdir)/varray.h $(srcdir)/ssa.h $(srcdir)/insn-addr.h $(srcdir)/cselib.h \
224 $(srcdir)/c-common.h $(srcdir)/c-tree.h \
225 $(srcdir)/basic-block.h \
226 $(srcdir)/alias.c $(srcdir)/bitmap.c $(srcdir)/cselib.c \
227 $(srcdir)/dwarf2out.c $(srcdir)/emit-rtl.c \
228 $(srcdir)/except.c $(srcdir)/explow.c $(srcdir)/expr.c \
229 $(srcdir)/fold-const.c $(srcdir)/function.c \
230 $(srcdir)/gcse.c $(srcdir)/integrate.c $(srcdir)/lists.c $(srcdir)/optabs.c \
231 $(srcdir)/profile.c $(srcdir)/ra-build.c $(srcdir)/regclass.c \
232 $(srcdir)/reg-stack.c \
233 $(srcdir)/sdbout.c $(srcdir)/stmt.c $(srcdir)/stor-layout.c \
234 $(srcdir)/tree.c $(srcdir)/varasm.c \
235 $(out_file)
236
237#
238# Build a list of frontend directories to look into
239#
240GTFILES_LANG_DIR_NAMES=
241
242.if !defined(NO_CXX)
243GTFILES_LANG_DIR_NAMES+= cp

--- 22 unchanged lines hidden (view full) ---

266GTFILES_LANGS+= $L
267.endfor
268.endfor
269GTFILES+= ${GTFILES_FILES}
270
271#-----------------------------------------------------------------------
272# the host/target compiler config.
273
274COMMONHDRS= config.h hconfig.h multilib.h options.h specs.h tconfig.h \
275 tm_p.h configargs.h safe-ctype.h
276GENSRCS+= ${COMMONHDRS} gencheck.h gtyp-gen.h
277
278MFILE?= ${.CURDIR}/Makefile
279${COMMONHDRS}: ${MFILE}
280
281configargs.h:
282 echo 'static const char configuration_arguments[] =' > ${.TARGET}
283 echo ' "FreeBSD/${TARGET_ARCH} system compiler";' >> ${.TARGET}
284 echo 'static const char thread_model[] = "posix";' >> ${.TARGET}
285
286hconfig.h:
287 echo '#include "auto-host.h"' > ${.TARGET}
288 echo '#include <tconfig.h>' >> ${.TARGET}
289
290gencheck.h:
291 echo '#include "cp/cp-tree.def"' > ${.TARGET}
292 echo '#include "objc/objc-tree.def"' >> ${.TARGET}
293
294multilib.h:
295 echo 'static const char *const multilib_raw[] = { \
296 "aout maout;", "elf !maout;", NULL };' > ${.TARGET}
297 echo 'static const char *const multilib_matches_raw[] = { \
298 "maout maout;", "melf melf;", NULL };' >> ${.TARGET}
299 echo 'static const char *multilib_extra = "";' >> ${.TARGET}
300 echo 'static const char *multilib_options = "";'>> ${.TARGET}
301 echo 'static const char *const multilib_exclusions_raw[] = { \
302 NULL };' >> ${.TARGET}
303
304options.h:
305 echo '#include "cp/lang-options.h"' > ${.TARGET}
306 echo '#include "f/lang-options.h"' >> ${.TARGET}
307 echo '#include "objc/lang-options.h"' >> ${.TARGET}
308
309specs.h:
310 echo '#include "cp/lang-specs.h"' > ${.TARGET}
311 echo '#include "f/lang-specs.h"' >> ${.TARGET}
312 echo '#include "objc/lang-specs.h"' >> ${.TARGET}
313
314config.h:
315 echo '#include <hconfig.h>' > ${.TARGET}
316 echo '#ifndef GENERATOR_FILE' >> ${.TARGET}
317 echo '#include "insn-constants.h"' >> ${.TARGET}
318 echo '#include "insn-flags.h"' >> ${.TARGET}
319 echo '#endif' >> ${.TARGET}
320
321tconfig.h:
322 echo 'struct rtx_def;' > ${.TARGET}
323 echo 'typedef struct rtx_def *rtx;' >> ${.TARGET}
324 echo 'struct rtvec_def;' >> ${.TARGET}
325 echo 'typedef struct rtvec_def *rtvec;' >> ${.TARGET}
326 echo 'union tree_node;' >> ${.TARGET}
327 echo 'typedef union tree_node *tree;' >> ${.TARGET}
328 echo '#ifndef GTY' >> ${.TARGET}
329 echo '# define GTY(x)' >> ${.TARGET}
330 echo '#endif' >> ${.TARGET}
331 echo '' >> ${.TARGET}
332.if ${TARGET_ARCH} == "amd64"
333 echo '#include "i386/biarch64.h"' >> ${.TARGET}
334.endif
335.if ${TARGET_ARCH} == "ia64"
336 echo '#define TARGET_CPU_DEFAULT (MASK_GNU_AS|MASK_GNU_LD)' >>${.TARGET}
337.endif
338.for H in ${TARGET_INC}
339 echo '#include "$H"' >> ${.TARGET}
340.endfor
341 echo '#ifndef POSIX' >> ${.TARGET}
342 echo '# define POSIX' >> ${.TARGET}
343 echo '#endif' >> ${.TARGET}
344.if exists(${GCCDIR}/config/${GCC_CPU}/${GCC_CPU}-modes.def)
345 echo '#define EXTRA_MODES_FILE "${GCC_CPU}/${GCC_CPU}-modes.def"' >> ${.TARGET}
346 echo '#define EXTRA_CC_MODES 1' >> ${.TARGET}
347.endif
348
349tm_p.h:
350 echo '#include "${GCC_CPU}/${GCC_CPU}-protos.h"' >> ${.TARGET}
351 echo '#include "tm-preds.h"' >> ${.TARGET}
352
353safe-ctype.h: Makefile
354 echo '#include <ctype.h>' > ${.TARGET}
355.for Z in TOUPPER TOLOWER ISDIGIT ISXDIGIT ISUPPER ISLOWER ISALPHA ISALNUM \
356 ISSPACE ISPUNCT ISGRAPH ISBLANK ISPRINT ISCNTRL
357 echo '#define ${Z} ${Z:L}' >> ${.TARGET}
358.endfor
359 echo "#define ISIDST(x) \
360 ((x) == '_' || isalpha(x))" >> ${.TARGET}
361 echo "#define ISIDNUM(x) \

--- 24 unchanged lines hidden (view full) ---

386 echo "\"$F\", " >> ${.TARGET}
387.endfor
388 echo "NULL};" >> ${.TARGET}
389 echo "static const char *lang_dir_names[] = { \"c\", " >> ${.TARGET}
390.for F in ${GTFILES_LANG_DIR_NAMES}
391 echo "\"$F\", " >> ${.TARGET}
392.endfor
393 echo "NULL};" >> ${.TARGET}
394 echo "#define xexit exit" >> ${.TARGET}
395
396
397#-----------------------------------------------------------------------
398# General things.
399
400SRCS+= ${GENSRCS}
401CLEANFILES+= ${GENSRCS}
402
403all: ${SRCS}
404
405.include <bsd.prog.mk>
406
407#-----------------------------------------------------------------------
408# Fixups.
409
410# Set OBJS the same as bsd.prog.mk would do if we defined PROG. We can't
411# define PROG because we have multiple programs.
412#
413OBJS+= ${SRCS:N*.h:R:S/$/.o/g}
414CLEANFILES+= ${OBJS}
415
416.if !exists(${DEPENDFILE})
417# Fudge pre-dependfile dependencies of objects in much the same way as
418# bsd.prog.mk would do if we defined PROG. There are complications to
419# avoid circular dependencies. First, only make most objects depend on
420# all headers. Filter out the objects that would cause problems (i.e.,
421# objects that will be used to create programs that will generate headers).
422#
423${OBJS}: ${SRCS:M*.h:Ngtype-desc.h:Ngenrtl.h:Ntree-check.h:Ntm-preds.h:Ninsn-*.h}
424
425${OBJS:Ngencheck.o:Ngengenrtl.o:Ngenpreds.o}: tree-check.h tm-preds.h genrtl.h
426
427${OBJS:Ngengtype*.o:Nxmemdup.o:Ngengenrtl.o:Ngencheck.o:Ngenpreds.o}: gtype-desc.h
428
429genextract.o: insn-config.h
430
431insn-conditions.o: insn-constants.h
432
433.endif