]>
Commit | Line | Data |
---|---|---|
8d08fdba | 1 | # Makefile for GNU C++ compiler. |
43f856ef | 2 | # Copyright (C) 1987, 88, 90-5, 1998, 1999 Free Software Foundation, Inc. |
8d08fdba MS |
3 | |
4 | #This file is part of GNU CC. | |
5 | ||
6 | #GNU CC is free software; you can redistribute it and/or modify | |
7 | #it under the terms of the GNU General Public License as published by | |
8 | #the Free Software Foundation; either version 2, or (at your option) | |
9 | #any later version. | |
10 | ||
11 | #GNU CC is distributed in the hope that it will be useful, | |
12 | #but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | #GNU General Public License for more details. | |
15 | ||
16 | #You should have received a copy of the GNU General Public License | |
17 | #along with GNU CC; see the file COPYING. If not, write to | |
de18aff3 RK |
18 | #the Free Software Foundation, 59 Temple Place - Suite 330, |
19 | #Boston, MA 02111-1307, USA. | |
8d08fdba | 20 | |
8e10b365 | 21 | # The makefile built from this file lives in the language subdirectory. |
de18aff3 | 22 | # Its purpose is to provide support for: |
8e10b365 DE |
23 | # |
24 | # 1) recursion where necessary, and only then (building .o's), and | |
25 | # 2) building and debugging cc1 from the language subdirectory, and | |
26 | # 3) nothing else. | |
27 | # | |
28 | # The parent makefile handles all other chores, with help from the | |
29 | # language makefile fragment, of course. | |
30 | # | |
31 | # The targets for external use are: | |
32 | # all, TAGS, ???mostlyclean, ???clean. | |
8d08fdba MS |
33 | |
34 | # Suppress smart makes who think they know how to automake Yacc files | |
35 | .y.c: | |
36 | ||
d62590d2 L |
37 | # It defines the c++ interface name. It should be changed when the |
38 | # c++ interface is changed. | |
bcaf90dc | 39 | INTERFACE = 2 |
d62590d2 | 40 | |
8d08fdba MS |
41 | # Variables that exist for you to override. |
42 | # See below for how to change them for certain systems. | |
43 | ||
0ac2a8ee | 44 | ALLOCA = |
8d08fdba MS |
45 | |
46 | # Various ways of specifying flags for compilations: | |
47 | # CFLAGS is for the user to override to, e.g., do a bootstrap with -O2. | |
48 | # BOOT_CFLAGS is the value of CFLAGS to pass | |
49 | # to the stage2 and stage3 compilations | |
50 | # XCFLAGS is used for most compilations but not when using the GCC just built. | |
51 | XCFLAGS = | |
52 | CFLAGS = -g | |
53 | BOOT_CFLAGS = -O $(CFLAGS) | |
54 | # These exists to be overridden by the x-* and t-* files, respectively. | |
55 | X_CFLAGS = | |
56 | T_CFLAGS = | |
57 | ||
58 | X_CPPFLAGS = | |
59 | T_CPPFLAGS = | |
60 | ||
0520f6c0 | 61 | CC = @CC@ |
b2fdd68c | 62 | BISON = `if [ -f ../../bison/bison ] ; then echo ../../bison/bison -L $(srcdir)/../../bison/ ; else echo bison ; fi` |
81cdf787 | 63 | BISONFLAGS = |
b0ccd8de | 64 | LEX = `if [ -f ../../flex/flex ] ; then echo ../../flex/flex ; else echo flex ; fi` |
8e10b365 | 65 | LEXFLAGS = |
8d08fdba | 66 | AR = ar |
8d08fdba MS |
67 | AR_FLAGS = rc |
68 | SHELL = /bin/sh | |
69 | MAKEINFO = makeinfo | |
70 | TEXI2DVI = texi2dvi | |
71 | ||
72 | # Define this as & to perform parallel make on a Sequent. | |
73 | # Note that this has some bugs, and it seems currently necessary | |
74 | # to compile all the gen* files first by hand to avoid erroneous results. | |
75 | P = | |
76 | ||
0ac2a8ee DE |
77 | # This is used in the definition of SUBDIR_USE_ALLOCA. |
78 | # ??? Perhaps it would be better if it just looked for *gcc*. | |
79 | OLDCC = cc | |
80 | ||
8d08fdba MS |
81 | # This is used instead of ALL_CFLAGS when compiling with GCC_FOR_TARGET. |
82 | # It omits XCFLAGS, and specifies -B./. | |
83 | # It also specifies -B$(tooldir)/ to find as and ld for a cross compiler. | |
84 | GCC_CFLAGS=$(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS) | |
85 | ||
86 | # Tools to use when building a cross-compiler. | |
87 | # These are used because `configure' appends `cross-make' | |
88 | # to the makefile when making a cross-compiler. | |
89 | ||
7e717196 JL |
90 | # We don't use cross-make. Instead we use the tools |
91 | # from the build tree, if they are available. | |
92 | # program_transform_name and objdir are set by configure.in. | |
93 | program_transform_name = | |
94 | objdir = . | |
95 | ||
0520f6c0 PB |
96 | target=@target@ |
97 | xmake_file=@dep_host_xmake_file@ | |
98 | tmake_file=@dep_tmake_file@ | |
8d08fdba MS |
99 | #version=`sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/' < $(srcdir)/version.c` |
100 | #mainversion=`sed -e 's/.*\"\([0-9]*\.[0-9]*\).*/\1/' < $(srcdir)/version.c` | |
101 | ||
102 | # Directory where sources are, from where we are. | |
0520f6c0 PB |
103 | srcdir = @srcdir@ |
104 | VPATH = @srcdir@ | |
8d08fdba | 105 | |
0ac2a8ee DE |
106 | # Additional system libraries to link with. |
107 | CLIB= | |
ab87f8c8 JL |
108 | |
109 | # Top build directory, relative to here. | |
110 | top_builddir = .. | |
111 | ||
112 | # Internationalization library. | |
113 | INTLLIBS = @INTLLIBS@ | |
0ac2a8ee | 114 | |
8d08fdba MS |
115 | # Change this to a null string if obstacks are installed in the |
116 | # system library. | |
117 | OBSTACK=obstack.o | |
118 | ||
8d08fdba MS |
119 | # Choose the real default target. |
120 | ALL=all | |
121 | ||
122 | # End of variables for you to override. | |
123 | ||
124 | # Definition of `all' is here so that new rules inserted by sed | |
125 | # do not specify the default target. | |
126 | all: all.indirect | |
127 | ||
128 | # This tells GNU Make version 3 not to put all variables in the environment. | |
129 | .NOEXPORT: | |
130 | ||
131 | # sed inserts variable overrides after the following line. | |
132 | ####target overrides | |
0520f6c0 | 133 | @target_overrides@ |
8d08fdba | 134 | ####host overrides |
0520f6c0 | 135 | @host_overrides@ |
8d08fdba | 136 | ####cross overrides |
0520f6c0 PB |
137 | @cross_defines@ |
138 | @cross_overrides@ | |
8d08fdba | 139 | ####build overrides |
0520f6c0 | 140 | @build_overrides@ |
6633d636 | 141 | #\f |
8d08fdba MS |
142 | # Now figure out from those variables how to compile and link. |
143 | ||
a73cab0f | 144 | all.indirect: Makefile ../cc1plus$(exeext) |
8d08fdba | 145 | |
7848c278 | 146 | # IN_GCC tells obstack.h that we are using gcc's <stddef.h> file. |
0520f6c0 | 147 | INTERNAL_CFLAGS = $(CROSS) -DIN_GCC @extra_c_flags@ |
8d08fdba MS |
148 | |
149 | # This is the variable actually used when we compile. | |
b2d352ba | 150 | ALL_CFLAGS = $(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS) $(XCFLAGS) -W -Wall |
8d08fdba MS |
151 | |
152 | # Likewise. | |
153 | ALL_CPPFLAGS = $(CPPFLAGS) $(X_CPPFLAGS) $(T_CPPFLAGS) | |
154 | ||
0ac2a8ee DE |
155 | # Even if ALLOCA is set, don't use it if compiling with GCC. |
156 | ||
8d08fdba | 157 | SUBDIR_OBSTACK = `if [ x$(OBSTACK) != x ]; then echo ../$(OBSTACK); else true; fi` |
0ac2a8ee | 158 | SUBDIR_USE_ALLOCA = `case "${CC}" in "${OLDCC}") if [ x$(ALLOCA) != x ]; then echo ../$(ALLOCA); else true; fi ;; esac` |
8d08fdba MS |
159 | SUBDIR_MALLOC = `if [ x$(MALLOC) != x ]; then echo ../$(MALLOC); else true; fi` |
160 | ||
161 | # How to link with both our special library facilities | |
162 | # and the system's installed libraries. | |
ab87f8c8 JL |
163 | LIBS = $(SUBDIR_OBSTACK) $(SUBDIR_USE_ALLOCA) $(SUBDIR_MALLOC) \ |
164 | $(INTLLIBS) $(CLIB) | |
8d08fdba | 165 | |
0ac2a8ee DE |
166 | # Specify the directories to be searched for header files. |
167 | # Both . and srcdir are used, in that order, | |
168 | # so that tm.h and config.h will be found in the compilation | |
169 | # subdirectory rather than in the source directory. | |
0c2e9d7a | 170 | INCLUDES = -I. -I.. -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../config -I$(srcdir)/../../include |
0ac2a8ee | 171 | |
8d08fdba MS |
172 | # Always use -I$(srcdir)/config when compiling. |
173 | .c.o: | |
174 | $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< | |
175 | ||
2addbe1d JM |
176 | # The only suffixes we want for implicit rules are .c and .o. |
177 | .SUFFIXES: | |
178 | .SUFFIXES: .c .o | |
179 | ||
8d08fdba MS |
180 | # This tells GNU make version 3 not to export all the variables |
181 | # defined in this file into the environment. | |
182 | .NOEXPORT: | |
6633d636 | 183 | #\f |
8d08fdba MS |
184 | # Lists of files for various purposes. |
185 | ||
186 | # Language-specific object files for g++ | |
187 | ||
188 | CXX_OBJS = call.o decl.o errfn.o expr.o pt.o sig.o typeck2.o \ | |
9e9ff709 | 189 | class.o decl2.o error.o lex.o parse.o ptree.o rtti.o spew.o typeck.o cvt.o \ |
276ca6ea | 190 | except.o friend.o init.o method.o search.o semantics.o tree.o xref.o \ |
f71f87f9 | 191 | repo.o dump.o @extra_cxx_objs@ |
8d08fdba | 192 | |
8d08fdba | 193 | # Language-independent object files. |
fe9b4957 MM |
194 | OBJS = `cat ../stamp-objlist` ../c-common.o ../c-pragma.o |
195 | OBJDEPS = ../stamp-objlist ../c-common.o ../c-pragma.o | |
8d08fdba | 196 | |
a73cab0f | 197 | compiler: ../cc1plus$(exeext) |
a45a7ba0 RH |
198 | ../cc1plus$(exeext): $(P) $(OBJDEPS) $(CXX_OBJS) $(LIBDEPS) |
199 | $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(CXX_OBJS) $(LIBS) | |
8d08fdba | 200 | |
8d08fdba MS |
201 | Makefile: $(srcdir)/Makefile.in $(srcdir)/../configure |
202 | cd ..; $(SHELL) config.status | |
203 | ||
a73cab0f | 204 | native: config.status ../cc1plus$(exeext) |
6633d636 | 205 | #\f |
8d08fdba MS |
206 | # Compiling object files from source files. |
207 | ||
208 | # Note that dependencies on obstack.h are not written | |
209 | # because that file is not part of GCC. | |
8d08fdba MS |
210 | |
211 | # C++ language specific files. | |
212 | ||
65e63687 DE |
213 | RTL_H = $(srcdir)/../rtl.h $(srcdir)/../rtl.def \ |
214 | $(srcdir)/../machmode.h $(srcdir)/../machmode.def | |
215 | TREE_H = $(srcdir)/../tree.h $(srcdir)/../real.h $(srcdir)/../tree.def \ | |
216 | $(srcdir)/../machmode.h $(srcdir)/../machmode.def | |
7f4edbcb | 217 | CXX_TREE_H = $(TREE_H) cp-tree.h $(srcdir)/../c-common.h cp-tree.def |
db5ae43f MS |
218 | PARSE_H = $(srcdir)/parse.h |
219 | PARSE_C = $(srcdir)/parse.c | |
98fc8504 | 220 | EXPR_H = $(srcdir)/../expr.h ../insn-codes.h |
8d08fdba | 221 | |
9f617717 | 222 | parse.o : $(PARSE_C) $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h lex.h \ |
77dc0938 KG |
223 | $(srcdir)/../except.h $(srcdir)/../output.h $(srcdir)/../system.h \ |
224 | $(srcdir)/../toplev.h | |
8d08fdba | 225 | $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(BIG_SWITCHFLAG) \ |
db5ae43f MS |
226 | `echo $(PARSE_C) | sed 's,^\./,,'` |
227 | ||
b607c87f | 228 | CONFLICTS = expect 30 shift/reduce conflicts and 42 reduce/reduce conflicts. |
81cdf787 DE |
229 | $(PARSE_H) : $(PARSE_C) |
230 | $(PARSE_C) : $(srcdir)/parse.y | |
b7484fbe | 231 | @echo $(CONFLICTS) |
81cdf787 DE |
232 | cd $(srcdir); $(BISON) $(BISONFLAGS) -d -o parse.c parse.y |
233 | cd $(srcdir); grep '^#define[ ]*YYEMPTY' parse.c >>parse.h | |
234 | #$(PARSE_C) $(PARSE_H) : stamp-parse ; @true | |
235 | #stamp-parse: $(srcdir)/parse.y | |
b7484fbe | 236 | # @echo $(CONFLICTS) |
81cdf787 DE |
237 | # $(BISON) $(BISONFLAGS) -d $(srcdir)/parse.y |
238 | # grep '^#define[ ]*YYEMPTY' y.tab.c >>y.tab.h | |
239 | # $(srcdir)/../move-if-change y.tab.c $(PARSE_C) | |
240 | # $(srcdir)/../move-if-change y.tab.h $(PARSE_H) | |
241 | # cp $(PARSE_C) y.tab.c | |
242 | # touch stamp-parse | |
8d08fdba | 243 | |
91063b51 MM |
244 | # We used to try to protect people from having to rerun gperf. But, |
245 | # the C front-end already requires this if c-parse.gperf is changed, | |
246 | # so we should be consistent. | |
247 | $(srcdir)/hash.h: $(srcdir)/gxx.gperf | |
8e6befc1 | 248 | gperf -L C -F ', 0, 0' -p -j1 -g -o -t -N is_reserved_word \ |
9e46e5e8 | 249 | '-k1,4,7,$$' $(srcdir)/gxx.gperf >$(srcdir)/hash.h |
8d08fdba | 250 | |
87603ed0 KG |
251 | spew.o : spew.c $(CONFIG_H) $(CXX_TREE_H) $(PARSE_H) $(srcdir)/../flags.h \ |
252 | lex.h $(srcdir)/../system.h $(srcdir)/../toplev.h | |
8d08fdba | 253 | lex.o : lex.c $(CONFIG_H) $(CXX_TREE_H) \ |
8d052bc7 | 254 | $(PARSE_H) input.c $(srcdir)/../flags.h hash.h lex.h \ |
7dee3f36 | 255 | $(srcdir)/../c-pragma.h $(srcdir)/../system.h $(srcdir)/../toplev.h \ |
0d3ba739 | 256 | $(srcdir)/../output.h $(srcdir)/../mbchar.h |
65e63687 | 257 | decl.o : decl.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h \ |
9f617717 | 258 | lex.h decl.h $(srcdir)/../stack.h $(srcdir)/../output.h \ |
7ddedda4 | 259 | $(srcdir)/../except.h $(srcdir)/../system.h $(srcdir)/../toplev.h \ |
49ad7cfa | 260 | $(srcdir)/../hash.h $(srcdir)/../function.h |
65e63687 | 261 | decl2.o : decl2.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h \ |
49ad7cfa | 262 | lex.h decl.h $(EXPR_H) $(srcdir)/../except.h $(srcdir)/../function.h \ |
dc9c80a2 | 263 | $(srcdir)/../output.h $(srcdir)/../except.h $(srcdir)/../system.h \ |
0aafb128 MM |
264 | $(srcdir)/../toplev.h $(srcdir)/../dwarf2out.h $(srcdir)/../dwarfout.h \ |
265 | $(srcdir)/../../include/splay-tree.h $(srcdir)/../varray.h | |
8d052bc7 | 266 | typeck2.o : typeck2.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h \ |
dc9c80a2 | 267 | $(srcdir)/../system.h $(srcdir)/../toplev.h |
9f617717 | 268 | typeck.o : typeck.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h $(RTL_H) \ |
49ad7cfa BS |
269 | $(EXPR_H) $(srcdir)/../system.h $(srcdir)/../toplev.h \ |
270 | $(srcdir)/../function.h | |
8d052bc7 | 271 | class.o : class.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h \ |
8f032717 MM |
272 | $(srcdir)/../system.h $(srcdir)/../toplev.h \ |
273 | $(srcdir)/../../include/splay-tree.h | |
8d052bc7 | 274 | call.o : call.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h \ |
dc9c80a2 | 275 | $(srcdir)/../system.h $(srcdir)/../toplev.h |
8d052bc7 | 276 | friend.o : friend.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h $(RTL_H) \ |
dc9c80a2 | 277 | $(srcdir)/../system.h $(srcdir)/../toplev.h |
9f617717 | 278 | init.o : init.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h $(RTL_H) \ |
49ad7cfa BS |
279 | $(EXPR_H) $(srcdir)/../system.h $(srcdir)/../toplev.h \ |
280 | $(srcdir)/../function.h | |
dc9c80a2 | 281 | method.o : method.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../system.h \ |
49ad7cfa | 282 | $(srcdir)/../toplev.h $(srcdir)/../function.h |
ddaed37e JM |
283 | cvt.o : cvt.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../system.h decl.h \ |
284 | $(srcdir)/../flags.h $(srcdir)/../toplev.h $(srcdir)/../convert.h | |
8d052bc7 | 285 | search.o : search.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../stack.h \ |
43f856ef JM |
286 | $(srcdir)/../flags.h $(srcdir)/../system.h $(srcdir)/../toplev.h \ |
287 | $(srcdir)/../varray.h | |
8d052bc7 | 288 | tree.o : tree.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h \ |
dc9c80a2 | 289 | $(srcdir)/../system.h $(srcdir)/../toplev.h |
8d052bc7 JL |
290 | ptree.o : ptree.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../system.h |
291 | rtti.o : rtti.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h \ | |
dc9c80a2 | 292 | $(srcdir)/../system.h $(srcdir)/../toplev.h |
8d052bc7 | 293 | except.o : except.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h $(RTL_H) \ |
dc9c80a2 | 294 | $(srcdir)/../except.h $(srcdir)/../system.h $(srcdir)/../toplev.h |
65e63687 | 295 | expr.o : expr.c $(CONFIG_H) $(CXX_TREE_H) $(RTL_H) $(srcdir)/../flags.h \ |
98fc8504 | 296 | $(EXPR_H) $(srcdir)/../system.h $(srcdir)/../toplev.h |
8d052bc7 | 297 | xref.o : xref.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../input.h \ |
dc9c80a2 | 298 | $(srcdir)/../system.h $(srcdir)/../toplev.h |
8d052bc7 | 299 | pt.o : pt.c $(CONFIG_H) $(CXX_TREE_H) decl.h $(PARSE_H) lex.h \ |
dc9c80a2 JW |
300 | $(srcdir)/../system.h $(srcdir)/../toplev.h |
301 | error.o : error.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../system.h \ | |
302 | $(srcdir)/../toplev.h | |
303 | errfn.o : errfn.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../system.h \ | |
304 | $(srcdir)/../toplev.h | |
8d052bc7 | 305 | sig.o : sig.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h \ |
dc9c80a2 JW |
306 | $(srcdir)/../system.h $(srcdir)/../toplev.h |
307 | repo.o : repo.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../system.h \ | |
308 | $(srcdir)/../toplev.h | |
8d052bc7 | 309 | semantics.o: semantics.c $(CONFIG_H) $(CXX_TREE_H) lex.h \ |
dc9c80a2 | 310 | $(srcdir)/../except.h $(srcdir)/../system.h $(srcdir)/../toplev.h |
f71f87f9 | 311 | dump.o: dump.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../system.h |
ad321293 | 312 | |
6633d636 | 313 | #\f |
8d08fdba MS |
314 | # These exist for maintenance purposes. |
315 | ||
8d08fdba MS |
316 | # Update the tags table. |
317 | TAGS: force | |
8e10b365 DE |
318 | cd $(srcdir) ; \ |
319 | etags *.c *.h ; \ | |
320 | echo 'l' | tr 'l' '\f' >> TAGS ; \ | |
321 | echo 'parse.y,0' >> TAGS ; \ | |
8d08fdba MS |
322 | etags -a ../*.h ../*.c; |
323 | ||
8e10b365 | 324 | .PHONY: TAGS |
8d08fdba MS |
325 | |
326 | force: |