OSDN Git Service

./:
[pf3gnuchains/gcc-fork.git] / gcc / cp / Make-lang.in
1 # Top level makefile fragment for GNU C++.
2 #   Copyright (C) 1994, 1995, 1997 Free Software Foundation, Inc.
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
18 #the Free Software Foundation, 59 Temple Place - Suite 330,
19 #Boston, MA 02111-1307, USA.
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,
28 # foo.mostlyclean, foo.clean, foo.distclean, foo.extraclean,
29 # foo.maintainer-clean, foo.stage1, foo.stage2, foo.stage3, foo.stage4
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.
38 #\f
39 # Extra flags to pass to recursive makes.
40 CXX_FLAGS_TO_PASS = \
41         "CXX_FOR_BUILD=$(CXX_FOR_BUILD)" \
42         "CXXFLAGS=$(CXXFLAGS)" \
43         "CXX_FOR_TARGET=$(CXX_FOR_TARGET)"
44
45 # Actual names to use when installing a native compiler.
46 CXX_INSTALL_NAME = `t='$(program_transform_name)'; echo c++ | sed $$t`
47 GXX_INSTALL_NAME = `t='$(program_transform_name)'; echo g++ | sed $$t`
48
49 # Actual names to use when installing a cross-compiler.
50 CXX_CROSS_NAME = `t='$(program_transform_cross_name)'; echo c++ | sed $$t`
51 GXX_CROSS_NAME = `t='$(program_transform_cross_name)'; echo g++ | sed $$t`
52
53 # The name to use for the demangler program.
54 DEMANGLER_PROG = c++filt
55
56 # Extra headers to install.
57 CXX_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.
61 CXX_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
63 CXX_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
66 #\f
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.
71 C++ c++: cc1plus
72
73 # Tell GNU make to ignore these if they exist.
74 .PHONY: C++ c++
75
76 g++.c: $(srcdir)/gcc.c
77         -rm -f $@
78         $(LN_S) $(srcdir)/gcc.c $@
79
80 g++spec.o: $(srcdir)/cp/g++spec.c
81         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/cp/g++spec.c
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.
87 g++.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
93 # Create the compiler driver for g++.
94 g++$(exeext): g++.o g++spec.o version.o choose-temp.o pexecute.o prefix.o $(LIBDEPS) $(EXTRA_GCC_OBJS)
95         $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ g++.o g++spec.o prefix.o version.o \
96           choose-temp.o pexecute.o $(EXTRA_GCC_OBJS) $(LIBS)
97
98 # Create a version of the g++ driver which calls the cross-compiler.
99 g++-cross$(exeext): g++$(exeext)
100         -rm -f g++-cross$(exeext)
101         cp g++$(exeext) g++-cross$(exeext)
102
103 cxxmain.o: cplus-dem.c demangle.h
104         rm -f cxxmain.c
105         $(LN_S) $(srcdir)/cplus-dem.c cxxmain.c
106         $(CC) -c -DMAIN $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
107           -DVERSION=\"$(version)\" cxxmain.c
108         rm -f cxxmain.c
109
110 $(DEMANGLER_PROG): cxxmain.o underscore.o getopt.o getopt1.o $(LIBDEPS)
111         $(CC) $(ALL_CFLAGS) $(LDFLAGS) $(LIBS) -o $@ \
112           cxxmain.o underscore.o getopt.o getopt1.o
113
114 CXX_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 \
117  $(srcdir)/cp/expr.c $(srcdir)/cp/lex.c \
118  $(srcdir)/cp/ptree.c $(srcdir)/cp/tree.c $(srcdir)/cp/cvt.c \
119  $(srcdir)/cp/errfn.c $(srcdir)/cp/rtti.c $(srcdir)/cp/method.c \
120  $(srcdir)/cp/search.c $(srcdir)/cp/typeck.c $(srcdir)/cp/decl.c \
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
124
125 cc1plus: $(P) $(CXX_SRCS) $(LIBDEPS) stamp-objlist c-common.o c-pragma.o
126         cd cp; $(MAKE) $(FLAGS_TO_PASS) $(CXX_FLAGS_TO_PASS) ../cc1plus
127 #\f
128 # Build hooks:
129
130 c++.all.build: g++$(exeext) $(DEMANGLER_PROG)
131 c++.all.cross: g++-cross$(exeext) $(DEMANGLER_PROG)
132 c++.start.encap: g++$(exeext)
133 c++.rest.encap: $(DEMANGLER_PROG)
134
135 c++.info:
136 c++.dvi:
137
138 # C++ language-support library pieces for libgcc.
139 tinfo.o: cc1plus $(srcdir)/cp/tinfo.cc
140         $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) \
141           -c $(srcdir)/cp/tinfo.cc
142 tinfo2.o: cc1plus $(srcdir)/cp/tinfo2.cc
143         $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) \
144           -c $(srcdir)/cp/tinfo2.cc
145 exception.o: cc1plus $(srcdir)/cp/exception.cc
146         $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) \
147           -c -fexceptions $(srcdir)/cp/exception.cc
148 new.o: cc1plus $(srcdir)/cp/new.cc
149         $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) \
150           -c $(srcdir)/cp/new.cc
151 opnew.o: cc1plus $(srcdir)/cp/new1.cc
152         $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) \
153           -c $(srcdir)/cp/new1.cc -DL_op_new -o opnew.o
154 opnewnt.o: cc1plus $(srcdir)/cp/new1.cc
155         $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) \
156           -c $(srcdir)/cp/new1.cc -DL_op_newnt -o opnewnt.o
157 opvnew.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
160 opvnewnt.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
163 opdel.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
166 opdelnt.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
169 opvdel.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
172 opvdelnt.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
175
176 # We want to update cplib2.txt if any of the source files change...
177 cplib2.txt: $(CXX_LIB2SRCS) $(CXX_EXTRA_HEADERS) cplib2.ready
178         case " $(LANGUAGES) " in \
179         *" "[cC]"++ "*) \
180           echo $(CXX_LIB2FUNCS) > cplib2.new;; \
181         *) \
182           echo "" > cplib2.new;; \
183         esac
184         mv -f cplib2.new cplib2.txt 
185
186 # Or if it would be different.
187 cplib2.ready: $(GCC_PASSES) $(LANGUAGES) $(LIBGCC2_DEPS) stmp-int-hdrs
188         @if [ -r cplib2.txt ]; then \
189           case " $(LANGUAGES) " in \
190           *" "[cC]"++ "*) \
191             echo $(CXX_LIB2FUNCS) > cplib2.new;; \
192           *) \
193             echo "" > cplib2.new;; \
194           esac; \
195           if cmp -s cplib2.new cplib2.txt; then true; else \
196             touch cplib2.ready; \
197           fi; \
198           rm -f cplib2.new; \
199         else true ; \
200         fi
201         @if [ -f cplib2.ready ]; then true; else \
202           touch cplib2.ready; \
203         fi
204 #\f
205 # Install hooks:
206 # cc1plus is installed elsewhere as part of $(COMPILERS).
207
208 # Nothing to do here.
209 c++.install-normal:
210
211 # Install the driver program as $(target)-g++
212 # and also as either g++ (if native) or $(tooldir)/bin/g++.
213 c++.install-common:
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); \
220             $(LN) $(bindir)/$(GXX_CROSS_NAME)$(exeext) $(bindir)/$(CXX_CROSS_NAME)$(exeext); \
221           else \
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); \
226             $(LN) $(bindir)/$(GXX_INSTALL_NAME)$(exeext) $(bindir)/$(CXX_INSTALL_NAME)$(exeext); \
227           fi ; \
228         fi
229
230 c++.install-info:
231
232 c++.install-man: $(srcdir)/cp/g++.1
233         -if [ -f cc1plus$(exeext) ] ; then \
234           if [ -f g++-cross$(exeext) ] ; then \
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; \
243         else true; fi
244
245 c++.uninstall:
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)
250         -rm -rf $(mandir)/$(GXX_INSTALL_NAME)$(manext)
251         -rm -rf $(mandir)/$(GXX_CROSS_NAME)$(manext)
252 #\f
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
257 c++.mostlyclean:
258         -rm -f cp/*$(objext) $(DEMANGLER_PROG)
259 c++.clean:
260         -rm -f cplib2.txt cplib2.ready
261 c++.distclean:
262         -rm -f cp/config.status cp/Makefile
263         -rm -f cp/parse.output
264         -rm -f g++.c
265 c++.extraclean:
266 c++.maintainer-clean:
267         -rm -f cp/parse.c cp/parse.h
268 #\f
269 # Stage hooks:
270 # The main makefile has already created stage?/cp.
271
272 c++.stage1: stage1-start
273         -mv cp/*$(objext) stage1/cp
274 c++.stage2: stage2-start
275         -mv cp/*$(objext) stage2/cp
276 c++.stage3: stage3-start
277         -mv cp/*$(objext) stage3/cp
278 c++.stage4: stage4-start
279         -mv cp/*$(objext) stage4/cp
280 #\f
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.
285 c++.distdir:
286         mkdir tmp/cp
287         mkdir tmp/cp/inc
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 \
291           $(LN) $$file ../tmp/cp; \
292         done
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