OSDN Git Service

* cplus-dem.c (optable): Add sizeof.
[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$(exeext)
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
111 $(DEMANGLER_PROG): cxxmain.o underscore.o getopt.o getopt1.o $(LIBDEPS)
112         $(CC) $(ALL_CFLAGS) $(LDFLAGS) $(LIBS) -o $@ \
113           cxxmain.o underscore.o getopt.o getopt1.o
114
115 CXX_SRCS = $(srcdir)/cp/call.c $(srcdir)/cp/decl2.c \
116  $(srcdir)/cp/except.c $(srcdir)/cp/input.c $(srcdir)/cp/pt.c \
117  $(srcdir)/cp/spew.c $(srcdir)/cp/xref.c $(srcdir)/cp/class.c \
118  $(srcdir)/cp/expr.c $(srcdir)/cp/lex.c \
119  $(srcdir)/cp/ptree.c $(srcdir)/cp/tree.c $(srcdir)/cp/cvt.c \
120  $(srcdir)/cp/errfn.c $(srcdir)/cp/rtti.c $(srcdir)/cp/method.c \
121  $(srcdir)/cp/search.c $(srcdir)/cp/typeck.c $(srcdir)/cp/decl.c \
122  $(srcdir)/cp/error.c $(srcdir)/cp/friend.c $(srcdir)/cp/init.c \
123  $(srcdir)/cp/parse.y $(srcdir)/cp/sig.c $(srcdir)/cp/typeck2.c \
124  $(srcdir)/cp/repo.c $(srcdir)/cp/semantics.c
125
126 cc1plus$(exeext): $(P) $(CXX_SRCS) $(LIBDEPS) stamp-objlist c-common.o c-pragma.o \
127         $(srcdir)/cp/cp-tree.h $(srcdir)/cp/cp-tree.def
128         cd cp; $(MAKE) $(FLAGS_TO_PASS) $(CXX_FLAGS_TO_PASS) ../cc1plus$(exeext)
129 #\f
130 # Build hooks:
131
132 c++.all.build: g++$(exeext) $(DEMANGLER_PROG)
133 c++.all.cross: g++-cross$(exeext) $(DEMANGLER_PROG)
134 c++.start.encap: g++$(exeext)
135 c++.rest.encap: $(DEMANGLER_PROG)
136
137 c++.info:
138 c++.dvi:
139
140 # C++ language-support library pieces for libgcc.
141 tinfo.o: cc1plus$(exeext) $(srcdir)/cp/tinfo.cc
142         $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) \
143           -c $(srcdir)/cp/tinfo.cc
144 tinfo2.o: cc1plus$(exeext) $(srcdir)/cp/tinfo2.cc
145         $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) \
146           -c $(srcdir)/cp/tinfo2.cc
147 exception.o: cc1plus$(exeext) $(srcdir)/cp/exception.cc
148         $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) \
149           -c -fexceptions $(srcdir)/cp/exception.cc
150 new.o: cc1plus$(exeext) $(srcdir)/cp/new.cc
151         $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) \
152           -c $(srcdir)/cp/new.cc
153 opnew.o: cc1plus$(exeext) $(srcdir)/cp/new1.cc
154         $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) \
155           -c $(srcdir)/cp/new1.cc -DL_op_new -o opnew.o
156 opnewnt.o: cc1plus$(exeext) $(srcdir)/cp/new1.cc
157         $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) \
158           -c $(srcdir)/cp/new1.cc -DL_op_newnt -o opnewnt.o
159 opvnew.o: cc1plus$(exeext) $(srcdir)/cp/new2.cc
160         $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) \
161           -c $(srcdir)/cp/new2.cc -DL_op_vnew -o opvnew.o
162 opvnewnt.o: cc1plus$(exeext) $(srcdir)/cp/new2.cc
163         $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) \
164           -c $(srcdir)/cp/new2.cc -DL_op_vnewnt -o opvnewnt.o
165 opdel.o: cc1plus$(exeext) $(srcdir)/cp/new2.cc
166         $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) \
167           -c $(srcdir)/cp/new2.cc -DL_op_delete -o opdel.o
168 opdelnt.o: cc1plus$(exeext) $(srcdir)/cp/new2.cc
169         $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) \
170           -c $(srcdir)/cp/new2.cc -DL_op_delnt -o opdelnt.o
171 opvdel.o: cc1plus$(exeext) $(srcdir)/cp/new2.cc
172         $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) \
173           -c $(srcdir)/cp/new2.cc -DL_op_vdel -o opvdel.o
174 opvdelnt.o: cc1plus$(exeext) $(srcdir)/cp/new2.cc
175         $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) \
176           -c $(srcdir)/cp/new2.cc -DL_op_vdelnt -o opvdelnt.o
177
178 # We want to update cplib2.txt if any of the source files change...
179 cplib2.txt: $(CXX_LIB2SRCS) $(CXX_EXTRA_HEADERS) cplib2.ready
180         case " $(LANGUAGES) " in \
181         *" "[cC]"++ "*) \
182           echo $(CXX_LIB2FUNCS) > cplib2.new;; \
183         *) \
184           echo "" > cplib2.new;; \
185         esac
186         mv -f cplib2.new cplib2.txt 
187
188 # Or if it would be different.
189 cplib2.ready: $(GCC_PASSES) $(LANGUAGES) $(LIBGCC2_DEPS) stmp-int-hdrs
190         @if [ -r cplib2.txt ]; then \
191           case " $(LANGUAGES) " in \
192           *" "[cC]"++ "*) \
193             echo $(CXX_LIB2FUNCS) > cplib2.new;; \
194           *) \
195             echo "" > cplib2.new;; \
196           esac; \
197           if cmp -s cplib2.new cplib2.txt; then true; else \
198             touch cplib2.ready; \
199           fi; \
200           rm -f cplib2.new; \
201         else true ; \
202         fi
203         @if [ -f cplib2.ready ]; then true; else \
204           touch cplib2.ready; \
205         fi
206 #\f
207 # Install hooks:
208 # cc1plus is installed elsewhere as part of $(COMPILERS).
209
210 # Nothing to do here.
211 c++.install-normal:
212
213 # Install the driver program as $(target)-g++
214 # and also as either g++ (if native) or $(tooldir)/bin/g++.
215 c++.install-common:
216         -if [ -f cc1plus$(exeext) ] ; then \
217           if [ -f g++-cross$(exeext) ] ; then \
218             rm -f $(bindir)/$(GXX_CROSS_NAME)$(exeext); \
219             $(INSTALL_PROGRAM) g++-cross$(exeext) $(bindir)/$(GXX_CROSS_NAME)$(exeext); \
220             chmod a+x $(bindir)/$(GXX_CROSS_NAME)$(exeext); \
221             rm -f $(bindir)/$(CXX_CROSS_NAME)$(exeext); \
222             $(LN) $(bindir)/$(GXX_CROSS_NAME)$(exeext) $(bindir)/$(CXX_CROSS_NAME)$(exeext); \
223           else \
224             rm -f $(bindir)/$(GXX_INSTALL_NAME)$(exeext); \
225             $(INSTALL_PROGRAM) g++$(exeext) $(bindir)/$(GXX_INSTALL_NAME)$(exeext); \
226             chmod a+x $(bindir)/$(GXX_INSTALL_NAME)$(exeext); \
227             rm -f $(bindir)/$(CXX_INSTALL_NAME)$(exeext); \
228             $(LN) $(bindir)/$(GXX_INSTALL_NAME)$(exeext) $(bindir)/$(CXX_INSTALL_NAME)$(exeext); \
229           fi ; \
230           if [ x$(DEMANGLER_PROG) != x ] && [ -x "$(DEMANGLER_PROG)" ]; then \
231             if [ -f g++-cross$(exeext) ] ; then \
232               rm -f $(bindir)/$(DEMANGLER_CROSS_NAME)$(exeext); \
233               $(INSTALL_PROGRAM) $(DEMANGLER_PROG) $(bindir)/$(DEMANGLER_CROSS_NAME)$(exeext); \
234               chmod a+x $(bindir)/$(DEMANGLER_CROSS_NAME)$(exeext); \
235             else \
236               rm -f $(bindir)/$(DEMANGLER_INSTALL_NAME)$(exeext); \
237               $(INSTALL_PROGRAM) $(DEMANGLER_PROG) $(bindir)/$(DEMANGLER_INSTALL_NAME)$(exeext); \
238               chmod a+x $(bindir)/$(DEMANGLER_INSTALL_NAME)$(exeext); \
239             fi ; \
240           fi ; \
241         fi
242
243 c++.install-info:
244
245 c++.install-man: $(srcdir)/cp/g++.1
246         -if [ -f cc1plus$(exeext) ] ; then \
247           if [ -f g++-cross$(exeext) ] ; then \
248             rm -f $(mandir)/$(GXX_CROSS_NAME)$(manext); \
249             $(INSTALL_DATA) $(srcdir)/cp/g++.1 $(mandir)/$(GXX_CROSS_NAME)$(manext); \
250             chmod a-x $(mandir)/$(GXX_CROSS_NAME)$(manext); \
251           else \
252             rm -f $(mandir)/$(GXX_INSTALL_NAME)$(manext); \
253             $(INSTALL_DATA) $(srcdir)/cp/g++.1 $(mandir)/$(GXX_INSTALL_NAME)$(manext); \
254             chmod a-x $(mandir)/$(GXX_INSTALL_NAME)$(manext); \
255           fi; \
256         else true; fi
257
258 c++.uninstall:
259         -rm -rf $(bindir)/$(CXX_INSTALL_NAME)$(exeext)
260         -rm -rf $(bindir)/$(CXX_CROSS_NAME)$(exeext)
261         -rm -rf $(bindir)/$(GXX_INSTALL_NAME)$(exeext)
262         -rm -rf $(bindir)/$(GXX_CROSS_NAME)$(exeext)
263         -rm -rf $(bindir)/$(DEMANGLER_INSTALL_NAME)$(exeext)
264         -rm -rf $(bindir)/$(DEMANGLER_CROSS_NAME)$(exeext)
265         -rm -rf $(mandir)/$(GXX_INSTALL_NAME)$(manext)
266         -rm -rf $(mandir)/$(GXX_CROSS_NAME)$(manext)
267 #\f
268 # Clean hooks:
269 # A lot of the ancillary files are deleted by the main makefile.
270 # We just have to delete files specific to us.
271
272 c++.mostlyclean:
273         -rm -f cp/*$(objext) $(DEMANGLER_PROG)
274 c++.clean:
275         -rm -f cplib2.txt cplib2.ready
276 c++.distclean:
277         -rm -f cp/config.status cp/Makefile
278         -rm -f cp/parse.output
279         -rm -f g++.c
280 c++.extraclean:
281 c++.maintainer-clean:
282         -rm -f cp/parse.c cp/parse.h
283 #\f
284 # Stage hooks:
285 # The main makefile has already created stage?/cp.
286
287 c++.stage1: stage1-start
288         -mv cp/*$(objext) stage1/cp
289 c++.stage2: stage2-start
290         -mv cp/*$(objext) stage2/cp
291 c++.stage3: stage3-start
292         -mv cp/*$(objext) stage3/cp
293 c++.stage4: stage4-start
294         -mv cp/*$(objext) stage4/cp
295 #\f
296 # Maintenance hooks:
297
298 # This target creates the files that can be rebuilt, but go in the
299 # distribution anyway.  It then copies the files to the distdir directory.
300 c++.distdir:
301         mkdir tmp/cp
302         mkdir tmp/cp/inc
303         cd cp ; $(MAKE) $(FLAGS_TO_PASS) $(CXX_FLAGS_TO_PASS) parse.c hash.h
304         cd cp; \
305         for file in *[0-9a-zA-Z+]; do \
306           $(LN) $$file ../tmp/cp; \
307         done
308         cd cp/inc; \
309         for file in *[0-9a-zA-Z+]; do \
310           ln $$file ../../tmp/cp/inc >/dev/null 2>&1 \
311            || cp $$file ../../tmp/cp/inc; \
312         done