]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/cp/Make-lang.in
Merge from pch-branch up to tag pch-commit-20020603.
[thirdparty/gcc.git] / gcc / cp / Make-lang.in
CommitLineData
c00996a3 1# Top level -*- makefile -*- fragment for GNU C++.
23de1fbf 2# Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001
ca888935 3# Free Software Foundation, Inc.
a5943075
DE
4
5#This file is part of GNU CC.
6
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)
10#any later version.
11
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.
16
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
de18aff3
RK
19#the Free Software Foundation, 59 Temple Place - Suite 330,
20#Boston, MA 02111-1307, USA.
a5943075
DE
21
22# This file provides the language dependent support in the main Makefile.
23# Each language makefile fragment must provide the following targets:
24#
25# foo.all.build, foo.all.cross, foo.start.encap, foo.rest.encap,
26# foo.info, foo.dvi,
27# foo.install-normal, foo.install-common, foo.install-info, foo.install-man,
436a88a6 28# foo.uninstall,
f1908d70
RK
29# foo.mostlyclean, foo.clean, foo.distclean, foo.extraclean,
30# foo.maintainer-clean, foo.stage1, foo.stage2, foo.stage3, foo.stage4
a5943075
DE
31#
32# where `foo' is the name of the language.
33#
34# It should also provide rules for:
35#
36# - making any compiler driver (eg: g++)
37# - the compiler proper (eg: cc1plus)
38# - define the names for selecting the language in LANGUAGES.
a5943075 39
a0a33927 40# Actual names to use when installing a native compiler.
b21d216c
AF
41CXX_INSTALL_NAME = `echo c++|sed '$(program_transform_name)'`
42GXX_INSTALL_NAME = `echo g++|sed '$(program_transform_name)'`
43DEMANGLER_INSTALL_NAME = `echo c++filt|sed '$(program_transform_name)'`
44CXX_TARGET_INSTALL_NAME = $(target_alias)-`echo c++|sed '$(program_transform_name)'`
45GXX_TARGET_INSTALL_NAME = $(target_alias)-`echo g++|sed '$(program_transform_name)'`
a0a33927
MS
46
47# Actual names to use when installing a cross-compiler.
b21d216c
AF
48CXX_CROSS_NAME = `echo c++|sed '$(program_transform_cross_name)'`
49GXX_CROSS_NAME = `echo g++|sed '$(program_transform_cross_name)'`
50DEMANGLER_CROSS_NAME = `echo c++filt|sed '$(program_transform_cross_name)'`
a0a33927 51
863adfc0 52# The name to use for the demangler program.
d8b55a76 53DEMANGLER_PROG = c++filt$(exeext)
5156628f 54
6633d636 55#\f
a5943075
DE
56# Define the names for selecting c++ in LANGUAGES.
57# Note that it would be nice to move the dependency on g++
58# into the C++ rule, but that needs a little bit of work
59# to do the right thing within all.cross.
a73cab0f 60C++ c++: cc1plus$(exeext)
a5943075 61
5edb8b93
MS
62# Tell GNU make to ignore these if they exist.
63.PHONY: C++ c++
64
911e6107 65g++spec.o: $(srcdir)/cp/g++spec.c $(SYSTEM_H) $(GCC_H) $(CONFIG_H)
8c310e3f
MM
66 (SHLIB_LINK='$(SHLIB_LINK)' \
67 SHLIB_MULTILIB='$(SHLIB_MULTILIB)'; \
049f6ec9 68 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \
8c310e3f 69 $(INCLUDES) $(srcdir)/cp/g++spec.c)
d2e5ee5c 70
5b7874aa 71po-generated: $(srcdir)/cp/parse.c
b077493b 72
a5943075 73# Create the compiler driver for g++.
08dc830e 74GXX_OBJS = gcc.o g++spec.o intl.o prefix.o version.o
ab87f8c8
JL
75g++$(exeext): $(GXX_OBJS) $(EXTRA_GCC_OBJS) $(LIBDEPS)
76 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
77 $(GXX_OBJS) $(EXTRA_GCC_OBJS) $(LIBS)
a5943075
DE
78
79# Create a version of the g++ driver which calls the cross-compiler.
d2e5ee5c
MS
80g++-cross$(exeext): g++$(exeext)
81 -rm -f g++-cross$(exeext)
82 cp g++$(exeext) g++-cross$(exeext)
a5943075 83
b8dad04b 84# The demangler.
9196ece5 85cxxmain.o: $(srcdir)/../libiberty/cplus-dem.c $(DEMANGLE_H) $(CONFIG_H)
863adfc0 86 rm -f cxxmain.c
69789cfc 87 $(LN_S) $(srcdir)/../libiberty/cplus-dem.c cxxmain.c
863adfc0 88 $(CC) -c -DMAIN $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
78696538 89 -DVERSION=\"$(version)\" cxxmain.c
863adfc0 90
83f660b7 91# Apparently OpenVM needs the -o to be at the beginning of the link line.
6b17c089 92$(DEMANGLER_PROG): cxxmain.o underscore.o $(LIBDEPS)
83f660b7 93 $(CC) -o $@ $(ALL_CFLAGS) $(LDFLAGS) \
6b17c089 94 cxxmain.o underscore.o $(LIBS)
863adfc0 95
b8dad04b
ZW
96# The compiler itself.
97# Shared with C front end:
bb9f8221 98CXX_C_OBJS = attribs.o c-common.o c-format.o c-pragma.o c-semantics.o c-lex.o \
89d684bb 99 $(CXX_TARGET_OBJS)
b8dad04b
ZW
100
101# Language-specific object files.
749ced52 102CXX_OBJS = cp/call.o cp/decl.o cp/expr.o cp/pt.o cp/typeck2.o \
b8dad04b
ZW
103 cp/class.o cp/decl2.o cp/error.o cp/lex.o cp/parse.o cp/ptree.o cp/rtti.o \
104 cp/spew.o cp/typeck.o cp/cvt.o cp/except.o cp/friend.o cp/init.o cp/method.o \
9780c24f 105 cp/search.o cp/semantics.o cp/tree.o cp/repo.o cp/dump.o \
19551f29 106 cp/optimize.o cp/mangle.o cp/cp-lang.o
b8dad04b
ZW
107
108# Use loose warnings for this front end.
109cp-warn =
110
111cc1plus$(exeext): $(CXX_OBJS) $(CXX_C_OBJS) $(BACKEND) \
056487e7 112 libcpp.a $(LIBDEPS)
b8dad04b 113 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
056487e7 114 $(CXX_OBJS) $(CXX_C_OBJS) $(BACKEND) libcpp.a $(LIBS)
b8dad04b
ZW
115
116# Special build rules.
117$(srcdir)/cp/cfns.h: $(srcdir)/cp/cfns.gperf
118 gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' \
119 $(srcdir)/cp/cfns.gperf > $(srcdir)/cp/cfns.h
120
ade3dc07
JM
121$(srcdir)/cp/parse.h: $(srcdir)/cp/parse.c
122$(srcdir)/cp/parse.c: $(srcdir)/cp/parse.y
e6b9638b 123 @echo "Expect 33 shift/reduce conflicts and 58 reduce/reduce conflicts."
b88c0704
JM
124 cd $(srcdir)/cp && \
125 if $(BISON) $(BISONFLAGS) -d -o p$$$$.c parse.y; then \
126 grep '^#define[ ]*YYEMPTY' p$$$$.c >> p$$$$.h ; \
127 test -f p$$$$.output && mv -f p$$$$.output parse.output ; \
128 mv -f p$$$$.c parse.c ; mv -f p$$$$.h parse.h ; \
129 else \
130 rm -f p$$$$.* ; \
131 false ; \
132 fi
b8dad04b 133
e2500fed
GK
134gtype-cp.h gt-cp-call.h gt-cp-decl.h gt-cp-decl2.h : s-gtype; @true
135gt-cp-parse.h gt-cp-pt.h gt-cp-repo.h gt-cp-spew.h : s-gtype; @true
136gt-cp-tree.h : s-gtype; @true
137
6633d636 138#\f
a5943075
DE
139# Build hooks:
140
da372c07 141c++.all.build: g++$(exeext)
824b9a4c
MS
142c++.all.cross: g++-cross$(exeext) $(DEMANGLER_PROG)
143c++.start.encap: g++$(exeext)
863adfc0 144c++.rest.encap: $(DEMANGLER_PROG)
a5943075 145
c3aac512 146c++.info:
a5943075 147c++.dvi:
d3945f0a 148c++.generated-manpages:
23de1fbf 149
6633d636 150#\f
a5943075
DE
151# Install hooks:
152# cc1plus is installed elsewhere as part of $(COMPILERS).
153
154# Nothing to do here.
155c++.install-normal:
156
157# Install the driver program as $(target)-g++
158# and also as either g++ (if native) or $(tooldir)/bin/g++.
e658449e 159c++.install-common: installdirs
be81d4d7
DR
160 -if [ -f cc1plus$(exeext) ] ; then \
161 if [ -f g++-cross$(exeext) ] ; then \
162 rm -f $(bindir)/$(GXX_CROSS_NAME)$(exeext); \
163 $(INSTALL_PROGRAM) g++-cross$(exeext) $(bindir)/$(GXX_CROSS_NAME)$(exeext); \
164 chmod a+x $(bindir)/$(GXX_CROSS_NAME)$(exeext); \
165 rm -f $(bindir)/$(CXX_CROSS_NAME)$(exeext); \
ac64120e 166 $(LN) $(bindir)/$(GXX_CROSS_NAME)$(exeext) $(bindir)/$(CXX_CROSS_NAME)$(exeext); \
2d2586a4
MR
167 if [ -d $(gcc_tooldir)/bin/. ] ; then \
168 rm -f $(gcc_tooldir)/bin/g++$(exeext); \
169 $(INSTALL_PROGRAM) g++-cross$(exeext) $(gcc_tooldir)/bin/g++$(exeext); \
170 rm -f $(gcc_tooldir)/bin/c++$(exeext); \
171 $(LN) $(gcc_tooldir)/bin/g++$(exeext) $(gcc_tooldir)/bin/c++$(exeext); \
172 else true; fi; \
a5943075 173 else \
be81d4d7
DR
174 rm -f $(bindir)/$(GXX_INSTALL_NAME)$(exeext); \
175 $(INSTALL_PROGRAM) g++$(exeext) $(bindir)/$(GXX_INSTALL_NAME)$(exeext); \
176 chmod a+x $(bindir)/$(GXX_INSTALL_NAME)$(exeext); \
177 rm -f $(bindir)/$(CXX_INSTALL_NAME)$(exeext); \
ac64120e 178 $(LN) $(bindir)/$(GXX_INSTALL_NAME)$(exeext) $(bindir)/$(CXX_INSTALL_NAME)$(exeext); \
b21d216c
AF
179 rm -f $(bindir)/$(GXX_TARGET_INSTALL_NAME)$(exeext); \
180 $(LN) $(bindir)/$(GXX_INSTALL_NAME)$(exeext) $(bindir)/$(GXX_TARGET_INSTALL_NAME)$(exeext); \
181 rm -f $(bindir)/$(CXX_TARGET_INSTALL_NAME)$(exeext); \
182 $(LN) $(bindir)/$(CXX_INSTALL_NAME)$(exeext) $(bindir)/$(CXX_TARGET_INSTALL_NAME)$(exeext); \
a5943075 183 fi ; \
5b477224
MH
184 if [ x$(DEMANGLER_PROG) != x ] && [ -x "$(DEMANGLER_PROG)" ]; then \
185 if [ -f g++-cross$(exeext) ] ; then \
186 rm -f $(bindir)/$(DEMANGLER_CROSS_NAME)$(exeext); \
187 $(INSTALL_PROGRAM) $(DEMANGLER_PROG) $(bindir)/$(DEMANGLER_CROSS_NAME)$(exeext); \
188 chmod a+x $(bindir)/$(DEMANGLER_CROSS_NAME)$(exeext); \
189 else \
190 rm -f $(bindir)/$(DEMANGLER_INSTALL_NAME)$(exeext); \
191 $(INSTALL_PROGRAM) $(DEMANGLER_PROG) $(bindir)/$(DEMANGLER_INSTALL_NAME)$(exeext); \
192 chmod a+x $(bindir)/$(DEMANGLER_INSTALL_NAME)$(exeext); \
193 fi ; \
194 fi ; \
a5943075
DE
195 fi
196
c3aac512 197c++.install-info:
a5943075 198
e658449e 199c++.install-man: installdirs $(srcdir)/cp/g++.1
be81d4d7 200 -if [ -f cc1plus$(exeext) ] ; then \
251580ee 201 if [ -f g++-cross$(exeext) ] ; then \
77bd67cb
JM
202 rm -f $(man1dir)/$(GXX_CROSS_NAME)$(man1ext); \
203 $(INSTALL_DATA) $(srcdir)/cp/g++.1 $(man1dir)/$(GXX_CROSS_NAME)$(man1ext); \
204 chmod a-x $(man1dir)/$(GXX_CROSS_NAME)$(man1ext); \
04dbaf1f 205 else \
77bd67cb
JM
206 rm -f $(man1dir)/$(GXX_INSTALL_NAME)$(man1ext); \
207 $(INSTALL_DATA) $(srcdir)/cp/g++.1 $(man1dir)/$(GXX_INSTALL_NAME)$(man1ext); \
208 chmod a-x $(man1dir)/$(GXX_INSTALL_NAME)$(man1ext); \
04dbaf1f 209 fi; \
a5943075
DE
210 else true; fi
211
212c++.uninstall:
be81d4d7
DR
213 -rm -rf $(bindir)/$(CXX_INSTALL_NAME)$(exeext)
214 -rm -rf $(bindir)/$(CXX_CROSS_NAME)$(exeext)
215 -rm -rf $(bindir)/$(GXX_INSTALL_NAME)$(exeext)
216 -rm -rf $(bindir)/$(GXX_CROSS_NAME)$(exeext)
5b477224
MH
217 -rm -rf $(bindir)/$(DEMANGLER_INSTALL_NAME)$(exeext)
218 -rm -rf $(bindir)/$(DEMANGLER_CROSS_NAME)$(exeext)
77bd67cb
JM
219 -rm -rf $(man1dir)/$(GXX_INSTALL_NAME)$(man1ext)
220 -rm -rf $(man1dir)/$(GXX_CROSS_NAME)$(man1ext)
6633d636 221#\f
a5943075
DE
222# Clean hooks:
223# A lot of the ancillary files are deleted by the main makefile.
224# We just have to delete files specific to us.
225
226c++.mostlyclean:
227c77e2 227 -rm -f cp/*$(objext) $(DEMANGLER_PROG)
a5943075
DE
228c++.clean:
229c++.distclean:
230 -rm -f cp/config.status cp/Makefile
b8dad04b 231 -rm -f $(srcdir)/cp/parse.output
a5943075 232c++.extraclean:
f1908d70 233c++.maintainer-clean:
b8dad04b 234 -rm -f $(srcdir)/cp/parse.c $(srcdir)/cp/parse.h
6633d636 235#\f
a5943075
DE
236# Stage hooks:
237# The main makefile has already created stage?/cp.
238
faf5394a 239c++.stage1: stage1-start
251580ee 240 -mv cp/*$(objext) stage1/cp
faf5394a 241c++.stage2: stage2-start
251580ee 242 -mv cp/*$(objext) stage2/cp
faf5394a 243c++.stage3: stage3-start
251580ee 244 -mv cp/*$(objext) stage3/cp
faf5394a 245c++.stage4: stage4-start
251580ee 246 -mv cp/*$(objext) stage4/cp
b8dad04b
ZW
247
248#\f
249# .o: .h dependencies.
250CXX_TREE_H = $(TREE_H) cp/cp-tree.h c-common.h cp/cp-tree.def c-common.def \
672a6f42 251 function.h varray.h $(SYSTEM_H) $(CONFIG_H) $(TARGET_H) \
b8dad04b
ZW
252 $(srcdir)/../include/hashtab.h $(srcdir)/../include/splay-tree.h
253
e2500fed
GK
254cp/spew.o: cp/spew.c $(CXX_TREE_H) cp/parse.h flags.h cp/lex.h toplev.h \
255 gt-cp-spew.h
b8dad04b 256cp/lex.o: cp/lex.c $(CXX_TREE_H) cp/parse.h flags.h cp/lex.h c-pragma.h \
11642c3a
ZW
257 toplev.h output.h mbchar.h $(GGC_H) input.h diagnostic.h cp/operators.def \
258 $(TM_P_H)
e5f3b786 259cp/cp-lang.o: cp/cp-lang.c $(CXX_TREE_H) toplev.h langhooks.h $(LANGHOOKS_DEF_H) \
ac79cd5a 260 c-common.h
b8dad04b 261cp/decl.o: cp/decl.c $(CXX_TREE_H) flags.h cp/lex.h cp/decl.h stack.h \
e2500fed
GK
262 output.h $(EXPR_H) except.h toplev.h $(HASHTAB_H) $(GGC_H) $(RTL_H) \
263 cp/operators.def $(TM_P_H) tree-inline.h diagnostic.h c-pragma.h \
264 debug.h gt-cp-decl.h gtype-cp.h
b8dad04b 265cp/decl2.o: cp/decl2.c $(CXX_TREE_H) flags.h cp/lex.h cp/decl.h $(EXPR_H) \
e2500fed 266 output.h except.h toplev.h $(GGC_H) $(RTL_H) c-common.h gt-cp-decl2.h
2a2b2d43
GDR
267cp/typeck2.o: cp/typeck2.c $(CXX_TREE_H) flags.h toplev.h output.h $(TM_P_H) \
268 diagnostic.h
269cp/typeck.o: cp/typeck.c $(CXX_TREE_H) flags.h $(RTL_H) $(EXPR_H) toplev.h \
270 diagnostic.h
1af6141b 271cp/class.o: cp/class.c $(CXX_TREE_H) flags.h toplev.h $(RTL_H) $(TARGET_H)
2a2b2d43 272cp/call.o: cp/call.c $(CXX_TREE_H) flags.h toplev.h $(RTL_H) $(EXPR_H) \
e2500fed 273 $(GGC_H) diagnostic.h gt-cp-call.h
b8dad04b
ZW
274cp/friend.o: cp/friend.c $(CXX_TREE_H) flags.h $(RTL_H) toplev.h $(EXPR_H)
275cp/init.o: cp/init.c $(CXX_TREE_H) flags.h $(RTL_H) $(EXPR_H) toplev.h \
276 $(GGC_H) except.h
11642c3a
ZW
277cp/method.o: cp/method.c $(CXX_TREE_H) toplev.h $(GGC_H) $(RTL_H) $(EXPR_H) \
278 $(TM_P_H)
b8dad04b
ZW
279cp/cvt.o: cp/cvt.c $(CXX_TREE_H) cp/decl.h flags.h toplev.h convert.h
280cp/search.o: cp/search.c $(CXX_TREE_H) stack.h flags.h toplev.h $(RTL_H)
281cp/tree.o: cp/tree.c $(CXX_TREE_H) flags.h toplev.h $(GGC_H) $(RTL_H) \
e2500fed 282 insn-config.h integrate.h tree-inline.h real.h gt-cp-tree.h
911e6107 283cp/ptree.o: cp/ptree.c $(CXX_TREE_H) $(SYSTEM_H)
c913b6f1 284cp/rtti.o: cp/rtti.c $(CXX_TREE_H) flags.h toplev.h
b8dad04b 285cp/except.o: cp/except.c $(CXX_TREE_H) flags.h $(RTL_H) except.h toplev.h \
6f30f1f1 286 cp/cfns.h $(EXPR_H) libfuncs.h tree-inline.h
11642c3a
ZW
287cp/expr.o: cp/expr.c $(CXX_TREE_H) $(RTL_H) flags.h $(EXPR_H) toplev.h \
288 except.h $(TM_P_H)
b8dad04b 289cp/pt.o: cp/pt.c $(CXX_TREE_H) cp/decl.h cp/parse.h cp/lex.h toplev.h \
e2500fed 290 $(GGC_H) $(RTL_H) except.h tree-inline.h gt-cp-pt.h
7cb32822 291cp/error.o: cp/error.c $(CXX_TREE_H) toplev.h diagnostic.h flags.h real.h \
e5f3b786 292 $(LANGHOOKS_DEF_H)
e2500fed
GK
293cp/repo.o: cp/repo.c $(CXX_TREE_H) toplev.h $(GGC_H) diagnostic.h \
294 gt-cp-repo.h
b8dad04b 295cp/semantics.o: cp/semantics.c $(CXX_TREE_H) cp/lex.h except.h toplev.h \
25af8512
AO
296 flags.h $(GGC_H) debug.h output.h $(RTL_H) $(TIMEVAR_H) $(EXPR_H) \
297 tree-inline.h
89d684bb 298cp/dump.o: cp/dump.c $(CXX_TREE_H) tree-dump.h
b8dad04b 299cp/optimize.o: cp/optimize.c $(CXX_TREE_H) rtl.h integrate.h insn-config.h \
25af8512 300 input.h $(PARAMS_H) debug.h tree-inline.h
11ad4784 301cp/mangle.o: cp/mangle.c $(CXX_TREE_H) toplev.h real.h
b8dad04b
ZW
302
303cp/parse.o: cp/parse.c $(CXX_TREE_H) flags.h cp/lex.h except.h output.h \
e2500fed 304 $(SYSTEM_H) toplev.h $(GGC_H) gt-cp-parse.h
b8dad04b
ZW
305 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(BIG_SWITCHFLAG) \
306 $(srcdir)/cp/parse.c $(OUTPUT_OPTION)
c00996a3
JM
307#\f
308# These exist for maintenance purposes.
309
310# Update the tags table.
311cp/TAGS: force
312 cd $(srcdir)/cp ; \
3c8c2a0a
JM
313 etags --no-globals -l c `echo *.c | sed 's/parse.c//'` \
314 parse.y *.h ../*.c ../*.h;
c00996a3
JM
315
316.PHONY: cp/TAGS