OSDN Git Service

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