OSDN Git Service

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