Add the DragonFly cvs id and perform general cleanups on cvs/rcs/sccs ids. Most
[dragonfly.git] / gnu / usr.bin / cc / cc_tools / Makefile
1 # $FreeBSD: src/gnu/usr.bin/cc/cc_tools/Makefile,v 1.48.2.6 2002/06/20 23:13:31 obrien Exp $
2 # $DragonFly: src/gnu/usr.bin/cc/cc_tools/Attic/Makefile,v 1.2 2003/06/17 04:25:45 dillon Exp $
3
4 #
5 # This could probably be merged with ../cc_int/Makefile, but bsd.lib.mk
6 # is such a !@#!*#% nightmare because of how it reprograms the dependencies,
7 # suffix rules, SRCS, etc.  It's easiest to cheat by using bsd.prog.mk and
8 # SRCS to get dependencies.
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
15 CFLAGS+=        -I.
16 CFLAGS+=        -static
17
18 .include "../Makefile.inc"
19
20 .PATH: ${GCCDIR} ${GCCDIR}/cp
21
22 #-----------------------------------------------------------------------
23 # insn-* gunk
24
25 .for F in attr codes config flags
26 insn-$F.h: gen$F ${MD_FILE}
27         ./gen$F ${MD_FILE} > insn-$F.h
28 GENSRCS+=       insn-$F.h
29 .endfor
30
31 GENSRCS+=       gen-time-stamp
32 gen-time-stamp: genattrtab genemit genextract genopinit genoutput genpeep genrecog
33         touch ${.TARGET}
34
35 .for F in attr codes config emit extract flags opinit output peep recog
36 build-tools: gen$F
37
38 gen$F: gen$F.o rtl.o print-rtl.o obstack.o bitmap.o
39         ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC}
40
41 GENSRCS+=       gen$F.c
42 CLEANFILES+=    gen$F
43 .endfor
44
45 .for F in attrtab
46 build-tools: gen$F
47
48 gen$F: gen$F.o rtl.o rtlanal.o print-rtl.o obstack.o bitmap.o
49         ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC}
50
51 GENSRCS+=       gen$F.c
52 CLEANFILES+=    gen$F
53 .endfor
54
55 SRCS+=          bitmap.c obstack.c print-rtl.c rtl.c rtlanal.c
56
57 .for F in check genrtl
58 build-tools: gen$F
59
60 gen$F: gen$F.o
61         ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC}
62
63 GENSRCS+=       gen$F.c
64 CLEANFILES+=    gen$F
65 .endfor
66
67 .ORDER: genrtl.c genrtl.h
68 genrtl.c genrtl.h: gengenrtl
69         ./gengenrtl genrtl.h genrtl.c
70
71 GENSRCS+=       genrtl.c genrtl.h
72
73 #-----------------------------------------------------------------------
74 # C hash codes
75 c-gperf.h: c-parse.gperf
76         gperf -p -j1 -i 1 -g -o -t -G -N is_reserved_word -k1,3,$$ \
77             ${GCCDIR}/c-parse.gperf > ${.TARGET}
78 GENSRCS+=       c-gperf.h
79
80 #-----------------------------------------------------------------------
81 # C++ hash codes
82 gxx-hash.h: gxx.gperf
83         gperf -p -j1 -g -o -t -N is_reserved_word '-k1,4,7,$$' \
84             ${GCCDIR}/cp/gxx.gperf >gxx-hash.h
85 GENSRCS+=       gxx-hash.h
86
87 # make a link the the Cygnus used name for now -- hopes are they will change it
88 hash.h: gxx-hash.h
89         ln -sf ${.ALLSRC} ${.TARGET}
90 GENSRCS+=       hash.h
91
92 #-----------------------------------------------------------------------
93 # Common parser stuff.
94
95 tree-check.h: gencheck
96         ./gencheck > ${.TARGET}
97 GENSRCS+=       tree-check.h
98
99 #-----------------------------------------------------------------------
100 # the host/target compiler config.
101
102 COMMONHDRS=     config.h hconfig.h multilib.h options.h specs.h tconfig.h tm.h
103 GENSRCS+=       ${COMMONHDRS} gencheck.h
104
105 config.h hconfig.h:
106         echo '#include "auto-host.h"'                           > ${.TARGET}
107         echo '#include "gansidecl.h"'                           >> ${.TARGET}
108         echo '#include "${TARGET_ARCH}/xm-${TARGET_ARCH}.h"'    >> ${.TARGET}
109         echo '#include "hwint.h"'                               >> ${.TARGET}
110
111 gencheck.h:
112         echo '#include "cp/cp-tree.def"'                > ${.TARGET}
113         echo '#include "objc/objc-tree.def"'            >> ${.TARGET}
114
115 multilib.h:
116         echo 'static char *multilib_raw[] = { \
117             "aout maout;", "elf !maout;", NULL };'      > ${.TARGET}
118         echo 'static char *multilib_matches_raw[] = { \
119             "maout maout;", "melf melf;", NULL };'      >> ${.TARGET}
120         echo 'static char *multilib_extra = "";'        >> ${.TARGET}
121
122 options.h:
123         echo '#include "cp/lang-options.h"'             > ${.TARGET}
124         echo '#include "f/lang-options.h"'              >> ${.TARGET}
125
126 specs.h:
127         echo '#include "cp/lang-specs.h"'               > ${.TARGET}
128         echo '#include "f/lang-specs.h"'                >> ${.TARGET}
129         echo '#include "objc/lang-specs.h"'             >> ${.TARGET}
130
131 tconfig.h:
132         echo '#include "gansidecl.h"'                           > ${.TARGET}
133         echo '#include "${TARGET_ARCH}/xm-${TARGET_ARCH}.h"'    >> ${.TARGET}
134
135 # KEEP THIS IN SYNC with src/gcc/lib/libgcc/Makefile !!
136 tm.h:
137         echo '#include "${TARGET_ARCH}/${TARGET_ARCH}.h"'       > ${.TARGET}
138 .if ${TARGET_ARCH} == "i386"
139         echo '#include "${TARGET_ARCH}/att.h"'                  >> ${.TARGET}
140 .endif
141         echo '#include <freebsd.h>'                             >> ${.TARGET}
142         echo '#include "dbxelf.h"'                              >> ${.TARGET}
143 .if exists(${GCCDIR}/config/${TARGET_ARCH}/elf.h)
144         echo '#include "${TARGET_ARCH}/elf.h"'                  >> ${.TARGET}
145 .endif
146         echo '#include "${TARGET_ARCH}/freebsd.h"'              >> ${.TARGET}
147 .if ${TARGET_ARCH} == "i386"
148         echo '#include "${TARGET_ARCH}/perform.h"'              >> ${.TARGET}
149 .endif
150         echo '#include <freebsd-native.h>'                      >> ${.TARGET}
151
152 #-----------------------------------------------------------------------
153 # General things.
154
155 SRCS+=          ${GENSRCS}
156 CLEANFILES+=    ${GENSRCS}
157
158 all: ${SRCS}
159
160 build-tools: depend
161
162 .include <bsd.prog.mk>
163
164 #-----------------------------------------------------------------------
165 # Fixups.
166
167 # Set OBJS the same as bsd.prog.mk would do if we defined PROG.  We can't
168 # define PROG because we have multiple programs.
169 #
170 OBJS+=          ${SRCS:N*.h:R:S/$/.o/g}
171
172 .if !exists(${DEPENDFILE})
173 # Fudge pre-dependfile dependencies of objects in much the same way as
174 # bsd.prog.mk would do if we defined PROG.  There are complications to
175 # avoid circular dependencies.  First, only make most objects depend on
176 # all headers.  Filter out the objects that would cause problems (i.e.,
177 # objects that will be used to create programs that will generate headers).
178 #
179 ${OBJS:Nbitmap.o:Ngenattr.o:Ngencheck.o:Ngencodes.o:Ngenconfig.o:Ngenflags.o:Ngengenrtl.o:Nobstack.o:Nprint-rtl.o:Nrtl.o}: ${SRCS:M*.h}
180
181 # Next, make each of the problematic objects depend on only most headers.
182 # Filter out the headers that would cause problems (and a few more when it
183 # is inconvenient to filter precisely).
184 #
185 bitmap.o genattr.o gencodes.o genconfig.o genflags.o obstack.o print-rtl.o \
186     rtl.o: ${SRCS:M*.h:Ninsn-*.h}
187 gencheck.o: gencheck.h ${SRCS:M*.h:Ngenrtl.h:Ntree-check.h:Ninsn-*.h}
188 gengenrtl.o: ${SRCS:M*.h:Ngenrtl.h:Ninsn-*.h}
189 .endif