OSDN Git Service

* cp-tree.h (cp_tree_index): Remove Java types.
[pf3gnuchains/gcc-fork.git] / gcc / cp / Make-lang.in
1 # Top level makefile fragment for GNU C++.
2 #   Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000
3 #   Free Software Foundation, Inc.
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
19 #the Free Software Foundation, 59 Temple Place - Suite 330,
20 #Boston, MA 02111-1307, USA.
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,
28 # foo.uninstall, foo.distdir,
29 # foo.mostlyclean, foo.clean, foo.distclean, foo.extraclean,
30 # foo.maintainer-clean, foo.stage1, foo.stage2, foo.stage3, foo.stage4
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.
39 #\f
40 # Extra flags to pass to recursive makes.
41 CXX_FLAGS_TO_PASS = \
42         "CXX_FOR_BUILD=$(CXX_FOR_BUILD)" \
43         "CXXFLAGS=$(CXXFLAGS)" \
44         "CXX_FOR_TARGET=$(CXX_FOR_TARGET)"
45
46 # Actual names to use when installing a native compiler.
47 CXX_INSTALL_NAME = `t='$(program_transform_name)'; echo c++ | sed $$t`
48 GXX_INSTALL_NAME = `t='$(program_transform_name)'; echo g++ | sed $$t`
49 DEMANGLER_INSTALL_NAME = `t='$(program_transform_name)'; echo c++filt | sed $$t`
50
51 # Actual names to use when installing a cross-compiler.
52 CXX_CROSS_NAME = `t='$(program_transform_cross_name)'; echo c++ | sed $$t`
53 GXX_CROSS_NAME = `t='$(program_transform_cross_name)'; echo g++ | sed $$t`
54 DEMANGLER_CROSS_NAME = `t='$(program_transform_cross_name)'; echo c++filt | sed $$t`
55
56 # The name to use for the demangler program.
57 DEMANGLER_PROG = c++filt$(exeext)
58
59 # Extra headers to install.
60 CXX_EXTRA_HEADERS = $(srcdir)/cp/inc/typeinfo $(srcdir)/cp/inc/exception \
61         $(srcdir)/cp/inc/new $(srcdir)/cp/inc/new.h $(srcdir)/cp/inc/cxxabi.h
62
63 # Extra code to include in libgcc2.
64 CXX_LIB2FUNCS = tinfo.o tinfo2.o new.o opnew.o opnewnt.o opvnew.o opvnewnt.o \
65         opdel.o opdelnt.o opvdel.o opvdelnt.o exception.o vec.o
66 CXX_LIB2SRCS = $(srcdir)/cp/new.cc $(srcdir)/cp/new1.cc $(srcdir)/cp/new2.cc \
67         $(srcdir)/cp/exception.cc $(srcdir)/cp/tinfo.cc \
68         $(srcdir)/cp/tinfo2.cc $(srcdir)/cp/tinfo.h
69 #\f
70 # Define the names for selecting c++ in LANGUAGES.
71 # Note that it would be nice to move the dependency on g++
72 # into the C++ rule, but that needs a little bit of work
73 # to do the right thing within all.cross.
74 C++ c++: cc1plus$(exeext)
75
76 # Tell GNU make to ignore these if they exist.
77 .PHONY: C++ c++
78
79 g++spec.o: $(srcdir)/cp/g++spec.c system.h $(GCC_H)
80         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/cp/g++spec.c
81
82 $(INTL_TARGETS): $(srcdir)/cp/parse.c
83 $(srcdir)/cp/parse.c: $(srcdir)/cp/parse.y
84         @cp_srcdir=`sed -n 's/^srcdir[  ]*=[     ]*//p' cp/Makefile` && \
85         echo "cd cp && $(MAKE) $$cp_srcdir/parse.c" && \
86         cd cp && \
87           $(MAKE) $(LANG_FLAGS_TO_PASS) $(CXX_FLAGS_TO_PASS) \
88             $$cp_srcdir/parse.c
89
90 # Create the compiler driver for g++.
91 GXX_OBJS = gcc.o g++spec.o intl.o prefix.o version.o 
92 g++$(exeext): $(GXX_OBJS) $(EXTRA_GCC_OBJS) $(LIBDEPS)
93         $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
94           $(GXX_OBJS) $(EXTRA_GCC_OBJS) $(LIBS)
95
96 # Create a version of the g++ driver which calls the cross-compiler.
97 g++-cross$(exeext): g++$(exeext)
98         -rm -f g++-cross$(exeext)
99         cp g++$(exeext) g++-cross$(exeext)
100
101 cxxmain.o: $(srcdir)/../libiberty/cplus-dem.c $(DEMANGLE_H)
102         rm -f cxxmain.c
103         $(LN_S) $(srcdir)/../libiberty/cplus-dem.c cxxmain.c
104         $(CC) -c -DMAIN $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
105           -DVERSION=\"$(version)\" cxxmain.c
106
107 # Apparently OpenVM needs the -o to be at the beginning of the link line.
108 $(DEMANGLER_PROG): cxxmain.o underscore.o $(LIBDEPS)
109         $(CC) -o $@ $(ALL_CFLAGS) $(LDFLAGS) \
110           cxxmain.o underscore.o $(LIBS)
111
112 CXX_SRCS = $(srcdir)/cp/call.c $(srcdir)/cp/class.c $(srcdir)/cp/cp-tree.def \
113  $(srcdir)/cp/cp-tree.h $(srcdir)/cp/cvt.c $(srcdir)/cp/decl.c \
114  $(srcdir)/cp/decl.h $(srcdir)/cp/decl2.c $(srcdir)/cp/dump.c \
115  $(srcdir)/cp/errfn.c $(srcdir)/cp/error.c $(srcdir)/cp/except.c \
116  $(srcdir)/cp/expr.c $(srcdir)/cp/friend.c $(srcdir)/cp/init.c \
117  $(srcdir)/cp/input.c $(srcdir)/cp/lex.c $(srcdir)/cp/lex.h \
118  $(srcdir)/cp/mangle.c $(srcdir)/cp/method.c $(srcdir)/cp/optimize.c \
119  $(srcdir)/cp/parse.y $(srcdir)/cp/pt.c $(srcdir)/cp/ptree.c \
120  $(srcdir)/cp/repo.c $(srcdir)/cp/rtti.c $(srcdir)/cp/search.c \
121  $(srcdir)/cp/semantics.c $(srcdir)/cp/spew.c $(srcdir)/cp/tree.c \
122  $(srcdir)/cp/typeck.c $(srcdir)/cp/typeck2.c $(srcdir)/cp/xref.c
123
124 cc1plus$(exeext): $(P) $(CXX_SRCS) $(LIBDEPS) stamp-objlist c-common.o \
125         c-pragma.o $(srcdir)/cp/cp-tree.h $(srcdir)/cp/cp-tree.def \
126         $(srcdir)/cp/gxx.gperf $(srcdir)/cp/cfns.gperf hash.o \
127         $(srcdir)/cp/operators.def
128         cd cp; $(MAKE) $(LANG_FLAGS_TO_PASS) $(CXX_FLAGS_TO_PASS) ../cc1plus$(exeext)
129 #\f
130 # Build hooks:
131
132 c++.all.build: g++$(exeext)
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) $(GXX_ABI_FLAG) $(CXXFLAGS) $(INCLUDES) \
143           -c $(srcdir)/cp/tinfo.cc
144 tinfo2.o: cc1plus$(exeext) $(srcdir)/cp/tinfo2.cc
145         $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(GXX_ABI_FLAG) $(CXXFLAGS) $(INCLUDES) \
146           -c $(srcdir)/cp/tinfo2.cc
147 exception.o: cc1plus$(exeext) $(srcdir)/cp/exception.cc
148         $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(GXX_ABI_FLAG) $(CXXFLAGS) $(INCLUDES) \
149           -c -fexceptions $(srcdir)/cp/exception.cc
150 new.o: cc1plus$(exeext) $(srcdir)/cp/new.cc
151         $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(GXX_ABI_FLAG) $(CXXFLAGS) $(INCLUDES) \
152           -c $(srcdir)/cp/new.cc
153 opnew.o: cc1plus$(exeext) $(srcdir)/cp/new1.cc
154         $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(GXX_ABI_FLAG) $(CXXFLAGS) $(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) $(GXX_ABI_FLAG) $(CXXFLAGS) $(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) $(GXX_ABI_FLAG) $(CXXFLAGS) $(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) $(GXX_ABI_FLAG) $(CXXFLAGS) $(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) $(GXX_ABI_FLAG) $(CXXFLAGS) $(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) $(GXX_ABI_FLAG) $(CXXFLAGS) $(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) $(GXX_ABI_FLAG) $(CXXFLAGS) $(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) $(GXX_ABI_FLAG) $(CXXFLAGS) $(INCLUDES) \
176           -c $(srcdir)/cp/new2.cc -DL_op_vdelnt -o opvdelnt.o
177 vec.o: cc1plus$(exeext) $(srcdir)/cp/vec.cc
178         $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(GXX_ABI_FLAG) $(CXXFLAGS) $(INCLUDES) \
179           -c $(srcdir)/cp/vec.cc -o vec.o
180
181 # We want to update cplib2.txt if any of the source files change...
182 cplib2.txt: $(CXX_LIB2SRCS) $(CXX_EXTRA_HEADERS)
183         case " $(LANGUAGES) " in \
184         *" "[cC]"++ "*) \
185           echo $(CXX_LIB2FUNCS) > cplib2.new;; \
186         *) \
187           echo "" > cplib2.new;; \
188         esac
189         mv -f cplib2.new cplib2.txt 
190
191 #\f
192 # Install hooks:
193 # cc1plus is installed elsewhere as part of $(COMPILERS).
194
195 # Nothing to do here.
196 c++.install-normal:
197
198 # Install the driver program as $(target)-g++
199 # and also as either g++ (if native) or $(tooldir)/bin/g++.
200 c++.install-common:
201         -if [ -f cc1plus$(exeext) ] ; then \
202           if [ -f g++-cross$(exeext) ] ; then \
203             rm -f $(bindir)/$(GXX_CROSS_NAME)$(exeext); \
204             $(INSTALL_PROGRAM) g++-cross$(exeext) $(bindir)/$(GXX_CROSS_NAME)$(exeext); \
205             chmod a+x $(bindir)/$(GXX_CROSS_NAME)$(exeext); \
206             rm -f $(bindir)/$(CXX_CROSS_NAME)$(exeext); \
207             $(LN) $(bindir)/$(GXX_CROSS_NAME)$(exeext) $(bindir)/$(CXX_CROSS_NAME)$(exeext); \
208           else \
209             rm -f $(bindir)/$(GXX_INSTALL_NAME)$(exeext); \
210             $(INSTALL_PROGRAM) g++$(exeext) $(bindir)/$(GXX_INSTALL_NAME)$(exeext); \
211             chmod a+x $(bindir)/$(GXX_INSTALL_NAME)$(exeext); \
212             rm -f $(bindir)/$(CXX_INSTALL_NAME)$(exeext); \
213             $(LN) $(bindir)/$(GXX_INSTALL_NAME)$(exeext) $(bindir)/$(CXX_INSTALL_NAME)$(exeext); \
214           fi ; \
215           if [ x$(DEMANGLER_PROG) != x ] && [ -x "$(DEMANGLER_PROG)" ]; then \
216             if [ -f g++-cross$(exeext) ] ; then \
217               rm -f $(bindir)/$(DEMANGLER_CROSS_NAME)$(exeext); \
218               $(INSTALL_PROGRAM) $(DEMANGLER_PROG) $(bindir)/$(DEMANGLER_CROSS_NAME)$(exeext); \
219               chmod a+x $(bindir)/$(DEMANGLER_CROSS_NAME)$(exeext); \
220             else \
221               rm -f $(bindir)/$(DEMANGLER_INSTALL_NAME)$(exeext); \
222               $(INSTALL_PROGRAM) $(DEMANGLER_PROG) $(bindir)/$(DEMANGLER_INSTALL_NAME)$(exeext); \
223               chmod a+x $(bindir)/$(DEMANGLER_INSTALL_NAME)$(exeext); \
224             fi ; \
225           fi ; \
226         fi
227
228 c++.install-info:
229
230 c++.install-man: $(srcdir)/cp/g++.1
231         -if [ -f cc1plus$(exeext) ] ; then \
232           if [ -f g++-cross$(exeext) ] ; then \
233             rm -f $(man1dir)/$(GXX_CROSS_NAME)$(manext); \
234             $(INSTALL_DATA) $(srcdir)/cp/g++.1 $(man1dir)/$(GXX_CROSS_NAME)$(manext); \
235             chmod a-x $(man1dir)/$(GXX_CROSS_NAME)$(manext); \
236           else \
237             rm -f $(man1dir)/$(GXX_INSTALL_NAME)$(manext); \
238             $(INSTALL_DATA) $(srcdir)/cp/g++.1 $(man1dir)/$(GXX_INSTALL_NAME)$(manext); \
239             chmod a-x $(man1dir)/$(GXX_INSTALL_NAME)$(manext); \
240           fi; \
241         else true; fi
242
243 c++.uninstall:
244         -rm -rf $(bindir)/$(CXX_INSTALL_NAME)$(exeext)
245         -rm -rf $(bindir)/$(CXX_CROSS_NAME)$(exeext)
246         -rm -rf $(bindir)/$(GXX_INSTALL_NAME)$(exeext)
247         -rm -rf $(bindir)/$(GXX_CROSS_NAME)$(exeext)
248         -rm -rf $(bindir)/$(DEMANGLER_INSTALL_NAME)$(exeext)
249         -rm -rf $(bindir)/$(DEMANGLER_CROSS_NAME)$(exeext)
250         -rm -rf $(man1dir)/$(GXX_INSTALL_NAME)$(manext)
251         -rm -rf $(man1dir)/$(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
261 c++.distclean:
262         -rm -f cp/config.status cp/Makefile
263         -rm -f cp/parse.output
264 c++.extraclean:
265 c++.maintainer-clean:
266         -rm -f cp/parse.c cp/parse.h
267 #\f
268 # Stage hooks:
269 # The main makefile has already created stage?/cp.
270
271 c++.stage1: stage1-start
272         -mv cp/*$(objext) stage1/cp
273 c++.stage2: stage2-start
274         -mv cp/*$(objext) stage2/cp
275 c++.stage3: stage3-start
276         -mv cp/*$(objext) stage3/cp
277 c++.stage4: stage4-start
278         -mv cp/*$(objext) stage4/cp
279 #\f
280 # Maintenance hooks:
281
282 # This target creates the files that can be rebuilt, but go in the
283 # distribution anyway.  It then copies the files to the distdir directory.
284 c++.distdir:
285         mkdir tmp/cp
286         mkdir tmp/cp/inc
287         cd cp ; $(MAKE) $(LANG_FLAGS_TO_PASS) $(CXX_FLAGS_TO_PASS) parse.c hash.h
288         cd cp; \
289         for file in *[0-9a-zA-Z+]; do \
290           $(LN) $$file ../tmp/cp; \
291         done
292         cd cp/inc; \
293         for file in *[0-9a-zA-Z+]; do \
294           ln $$file ../../tmp/cp/inc >/dev/null 2>&1 \
295            || cp $$file ../../tmp/cp/inc; \
296         done