1 # Makefile for GNU C++ compiler.
2 # Copyright (C) 1987, 1988, 1990, 1991, 1992, 1993, 1994, 1995, 1998,
3 # 1999, 2000 Free Software Foundation, Inc.
5 #This file is part of GNU CC.
7 #GNU CC is free software; you can redistribute it and/or modify
8 #it under the terms of the GNU General Public License as published by
9 #the Free Software Foundation; either version 2, or (at your option)
12 #GNU CC is distributed in the hope that it will be useful,
13 #but WITHOUT ANY WARRANTY; without even the implied warranty of
14 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 #GNU General Public License for more details.
17 #You should have received a copy of the GNU General Public License
18 #along with GNU CC; see the file COPYING. If not, write to
19 #the Free Software Foundation, 59 Temple Place - Suite 330,
20 #Boston, MA 02111-1307, USA.
22 # The makefile built from this file lives in the language subdirectory.
23 # Its purpose is to provide support for:
25 # 1) recursion where necessary, and only then (building .o's), and
26 # 2) building and debugging cc1 from the language subdirectory, and
29 # The parent makefile handles all other chores, with help from the
30 # language makefile fragment, of course.
32 # The targets for external use are:
33 # all, TAGS, ???mostlyclean, ???clean.
35 # Suppress smart makes who think they know how to automake Yacc files
38 # It defines the c++ interface name. It should be changed when the
39 # c++ interface is changed.
42 # Variables that exist for you to override.
43 # See below for how to change them for certain systems.
45 # Various ways of specifying flags for compilations:
46 # CFLAGS is for the user to override to, e.g., do a bootstrap with -O2.
47 # BOOT_CFLAGS is the value of CFLAGS to pass
48 # to the stage2 and stage3 compilations
49 # XCFLAGS is used for most compilations but not when using the GCC just built.
52 BOOT_CFLAGS = -O $(CFLAGS)
53 # These exists to be overridden by the x-* and t-* files, respectively.
61 BISON = `if [ -f ../../bison/bison ] ; then echo ../../bison/bison -L $(srcdir)/../../bison/ ; else echo bison ; fi`
63 LEX = `if [ -f ../../flex/flex ] ; then echo ../../flex/flex ; else echo flex ; fi`
71 # Define this as & to perform parallel make on a Sequent.
72 # Note that this has some bugs, and it seems currently necessary
73 # to compile all the gen* files first by hand to avoid erroneous results.
76 # This is used instead of ALL_CFLAGS when compiling with GCC_FOR_TARGET.
77 # It omits XCFLAGS, and specifies -B./.
78 # It also specifies -B$(tooldir)/ to find as and ld for a cross compiler.
79 GCC_CFLAGS=$(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS)
81 # Tools to use when building a cross-compiler.
82 # These are used because `configure' appends `cross-make'
83 # to the makefile when making a cross-compiler.
85 # We don't use cross-make. Instead we use the tools
86 # from the build tree, if they are available.
87 # program_transform_name and objdir are set by configure.in.
88 program_transform_name =
92 xmake_file=@dep_host_xmake_file@
93 tmake_file=@dep_tmake_file@
94 #version=`sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/' < $(srcdir)/version.c`
95 #mainversion=`sed -e 's/.*\"\([0-9]*\.[0-9]*\).*/\1/' < $(srcdir)/version.c`
97 # Directory where sources are, from where we are.
101 # Additional system libraries to link with.
104 # Top build directory, relative to here.
107 # Internationalization library.
108 INTLLIBS = @INTLLIBS@
110 # Choose the real default target.
113 # End of variables for you to override.
115 # Definition of `all' is here so that new rules inserted by sed
116 # do not specify the default target.
119 # This tells GNU Make version 3 not to put all variables in the environment.
122 # sed inserts variable overrides after the following line.
133 # Now figure out from those variables how to compile and link.
135 all.indirect: Makefile ../cc1plus$(exeext)
137 # IN_GCC tells obstack.h that we are using gcc's <stddef.h> file.
138 INTERNAL_CFLAGS = $(CROSS) -DIN_GCC @extra_c_flags@
140 # This is the variable actually used when we compile.
141 ALL_CFLAGS = $(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS) $(XCFLAGS) -W -Wall
144 ALL_CPPFLAGS = $(CPPFLAGS) $(X_CPPFLAGS) $(T_CPPFLAGS)
146 # This is where we get libiberty.a from.
147 LIBIBERTY = ../../libiberty/libiberty.a
149 # How to link with both our special library facilities
150 # and the system's installed libraries.
151 LIBS = $(INTLLIBS) $(LIBIBERTY) $(CLIB)
152 LIBDEPS = $(INTLLIBS) $(LIBIBERTY)
154 # Specify the directories to be searched for header files.
155 # Both . and srcdir are used, in that order,
156 # so that tm.h and config.h will be found in the compilation
157 # subdirectory rather than in the source directory.
158 INCLUDES = -I. -I.. -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../config -I$(srcdir)/../../include
160 # Always use -I$(srcdir)/config when compiling.
162 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
164 # The only suffixes we want for implicit rules are .c and .o.
168 # This tells GNU make version 3 not to export all the variables
169 # defined in this file into the environment.
172 # Lists of files for various purposes.
174 # Shared with C front end:
175 C_OBJS = ../c-common.o ../c-pragma.o ../c-semantics.o ../c-lex.o
177 # Language-specific object files for g++
179 CXX_OBJS = call.o decl.o errfn.o expr.o pt.o typeck2.o \
180 class.o decl2.o error.o lex.o parse.o ptree.o rtti.o spew.o typeck.o cvt.o \
181 except.o friend.o init.o method.o search.o semantics.o tree.o xref.o \
182 repo.o dump.o optimize.o mangle.o @extra_cxx_objs@
184 # Language-independent object files.
185 BACKEND = ../toplev.o ../libbackend.a
187 compiler: ../cc1plus$(exeext)
188 ../cc1plus$(exeext): $(P) $(CXX_OBJS) $(C_OBJS) $(BACKEND) $(LIBDEPS)
189 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
190 $(CXX_OBJS) $(C_OBJS) $(BACKEND) $(LIBS)
192 Makefile: $(srcdir)/Makefile.in $(srcdir)/../configure
193 cd ..; $(SHELL) config.status
195 native: config.status ../cc1plus$(exeext)
197 # Compiling object files from source files.
199 # Note that dependencies on obstack.h are not written
200 # because that file is not part of GCC.
202 # C++ language specific files.
204 RTL_H = $(srcdir)/../rtl.h $(srcdir)/../rtl.def \
205 $(srcdir)/../machmode.h $(srcdir)/../machmode.def
206 TREE_H = $(srcdir)/../tree.h $(srcdir)/../real.h $(srcdir)/../tree.def \
207 $(srcdir)/../machmode.h $(srcdir)/../machmode.def
208 CXX_TREE_H = $(TREE_H) cp-tree.h $(srcdir)/../c-common.h cp-tree.def \
209 $(srcdir)/../c-common.def $(srcdir)/../function.h $(srcdir)/../varray.h \
210 $(srcdir)/../../include/splay-tree.h \
211 $(srcdir)/../system.h $(CONFIG_H) $(HTAB_H)
212 PARSE_H = $(srcdir)/parse.h
213 PARSE_C = $(srcdir)/parse.c
214 EXPR_H = $(srcdir)/../expr.h ../insn-codes.h
215 GGC_H = $(srcdir)/../ggc.h $(srcdir)/../varray.h
216 HTAB_H = $(srcdir)/../../include/hashtab.h
217 TIMEVAR_H = $(srcdir)/../timevar.h $(srcdir)/../timevar.def
219 parse.o : $(PARSE_C) $(CXX_TREE_H) $(srcdir)/../flags.h lex.h \
220 $(srcdir)/../except.h $(srcdir)/../output.h $(srcdir)/../system.h \
221 $(srcdir)/../toplev.h $(GGC_H)
222 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(BIG_SWITCHFLAG) \
223 `echo $(PARSE_C) | sed 's,^\./,,'`
225 CONFLICTS = expect 33 shift/reduce conflicts and 58 reduce/reduce conflicts.
226 $(PARSE_H) $(PARSE_C) : $(srcdir)/parse.y
228 cd $(srcdir); $(BISON) $(BISONFLAGS) -d -o parse.c parse.y
229 cd $(srcdir); grep '^#define[ ]*YYEMPTY' parse.c >>parse.h
230 #$(PARSE_C) $(PARSE_H) : stamp-parse ; @true
231 #stamp-parse: $(srcdir)/parse.y
233 # $(BISON) $(BISONFLAGS) -d $(srcdir)/parse.y
234 # grep '^#define[ ]*YYEMPTY' y.tab.c >>y.tab.h
235 # $(SHELL) $(srcdir)/../move-if-change y.tab.c $(PARSE_C)
236 # $(SHELL) $(srcdir)/../move-if-change y.tab.h $(PARSE_H)
237 # cp $(PARSE_C) y.tab.c
240 $(srcdir)/cfns.h: $(srcdir)/cfns.gperf
241 gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' \
242 $(srcdir)/cfns.gperf > $(srcdir)/cfns.h
244 spew.o : spew.c $(CXX_TREE_H) $(PARSE_H) $(srcdir)/../flags.h \
245 lex.h $(srcdir)/../toplev.h
246 lex.o : lex.c $(CXX_TREE_H) \
247 $(PARSE_H) $(srcdir)/../flags.h lex.h \
248 $(srcdir)/../c-pragma.h $(srcdir)/../toplev.h \
249 $(srcdir)/../output.h $(srcdir)/../mbchar.h $(GGC_H) \
250 $(srcdir)/../input.h $(srcdir)/../diagnostic.h operators.def
251 decl.o : decl.c $(CXX_TREE_H) $(srcdir)/../flags.h \
252 lex.h decl.h $(srcdir)/../stack.h $(srcdir)/../output.h $(srcdir)/../expr.h \
253 $(srcdir)/../except.h $(srcdir)/../toplev.h \
254 $(srcdir)/../hash.h $(GGC_H) $(RTL_H) operators.def
255 decl2.o : decl2.c $(CXX_TREE_H) $(srcdir)/../flags.h \
256 lex.h decl.h $(EXPR_H) $(srcdir)/../output.h $(srcdir)/../except.h \
257 $(srcdir)/../toplev.h $(srcdir)/../dwarf2out.h $(srcdir)/../dwarfout.h \
259 typeck2.o : typeck2.c $(CXX_TREE_H) $(srcdir)/../flags.h \
260 $(srcdir)/../toplev.h $(srcdir)/../output.h
261 typeck.o : typeck.c $(CXX_TREE_H) $(srcdir)/../flags.h $(RTL_H) \
262 $(EXPR_H) $(srcdir)/../toplev.h
263 class.o : class.c $(CXX_TREE_H) $(srcdir)/../flags.h \
264 $(srcdir)/../toplev.h $(RTL_H)
265 call.o : call.c $(CXX_TREE_H) $(srcdir)/../flags.h \
266 $(srcdir)/../toplev.h $(RTL_H) $(EXPR_H) $(GGC_H)
267 friend.o : friend.c $(CXX_TREE_H) $(srcdir)/../flags.h $(RTL_H) \
268 $(srcdir)/../toplev.h
269 init.o : init.c $(CXX_TREE_H) $(srcdir)/../flags.h $(RTL_H) \
270 $(EXPR_H) $(srcdir)/../toplev.h $(GGC_H) \
271 $(srcdir)/../except.h
272 method.o : method.c $(CXX_TREE_H) \
273 $(srcdir)/../toplev.h $(GGC_H) $(RTL_H)
274 cvt.o : cvt.c $(CXX_TREE_H) decl.h \
275 $(srcdir)/../flags.h $(srcdir)/../toplev.h $(srcdir)/../convert.h
276 search.o : search.c $(CXX_TREE_H) $(srcdir)/../stack.h \
277 $(srcdir)/../flags.h $(srcdir)/../toplev.h $(RTL_H)
278 tree.o : tree.c $(CXX_TREE_H) $(srcdir)/../flags.h \
279 $(srcdir)/../toplev.h $(GGC_H) $(RTL_H) \
280 ../insn-config.h $(srcdir)/../integrate.h
281 ptree.o : ptree.c $(CXX_TREE_H) $(srcdir)/../system.h
282 rtti.o : rtti.c $(CXX_TREE_H) $(srcdir)/../flags.h \
283 $(srcdir)/../toplev.h $(srcdir)/../defaults.h
284 except.o : except.c $(CXX_TREE_H) $(srcdir)/../flags.h $(RTL_H) \
285 $(srcdir)/../except.h $(srcdir)/../toplev.h cfns.h
286 expr.o : expr.c $(CXX_TREE_H) $(RTL_H) $(srcdir)/../flags.h \
287 $(EXPR_H) $(srcdir)/../toplev.h $(srcdir)/../except.h
288 xref.o : xref.c $(CXX_TREE_H) $(srcdir)/../input.h \
289 $(srcdir)/../toplev.h
290 pt.o : pt.c $(CXX_TREE_H) decl.h $(PARSE_H) lex.h \
291 $(srcdir)/../toplev.h $(GGC_H) $(RTL_H) \
292 $(srcdir)/../except.h
293 error.o : error.c $(CXX_TREE_H) \
294 $(srcdir)/../toplev.h $(srcdir)/../diagnostic.h
295 errfn.o : errfn.c $(CXX_TREE_H) \
296 $(srcdir)/../toplev.h
297 repo.o : repo.c $(CXX_TREE_H) \
298 $(srcdir)/../toplev.h $(GGC_H)
299 semantics.o: semantics.c $(CXX_TREE_H) lex.h \
300 $(srcdir)/../except.h $(srcdir)/../toplev.h \
301 $(srcdir)/../flags.h $(GGC_H) \
302 $(srcdir)/../output.h $(RTL_H) $(TIMEVAR_H)
303 dump.o: dump.c $(CXX_TREE_H)
304 optimize.o: optimize.c $(CXX_TREE_H) \
305 $(srcdir)/../rtl.h $(srcdir)/../integrate.h ../insn-config.h \
307 mangle.o: mangle.c $(CXX_TREE_H) $(srcdir)/../toplev.h
310 # These exist for maintenance purposes.
312 # Update the tags table.
316 echo 'l' | tr 'l' '\f' >> TAGS ; \
317 echo 'parse.y,0' >> TAGS ; \
318 etags -a ../*.h ../*.c;