]>
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 | ||
8d08fdba MS |
44 | # Various ways of specifying flags for compilations: |
45 | # CFLAGS is for the user to override to, e.g., do a bootstrap with -O2. | |
46 | # BOOT_CFLAGS is the value of CFLAGS to pass | |
47 | # to the stage2 and stage3 compilations | |
48 | # XCFLAGS is used for most compilations but not when using the GCC just built. | |
49 | XCFLAGS = | |
50 | CFLAGS = -g | |
51 | BOOT_CFLAGS = -O $(CFLAGS) | |
52 | # These exists to be overridden by the x-* and t-* files, respectively. | |
53 | X_CFLAGS = | |
54 | T_CFLAGS = | |
55 | ||
56 | X_CPPFLAGS = | |
57 | T_CPPFLAGS = | |
58 | ||
0520f6c0 | 59 | CC = @CC@ |
b2fdd68c | 60 | BISON = `if [ -f ../../bison/bison ] ; then echo ../../bison/bison -L $(srcdir)/../../bison/ ; else echo bison ; fi` |
81cdf787 | 61 | BISONFLAGS = |
b0ccd8de | 62 | LEX = `if [ -f ../../flex/flex ] ; then echo ../../flex/flex ; else echo flex ; fi` |
8e10b365 | 63 | LEXFLAGS = |
8d08fdba | 64 | AR = ar |
8d08fdba MS |
65 | AR_FLAGS = rc |
66 | SHELL = /bin/sh | |
67 | MAKEINFO = makeinfo | |
68 | TEXI2DVI = texi2dvi | |
69 | ||
70 | # Define this as & to perform parallel make on a Sequent. | |
71 | # Note that this has some bugs, and it seems currently necessary | |
72 | # to compile all the gen* files first by hand to avoid erroneous results. | |
73 | P = | |
74 | ||
75 | # This is used instead of ALL_CFLAGS when compiling with GCC_FOR_TARGET. | |
76 | # It omits XCFLAGS, and specifies -B./. | |
77 | # It also specifies -B$(tooldir)/ to find as and ld for a cross compiler. | |
78 | GCC_CFLAGS=$(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS) | |
79 | ||
80 | # Tools to use when building a cross-compiler. | |
81 | # These are used because `configure' appends `cross-make' | |
82 | # to the makefile when making a cross-compiler. | |
83 | ||
7e717196 JL |
84 | # We don't use cross-make. Instead we use the tools |
85 | # from the build tree, if they are available. | |
86 | # program_transform_name and objdir are set by configure.in. | |
87 | program_transform_name = | |
88 | objdir = . | |
89 | ||
0520f6c0 PB |
90 | target=@target@ |
91 | xmake_file=@dep_host_xmake_file@ | |
92 | tmake_file=@dep_tmake_file@ | |
8d08fdba MS |
93 | #version=`sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/' < $(srcdir)/version.c` |
94 | #mainversion=`sed -e 's/.*\"\([0-9]*\.[0-9]*\).*/\1/' < $(srcdir)/version.c` | |
95 | ||
96 | # Directory where sources are, from where we are. | |
0520f6c0 PB |
97 | srcdir = @srcdir@ |
98 | VPATH = @srcdir@ | |
8d08fdba | 99 | |
0ac2a8ee DE |
100 | # Additional system libraries to link with. |
101 | CLIB= | |
ab87f8c8 JL |
102 | |
103 | # Top build directory, relative to here. | |
104 | top_builddir = .. | |
105 | ||
106 | # Internationalization library. | |
107 | INTLLIBS = @INTLLIBS@ | |
0ac2a8ee | 108 | |
8d08fdba MS |
109 | # Choose the real default target. |
110 | ALL=all | |
111 | ||
112 | # End of variables for you to override. | |
113 | ||
114 | # Definition of `all' is here so that new rules inserted by sed | |
115 | # do not specify the default target. | |
116 | all: all.indirect | |
117 | ||
118 | # This tells GNU Make version 3 not to put all variables in the environment. | |
119 | .NOEXPORT: | |
120 | ||
121 | # sed inserts variable overrides after the following line. | |
122 | ####target overrides | |
0520f6c0 | 123 | @target_overrides@ |
8d08fdba | 124 | ####host overrides |
0520f6c0 | 125 | @host_overrides@ |
8d08fdba | 126 | ####cross overrides |
0520f6c0 PB |
127 | @cross_defines@ |
128 | @cross_overrides@ | |
8d08fdba | 129 | ####build overrides |
0520f6c0 | 130 | @build_overrides@ |
6633d636 | 131 | #\f |
8d08fdba MS |
132 | # Now figure out from those variables how to compile and link. |
133 | ||
a73cab0f | 134 | all.indirect: Makefile ../cc1plus$(exeext) |
8d08fdba | 135 | |
7848c278 | 136 | # IN_GCC tells obstack.h that we are using gcc's <stddef.h> file. |
0520f6c0 | 137 | INTERNAL_CFLAGS = $(CROSS) -DIN_GCC @extra_c_flags@ |
8d08fdba MS |
138 | |
139 | # This is the variable actually used when we compile. | |
b2d352ba | 140 | ALL_CFLAGS = $(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS) $(XCFLAGS) -W -Wall |
8d08fdba MS |
141 | |
142 | # Likewise. | |
143 | ALL_CPPFLAGS = $(CPPFLAGS) $(X_CPPFLAGS) $(T_CPPFLAGS) | |
144 | ||
7d12830c KG |
145 | # This is where we get libiberty.a from. |
146 | LIBIBERTY = ../../libiberty/libiberty.a | |
8d08fdba MS |
147 | |
148 | # How to link with both our special library facilities | |
149 | # and the system's installed libraries. | |
7d12830c KG |
150 | LIBS = $(INTLLIBS) $(LIBIBERTY) $(CLIB) |
151 | LIBDEPS = $(INTLLIBS) $(LIBIBERTY) | |
8d08fdba | 152 | |
0ac2a8ee DE |
153 | # Specify the directories to be searched for header files. |
154 | # Both . and srcdir are used, in that order, | |
155 | # so that tm.h and config.h will be found in the compilation | |
156 | # subdirectory rather than in the source directory. | |
0c2e9d7a | 157 | INCLUDES = -I. -I.. -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../config -I$(srcdir)/../../include |
0ac2a8ee | 158 | |
8d08fdba MS |
159 | # Always use -I$(srcdir)/config when compiling. |
160 | .c.o: | |
161 | $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< | |
162 | ||
2addbe1d JM |
163 | # The only suffixes we want for implicit rules are .c and .o. |
164 | .SUFFIXES: | |
165 | .SUFFIXES: .c .o | |
166 | ||
8d08fdba MS |
167 | # This tells GNU make version 3 not to export all the variables |
168 | # defined in this file into the environment. | |
169 | .NOEXPORT: | |
6633d636 | 170 | #\f |
8d08fdba MS |
171 | # Lists of files for various purposes. |
172 | ||
173 | # Language-specific object files for g++ | |
174 | ||
6eabb241 | 175 | CXX_OBJS = call.o decl.o errfn.o expr.o pt.o typeck2.o \ |
9e9ff709 | 176 | class.o decl2.o error.o lex.o parse.o ptree.o rtti.o spew.o typeck.o cvt.o \ |
276ca6ea | 177 | except.o friend.o init.o method.o search.o semantics.o tree.o xref.o \ |
f71f87f9 | 178 | repo.o dump.o @extra_cxx_objs@ |
8d08fdba | 179 | |
8d08fdba | 180 | # Language-independent object files. |
03705c95 MM |
181 | OBJS = `cat ../stamp-objlist` ../c-common.o ../c-pragma.o |
182 | OBJDEPS = ../stamp-objlist ../c-common.o ../c-pragma.o | |
8d08fdba | 183 | |
a73cab0f | 184 | compiler: ../cc1plus$(exeext) |
a45a7ba0 RH |
185 | ../cc1plus$(exeext): $(P) $(OBJDEPS) $(CXX_OBJS) $(LIBDEPS) |
186 | $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(CXX_OBJS) $(LIBS) | |
8d08fdba | 187 | |
8d08fdba MS |
188 | Makefile: $(srcdir)/Makefile.in $(srcdir)/../configure |
189 | cd ..; $(SHELL) config.status | |
190 | ||
a73cab0f | 191 | native: config.status ../cc1plus$(exeext) |
6633d636 | 192 | #\f |
8d08fdba MS |
193 | # Compiling object files from source files. |
194 | ||
195 | # Note that dependencies on obstack.h are not written | |
196 | # because that file is not part of GCC. | |
8d08fdba MS |
197 | |
198 | # C++ language specific files. | |
199 | ||
65e63687 DE |
200 | RTL_H = $(srcdir)/../rtl.h $(srcdir)/../rtl.def \ |
201 | $(srcdir)/../machmode.h $(srcdir)/../machmode.def | |
202 | TREE_H = $(srcdir)/../tree.h $(srcdir)/../real.h $(srcdir)/../tree.def \ | |
203 | $(srcdir)/../machmode.h $(srcdir)/../machmode.def | |
99dccabc | 204 | CXX_TREE_H = $(TREE_H) cp-tree.h $(srcdir)/../c-common.h cp-tree.def \ |
9cd64686 | 205 | $(srcdir)/../function.h $(srcdir)/../varray.h |
db5ae43f MS |
206 | PARSE_H = $(srcdir)/parse.h |
207 | PARSE_C = $(srcdir)/parse.c | |
98fc8504 | 208 | EXPR_H = $(srcdir)/../expr.h ../insn-codes.h |
8d08fdba | 209 | |
9f617717 | 210 | parse.o : $(PARSE_C) $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h lex.h \ |
77dc0938 | 211 | $(srcdir)/../except.h $(srcdir)/../output.h $(srcdir)/../system.h \ |
fc6af6e3 | 212 | $(srcdir)/../toplev.h $(srcdir)/../ggc.h |
8d08fdba | 213 | $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(BIG_SWITCHFLAG) \ |
db5ae43f MS |
214 | `echo $(PARSE_C) | sed 's,^\./,,'` |
215 | ||
b607c87f | 216 | CONFLICTS = expect 30 shift/reduce conflicts and 42 reduce/reduce conflicts. |
81cdf787 DE |
217 | $(PARSE_H) : $(PARSE_C) |
218 | $(PARSE_C) : $(srcdir)/parse.y | |
b7484fbe | 219 | @echo $(CONFLICTS) |
81cdf787 DE |
220 | cd $(srcdir); $(BISON) $(BISONFLAGS) -d -o parse.c parse.y |
221 | cd $(srcdir); grep '^#define[ ]*YYEMPTY' parse.c >>parse.h | |
222 | #$(PARSE_C) $(PARSE_H) : stamp-parse ; @true | |
223 | #stamp-parse: $(srcdir)/parse.y | |
b7484fbe | 224 | # @echo $(CONFLICTS) |
81cdf787 DE |
225 | # $(BISON) $(BISONFLAGS) -d $(srcdir)/parse.y |
226 | # grep '^#define[ ]*YYEMPTY' y.tab.c >>y.tab.h | |
227 | # $(srcdir)/../move-if-change y.tab.c $(PARSE_C) | |
228 | # $(srcdir)/../move-if-change y.tab.h $(PARSE_H) | |
229 | # cp $(PARSE_C) y.tab.c | |
230 | # touch stamp-parse | |
8d08fdba | 231 | |
91063b51 MM |
232 | # We used to try to protect people from having to rerun gperf. But, |
233 | # the C front-end already requires this if c-parse.gperf is changed, | |
234 | # so we should be consistent. | |
235 | $(srcdir)/hash.h: $(srcdir)/gxx.gperf | |
8e6befc1 | 236 | gperf -L C -F ', 0, 0' -p -j1 -g -o -t -N is_reserved_word \ |
9e46e5e8 | 237 | '-k1,4,7,$$' $(srcdir)/gxx.gperf >$(srcdir)/hash.h |
8d08fdba | 238 | |
87603ed0 KG |
239 | spew.o : spew.c $(CONFIG_H) $(CXX_TREE_H) $(PARSE_H) $(srcdir)/../flags.h \ |
240 | lex.h $(srcdir)/../system.h $(srcdir)/../toplev.h | |
8d08fdba | 241 | lex.o : lex.c $(CONFIG_H) $(CXX_TREE_H) \ |
8d052bc7 | 242 | $(PARSE_H) input.c $(srcdir)/../flags.h hash.h lex.h \ |
7dee3f36 | 243 | $(srcdir)/../c-pragma.h $(srcdir)/../system.h $(srcdir)/../toplev.h \ |
9cd64686 | 244 | $(srcdir)/../output.h $(srcdir)/../mbchar.h $(srcdir)/../ggc.h |
65e63687 | 245 | decl.o : decl.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h \ |
9f617717 | 246 | lex.h decl.h $(srcdir)/../stack.h $(srcdir)/../output.h \ |
7ddedda4 | 247 | $(srcdir)/../except.h $(srcdir)/../system.h $(srcdir)/../toplev.h \ |
9cd64686 | 248 | $(srcdir)/../hash.h $(srcdir)/../ggc.h |
65e63687 | 249 | decl2.o : decl2.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h \ |
99dccabc | 250 | lex.h decl.h $(EXPR_H) $(srcdir)/../except.h \ |
dc9c80a2 | 251 | $(srcdir)/../output.h $(srcdir)/../except.h $(srcdir)/../system.h \ |
0aafb128 | 252 | $(srcdir)/../toplev.h $(srcdir)/../dwarf2out.h $(srcdir)/../dwarfout.h \ |
9cd64686 | 253 | $(srcdir)/../../include/splay-tree.h $(srcdir)/../ggc.h |
8d052bc7 | 254 | typeck2.o : typeck2.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h \ |
dc9c80a2 | 255 | $(srcdir)/../system.h $(srcdir)/../toplev.h |
9f617717 | 256 | typeck.o : typeck.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h $(RTL_H) \ |
99dccabc | 257 | $(EXPR_H) $(srcdir)/../system.h $(srcdir)/../toplev.h |
8d052bc7 | 258 | class.o : class.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h \ |
8f032717 MM |
259 | $(srcdir)/../system.h $(srcdir)/../toplev.h \ |
260 | $(srcdir)/../../include/splay-tree.h | |
8d052bc7 | 261 | call.o : call.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h \ |
dc9c80a2 | 262 | $(srcdir)/../system.h $(srcdir)/../toplev.h |
8d052bc7 | 263 | friend.o : friend.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h $(RTL_H) \ |
dc9c80a2 | 264 | $(srcdir)/../system.h $(srcdir)/../toplev.h |
9f617717 | 265 | init.o : init.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h $(RTL_H) \ |
fc6af6e3 | 266 | $(EXPR_H) $(srcdir)/../system.h $(srcdir)/../toplev.h $(srcdir)/../ggc.h |
dc9c80a2 | 267 | method.o : method.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../system.h \ |
9cd64686 | 268 | $(srcdir)/../toplev.h $(srcdir)/../ggc.h |
ddaed37e JM |
269 | cvt.o : cvt.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../system.h decl.h \ |
270 | $(srcdir)/../flags.h $(srcdir)/../toplev.h $(srcdir)/../convert.h | |
8d052bc7 | 271 | search.o : search.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../stack.h \ |
9cd64686 | 272 | $(srcdir)/../flags.h $(srcdir)/../system.h $(srcdir)/../toplev.h |
8d052bc7 | 273 | tree.o : tree.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h \ |
dc9c80a2 | 274 | $(srcdir)/../system.h $(srcdir)/../toplev.h |
8d052bc7 JL |
275 | ptree.o : ptree.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../system.h |
276 | rtti.o : rtti.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h \ | |
dc9c80a2 | 277 | $(srcdir)/../system.h $(srcdir)/../toplev.h |
8d052bc7 | 278 | except.o : except.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h $(RTL_H) \ |
dc9c80a2 | 279 | $(srcdir)/../except.h $(srcdir)/../system.h $(srcdir)/../toplev.h |
65e63687 | 280 | expr.o : expr.c $(CONFIG_H) $(CXX_TREE_H) $(RTL_H) $(srcdir)/../flags.h \ |
98fc8504 | 281 | $(EXPR_H) $(srcdir)/../system.h $(srcdir)/../toplev.h |
8d052bc7 | 282 | xref.o : xref.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../input.h \ |
dc9c80a2 | 283 | $(srcdir)/../system.h $(srcdir)/../toplev.h |
8d052bc7 | 284 | pt.o : pt.c $(CONFIG_H) $(CXX_TREE_H) decl.h $(PARSE_H) lex.h \ |
9cd64686 | 285 | $(srcdir)/../system.h $(srcdir)/../toplev.h $(srcdir)/../ggc.h |
dc9c80a2 JW |
286 | error.o : error.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../system.h \ |
287 | $(srcdir)/../toplev.h | |
288 | errfn.o : errfn.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../system.h \ | |
289 | $(srcdir)/../toplev.h | |
dc9c80a2 | 290 | repo.o : repo.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../system.h \ |
9cd64686 | 291 | $(srcdir)/../toplev.h $(srcdir)/../ggc.h |
8d052bc7 | 292 | semantics.o: semantics.c $(CONFIG_H) $(CXX_TREE_H) lex.h \ |
dc9c80a2 | 293 | $(srcdir)/../except.h $(srcdir)/../system.h $(srcdir)/../toplev.h |
f71f87f9 | 294 | dump.o: dump.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../system.h |
ad321293 | 295 | |
6633d636 | 296 | #\f |
8d08fdba MS |
297 | # These exist for maintenance purposes. |
298 | ||
8d08fdba MS |
299 | # Update the tags table. |
300 | TAGS: force | |
8e10b365 DE |
301 | cd $(srcdir) ; \ |
302 | etags *.c *.h ; \ | |
303 | echo 'l' | tr 'l' '\f' >> TAGS ; \ | |
304 | echo 'parse.y,0' >> TAGS ; \ | |
8d08fdba MS |
305 | etags -a ../*.h ../*.c; |
306 | ||
8e10b365 | 307 | .PHONY: TAGS |
8d08fdba MS |
308 | |
309 | force: |