]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/cp/Make-lang.in
Merge from gcc-2.8
[thirdparty/gcc.git] / gcc / cp / Make-lang.in
CommitLineData
a5943075 1# Top level makefile fragment for GNU C++.
c7ae64f2 2# Copyright (C) 1994, 1995, 1997 Free Software Foundation, Inc.
a5943075
DE
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.
a5943075
DE
20
21# This file provides the language dependent support in the main Makefile.
22# Each language makefile fragment must provide the following targets:
23#
24# foo.all.build, foo.all.cross, foo.start.encap, foo.rest.encap,
25# foo.info, foo.dvi,
26# foo.install-normal, foo.install-common, foo.install-info, foo.install-man,
27# foo.uninstall, foo.distdir,
f1908d70
RK
28# foo.mostlyclean, foo.clean, foo.distclean, foo.extraclean,
29# foo.maintainer-clean, foo.stage1, foo.stage2, foo.stage3, foo.stage4
a5943075
DE
30#
31# where `foo' is the name of the language.
32#
33# It should also provide rules for:
34#
35# - making any compiler driver (eg: g++)
36# - the compiler proper (eg: cc1plus)
37# - define the names for selecting the language in LANGUAGES.
6633d636 38#\f
a5943075
DE
39# Extra flags to pass to recursive makes.
40CXX_FLAGS_TO_PASS = \
41 "CXX_FOR_BUILD=$(CXX_FOR_BUILD)" \
42 "CXXFLAGS=$(CXXFLAGS)" \
43 "CXX_FOR_TARGET=$(CXX_FOR_TARGET)"
44
a0a33927 45# Actual names to use when installing a native compiler.
8aa3abc8
DE
46CXX_INSTALL_NAME = `t='$(program_transform_name)'; echo c++ | sed $$t`
47GXX_INSTALL_NAME = `t='$(program_transform_name)'; echo g++ | sed $$t`
a0a33927
MS
48
49# Actual names to use when installing a cross-compiler.
8aa3abc8
DE
50CXX_CROSS_NAME = `t='$(program_transform_cross_name)'; echo c++ | sed $$t`
51GXX_CROSS_NAME = `t='$(program_transform_cross_name)'; echo g++ | sed $$t`
a0a33927 52
863adfc0
MS
53# The name to use for the demangler program.
54DEMANGLER_PROG = c++filt
5156628f
MS
55
56# Extra headers to install.
57CXX_EXTRA_HEADERS = $(srcdir)/cp/inc/typeinfo $(srcdir)/cp/inc/exception \
58 $(srcdir)/cp/inc/new $(srcdir)/cp/inc/new.h
59
60# Extra code to include in libgcc2.
ced78d8b
JM
61CXX_LIB2FUNCS = tinfo.o tinfo2.o new.o opnew.o opnewnt.o opvnew.o opvnewnt.o \
62 opdel.o opdelnt.o opvdel.o opvdelnt.o exception.o
824b9a4c
MS
63CXX_LIB2SRCS = $(srcdir)/cp/new.cc $(srcdir)/cp/new1.cc $(srcdir)/cp/new2.cc \
64 $(srcdir)/cp/exception.cc $(srcdir)/cp/tinfo.cc \
65 $(srcdir)/cp/tinfo2.cc $(srcdir)/cp/tinfo.h
6633d636 66#\f
a5943075
DE
67# Define the names for selecting c++ in LANGUAGES.
68# Note that it would be nice to move the dependency on g++
69# into the C++ rule, but that needs a little bit of work
70# to do the right thing within all.cross.
71C++ c++: cc1plus
72
5edb8b93
MS
73# Tell GNU make to ignore these if they exist.
74.PHONY: C++ c++
75
d2e5ee5c
MS
76g++.c: $(srcdir)/gcc.c
77 -rm -f $@
ac64120e 78 $(LN_S) $(srcdir)/gcc.c $@
d2e5ee5c
MS
79
80g++spec.o: $(srcdir)/cp/g++spec.c
f7da6097 81 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/cp/g++spec.c
d2e5ee5c
MS
82
83# N.B.: This is a copy of the gcc.o rule, with -DLANG_SPECIFIC_DRIVER added.
84# It'd be nice if we could find an easier way to do this---rather than have
85# to track changes to the toplevel gcc Makefile as well.
86# We depend on g++.c last, to make it obvious where it came from.
87g++.o: $(CONFIG_H) multilib.h config.status $(lang_specs_files) g++.c
88 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
89 $(DRIVER_DEFINES) \
90 -DLANG_SPECIFIC_DRIVER \
91 -c g++.c
92
a5943075 93# Create the compiler driver for g++.
e9a25f70 94g++$(exeext): g++.o g++spec.o version.o choose-temp.o pexecute.o prefix.o $(LIBDEPS) $(EXTRA_GCC_OBJS)
956d6950
JL
95 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ g++.o g++spec.o prefix.o \
96 version.o choose-temp.o pexecute.o $(EXTRA_GCC_OBJS) $(LIBS)
a5943075
DE
97
98# Create a version of the g++ driver which calls the cross-compiler.
d2e5ee5c
MS
99g++-cross$(exeext): g++$(exeext)
100 -rm -f g++-cross$(exeext)
101 cp g++$(exeext) g++-cross$(exeext)
a5943075 102
863adfc0
MS
103cxxmain.o: cplus-dem.c demangle.h
104 rm -f cxxmain.c
ac64120e 105 $(LN_S) $(srcdir)/cplus-dem.c cxxmain.c
863adfc0 106 $(CC) -c -DMAIN $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
78696538 107 -DVERSION=\"$(version)\" cxxmain.c
863adfc0
MS
108 rm -f cxxmain.c
109
31a00187
RK
110$(DEMANGLER_PROG): cxxmain.o underscore.o getopt.o getopt1.o $(LIBDEPS)
111 $(CC) $(ALL_CFLAGS) $(LDFLAGS) $(LIBS) -o $@ \
863adfc0
MS
112 cxxmain.o underscore.o getopt.o getopt1.o
113
a5943075
DE
114CXX_SRCS = $(srcdir)/cp/call.c $(srcdir)/cp/decl2.c \
115 $(srcdir)/cp/except.c $(srcdir)/cp/input.c $(srcdir)/cp/pt.c \
116 $(srcdir)/cp/spew.c $(srcdir)/cp/xref.c $(srcdir)/cp/class.c \
9e9ff709 117 $(srcdir)/cp/expr.c $(srcdir)/cp/lex.c \
a5943075 118 $(srcdir)/cp/ptree.c $(srcdir)/cp/tree.c $(srcdir)/cp/cvt.c \
9e9ff709 119 $(srcdir)/cp/errfn.c $(srcdir)/cp/rtti.c $(srcdir)/cp/method.c \
a5943075 120 $(srcdir)/cp/search.c $(srcdir)/cp/typeck.c $(srcdir)/cp/decl.c \
bd6dd845
MS
121 $(srcdir)/cp/error.c $(srcdir)/cp/friend.c $(srcdir)/cp/init.c \
122 $(srcdir)/cp/parse.y $(srcdir)/cp/sig.c $(srcdir)/cp/typeck2.c \
123 $(srcdir)/cp/repo.c
a5943075 124
6060a796 125cc1plus: $(P) $(CXX_SRCS) $(LIBDEPS) stamp-objlist c-common.o c-pragma.o
ccef7c3f 126 cd cp; $(MAKE) $(FLAGS_TO_PASS) $(CXX_FLAGS_TO_PASS) ../cc1plus
6633d636 127#\f
a5943075
DE
128# Build hooks:
129
824b9a4c
MS
130c++.all.build: g++$(exeext) $(DEMANGLER_PROG)
131c++.all.cross: g++-cross$(exeext) $(DEMANGLER_PROG)
132c++.start.encap: g++$(exeext)
863adfc0 133c++.rest.encap: $(DEMANGLER_PROG)
a5943075
DE
134
135c++.info:
136c++.dvi:
5156628f
MS
137
138# C++ language-support library pieces for libgcc.
139tinfo.o: cc1plus $(srcdir)/cp/tinfo.cc
140 $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) \
141 -c $(srcdir)/cp/tinfo.cc
142tinfo2.o: cc1plus $(srcdir)/cp/tinfo2.cc
143 $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) \
144 -c $(srcdir)/cp/tinfo2.cc
145exception.o: cc1plus $(srcdir)/cp/exception.cc
146 $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) \
eb66be0e 147 -c -fexceptions $(srcdir)/cp/exception.cc
5156628f
MS
148new.o: cc1plus $(srcdir)/cp/new.cc
149 $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) \
150 -c $(srcdir)/cp/new.cc
ced78d8b 151opnew.o: cc1plus $(srcdir)/cp/new1.cc
824b9a4c 152 $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) \
ced78d8b
JM
153 -c $(srcdir)/cp/new1.cc -DL_op_new -o opnew.o
154opnewnt.o: cc1plus $(srcdir)/cp/new1.cc
824b9a4c 155 $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) \
ced78d8b
JM
156 -c $(srcdir)/cp/new1.cc -DL_op_newnt -o opnewnt.o
157opvnew.o: cc1plus $(srcdir)/cp/new2.cc
158 $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) \
159 -c $(srcdir)/cp/new2.cc -DL_op_vnew -o opvnew.o
160opvnewnt.o: cc1plus $(srcdir)/cp/new2.cc
161 $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) \
162 -c $(srcdir)/cp/new2.cc -DL_op_vnewnt -o opvnewnt.o
163opdel.o: cc1plus $(srcdir)/cp/new2.cc
164 $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) \
165 -c $(srcdir)/cp/new2.cc -DL_op_delete -o opdel.o
166opdelnt.o: cc1plus $(srcdir)/cp/new2.cc
167 $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) \
168 -c $(srcdir)/cp/new2.cc -DL_op_delnt -o opdelnt.o
169opvdel.o: cc1plus $(srcdir)/cp/new2.cc
170 $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) \
171 -c $(srcdir)/cp/new2.cc -DL_op_vdel -o opvdel.o
172opvdelnt.o: cc1plus $(srcdir)/cp/new2.cc
173 $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) \
174 -c $(srcdir)/cp/new2.cc -DL_op_vdelnt -o opvdelnt.o
5156628f
MS
175
176# We want to update cplib2.txt if any of the source files change...
177cplib2.txt: $(CXX_LIB2SRCS) $(CXX_EXTRA_HEADERS) cplib2.ready
8dff1027
MS
178 case " $(LANGUAGES) " in \
179 *" "[cC]"++ "*) \
180 echo $(CXX_LIB2FUNCS) > cplib2.new;; \
181 *) \
182 echo "" > cplib2.new;; \
183 esac
5156628f
MS
184 mv -f cplib2.new cplib2.txt
185
186# Or if it would be different.
27b81fc2 187cplib2.ready: $(GCC_PASSES) $(LANGUAGES) $(LIBGCC2_DEPS) stmp-int-hdrs
5156628f 188 @if [ -r cplib2.txt ]; then \
8dff1027
MS
189 case " $(LANGUAGES) " in \
190 *" "[cC]"++ "*) \
191 echo $(CXX_LIB2FUNCS) > cplib2.new;; \
192 *) \
193 echo "" > cplib2.new;; \
194 esac; \
f49422da 195 if cmp -s cplib2.new cplib2.txt; then true; else \
5156628f
MS
196 touch cplib2.ready; \
197 fi; \
198 rm -f cplib2.new; \
faf5394a 199 else true ; \
5156628f
MS
200 fi
201 @if [ -f cplib2.ready ]; then true; else \
202 touch cplib2.ready; \
203 fi
6633d636 204#\f
a5943075
DE
205# Install hooks:
206# cc1plus is installed elsewhere as part of $(COMPILERS).
207
208# Nothing to do here.
209c++.install-normal:
210
211# Install the driver program as $(target)-g++
212# and also as either g++ (if native) or $(tooldir)/bin/g++.
213c++.install-common:
be81d4d7
DR
214 -if [ -f cc1plus$(exeext) ] ; then \
215 if [ -f g++-cross$(exeext) ] ; then \
216 rm -f $(bindir)/$(GXX_CROSS_NAME)$(exeext); \
217 $(INSTALL_PROGRAM) g++-cross$(exeext) $(bindir)/$(GXX_CROSS_NAME)$(exeext); \
218 chmod a+x $(bindir)/$(GXX_CROSS_NAME)$(exeext); \
219 rm -f $(bindir)/$(CXX_CROSS_NAME)$(exeext); \
ac64120e 220 $(LN) $(bindir)/$(GXX_CROSS_NAME)$(exeext) $(bindir)/$(CXX_CROSS_NAME)$(exeext); \
a5943075 221 else \
be81d4d7
DR
222 rm -f $(bindir)/$(GXX_INSTALL_NAME)$(exeext); \
223 $(INSTALL_PROGRAM) g++$(exeext) $(bindir)/$(GXX_INSTALL_NAME)$(exeext); \
224 chmod a+x $(bindir)/$(GXX_INSTALL_NAME)$(exeext); \
225 rm -f $(bindir)/$(CXX_INSTALL_NAME)$(exeext); \
ac64120e 226 $(LN) $(bindir)/$(GXX_INSTALL_NAME)$(exeext) $(bindir)/$(CXX_INSTALL_NAME)$(exeext); \
a5943075
DE
227 fi ; \
228 fi
229
230c++.install-info:
231
232c++.install-man: $(srcdir)/cp/g++.1
be81d4d7 233 -if [ -f cc1plus$(exeext) ] ; then \
251580ee 234 if [ -f g++-cross$(exeext) ] ; then \
04dbaf1f
DE
235 rm -f $(mandir)/$(GXX_CROSS_NAME)$(manext); \
236 $(INSTALL_DATA) $(srcdir)/cp/g++.1 $(mandir)/$(GXX_CROSS_NAME)$(manext); \
237 chmod a-x $(mandir)/$(GXX_CROSS_NAME)$(manext); \
238 else \
239 rm -f $(mandir)/$(GXX_INSTALL_NAME)$(manext); \
240 $(INSTALL_DATA) $(srcdir)/cp/g++.1 $(mandir)/$(GXX_INSTALL_NAME)$(manext); \
241 chmod a-x $(mandir)/$(GXX_INSTALL_NAME)$(manext); \
242 fi; \
a5943075
DE
243 else true; fi
244
245c++.uninstall:
be81d4d7
DR
246 -rm -rf $(bindir)/$(CXX_INSTALL_NAME)$(exeext)
247 -rm -rf $(bindir)/$(CXX_CROSS_NAME)$(exeext)
248 -rm -rf $(bindir)/$(GXX_INSTALL_NAME)$(exeext)
249 -rm -rf $(bindir)/$(GXX_CROSS_NAME)$(exeext)
04dbaf1f
DE
250 -rm -rf $(mandir)/$(GXX_INSTALL_NAME)$(manext)
251 -rm -rf $(mandir)/$(GXX_CROSS_NAME)$(manext)
6633d636 252#\f
a5943075
DE
253# Clean hooks:
254# A lot of the ancillary files are deleted by the main makefile.
255# We just have to delete files specific to us.
256
257c++.mostlyclean:
227c77e2 258 -rm -f cp/*$(objext) $(DEMANGLER_PROG)
a5943075 259c++.clean:
5156628f 260 -rm -f cplib2.txt cplib2.ready
a5943075
DE
261c++.distclean:
262 -rm -f cp/config.status cp/Makefile
263 -rm -f cp/parse.output
da20811c 264 -rm -f g++.c
a5943075 265c++.extraclean:
f1908d70 266c++.maintainer-clean:
a5943075 267 -rm -f cp/parse.c cp/parse.h
6633d636 268#\f
a5943075
DE
269# Stage hooks:
270# The main makefile has already created stage?/cp.
271
faf5394a 272c++.stage1: stage1-start
251580ee 273 -mv cp/*$(objext) stage1/cp
faf5394a 274c++.stage2: stage2-start
251580ee 275 -mv cp/*$(objext) stage2/cp
faf5394a 276c++.stage3: stage3-start
251580ee 277 -mv cp/*$(objext) stage3/cp
faf5394a 278c++.stage4: stage4-start
251580ee 279 -mv cp/*$(objext) stage4/cp
6633d636 280#\f
a5943075
DE
281# Maintenance hooks:
282
283# This target creates the files that can be rebuilt, but go in the
284# distribution anyway. It then copies the files to the distdir directory.
285c++.distdir:
187ce432 286 mkdir tmp/cp
c7ae64f2 287 mkdir tmp/cp/inc
a5943075
DE
288 cd cp ; $(MAKE) $(FLAGS_TO_PASS) $(CXX_FLAGS_TO_PASS) parse.c hash.h
289 cd cp; \
290 for file in *[0-9a-zA-Z+]; do \
ac64120e 291 $(LN) $$file ../tmp/cp; \
a5943075 292 done
c7ae64f2
JM
293 cd cp/inc; \
294 for file in *[0-9a-zA-Z+]; do \
295 ln $$file ../../tmp/cp/inc >/dev/null 2>&1 \
296 || cp $$file ../../tmp/cp/inc; \
297 done