OSDN Git Service

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