OSDN Git Service

90th Cygnus<->FSF quick merge
[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 $@ || cp $(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 $(LIBDEPS) $(EXTRA_GCC_OBJS)
94         $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ g++.o g++spec.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 > /dev/null 2>&1 \
105          || cp $(srcdir)/cplus-dem.c cxxmain.c
106         $(CC) -c -DMAIN $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
107           -DVERSION=\"$(version)\" cxxmain.c
108         rm -f cxxmain.c
109
110 $(DEMANGLER_PROG): cxxmain.o underscore.o getopt.o getopt1.o $(LIBDEPS)
111         $(CC) $(ALL_CFLAGS) $(LDFLAGS) $(LIBS) -o $@ \
112           cxxmain.o underscore.o getopt.o getopt1.o
113
114 CXX_SRCS = $(srcdir)/cp/call.c $(srcdir)/cp/decl2.c \
115  $(srcdir)/cp/except.c $(srcdir)/cp/input.c $(srcdir)/cp/pt.c \
116  $(srcdir)/cp/spew.c $(srcdir)/cp/xref.c $(srcdir)/cp/class.c \
117  $(srcdir)/cp/expr.c $(srcdir)/cp/lex.c \
118  $(srcdir)/cp/ptree.c $(srcdir)/cp/tree.c $(srcdir)/cp/cvt.c \
119  $(srcdir)/cp/errfn.c $(srcdir)/cp/rtti.c $(srcdir)/cp/method.c \
120  $(srcdir)/cp/search.c $(srcdir)/cp/typeck.c $(srcdir)/cp/decl.c \
121  $(srcdir)/cp/error.c $(srcdir)/cp/init.c $(srcdir)/cp/parse.y \
122  $(srcdir)/cp/sig.c $(srcdir)/cp/typeck2.c $(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 -O0 -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         if [ -f cc1plus ]; then \
160           echo $(CXX_LIB2FUNCS) > cplib2.new; \
161         else \
162           echo "" > cplib2.new; \
163         fi
164         mv -f cplib2.new cplib2.txt 
165
166 # Or if it would be different.
167 cplib2.ready: $(GCC_PASSES) $(LIBGCC2_DEPS) stmp-int-hdrs
168         @if [ -r cplib2.txt ]; then \
169           if [ -f cc1plus ]; then \
170             echo $(CXX_LIB2FUNCS) > cplib2.new; \
171           else \
172             echo "" > cplib2.new; \
173           fi; \
174           if cmp -s cplib2.new cplib2.txt; then true; else \
175             touch cplib2.ready; \
176           fi; \
177           rm -f cplib2.new; \
178         else true ; \
179         fi
180         @if [ -f cplib2.ready ]; then true; else \
181           touch cplib2.ready; \
182         fi
183 \f
184 # Install hooks:
185 # cc1plus is installed elsewhere as part of $(COMPILERS).
186
187 # Nothing to do here.
188 c++.install-normal:
189
190 # Install the driver program as $(target)-g++
191 # and also as either g++ (if native) or $(tooldir)/bin/g++.
192 c++.install-common:
193         -if [ -f cc1plus$(exeext) ] ; then \
194           if [ -f g++-cross$(exeext) ] ; then \
195             rm -f $(bindir)/$(GXX_CROSS_NAME)$(exeext); \
196             $(INSTALL_PROGRAM) g++-cross$(exeext) $(bindir)/$(GXX_CROSS_NAME)$(exeext); \
197             chmod a+x $(bindir)/$(GXX_CROSS_NAME)$(exeext); \
198             rm -f $(bindir)/$(CXX_CROSS_NAME)$(exeext); \
199             ln $(bindir)/$(GXX_CROSS_NAME)$(exeext) $(bindir)/$(CXX_CROSS_NAME)$(exeext) \
200               > /dev/null 2>&1 \
201               || cp $(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               > /dev/null 2>&1 \
209               || cp $(bindir)/$(GXX_INSTALL_NAME)$(exeext) $(bindir)/$(CXX_INSTALL_NAME)$(exeext) ; \
210           fi ; \
211         fi
212
213 c++.install-info:
214
215 c++.install-man: $(srcdir)/cp/g++.1
216         -if [ -f cc1plus$(exeext) ] ; then \
217           if [ -f g++-cross$(exeext) ] ; then \
218             rm -f $(mandir)/$(GXX_CROSS_NAME)$(manext); \
219             $(INSTALL_DATA) $(srcdir)/cp/g++.1 $(mandir)/$(GXX_CROSS_NAME)$(manext); \
220             chmod a-x $(mandir)/$(GXX_CROSS_NAME)$(manext); \
221           else \
222             rm -f $(mandir)/$(GXX_INSTALL_NAME)$(manext); \
223             $(INSTALL_DATA) $(srcdir)/cp/g++.1 $(mandir)/$(GXX_INSTALL_NAME)$(manext); \
224             chmod a-x $(mandir)/$(GXX_INSTALL_NAME)$(manext); \
225           fi; \
226         else true; fi
227
228 c++.uninstall:
229         -rm -rf $(bindir)/$(CXX_INSTALL_NAME)$(exeext)
230         -rm -rf $(bindir)/$(CXX_CROSS_NAME)$(exeext)
231         -rm -rf $(bindir)/$(GXX_INSTALL_NAME)$(exeext)
232         -rm -rf $(bindir)/$(GXX_CROSS_NAME)$(exeext)
233         -rm -rf $(mandir)/$(GXX_INSTALL_NAME)$(manext)
234         -rm -rf $(mandir)/$(GXX_CROSS_NAME)$(manext)
235 \f
236 # Clean hooks:
237 # A lot of the ancillary files are deleted by the main makefile.
238 # We just have to delete files specific to us.
239
240 c++.mostlyclean:
241         -rm -f cp/*$(objext) $(DEMANGLER_PROG)
242 c++.clean:
243         -rm -f cplib2.txt cplib2.ready
244 c++.distclean:
245         -rm -f cp/config.status cp/Makefile
246         -rm -f cp/parse.output
247 c++.extraclean:
248 c++.maintainer-clean:
249         -rm -f cp/parse.c cp/parse.h
250 \f
251 # Stage hooks:
252 # The main makefile has already created stage?/cp.
253
254 c++.stage1: stage1-start
255         -mv cp/*$(objext) stage1/cp
256 c++.stage2: stage2-start
257         -mv cp/*$(objext) stage2/cp
258 c++.stage3: stage3-start
259         -mv cp/*$(objext) stage3/cp
260 c++.stage4: stage4-start
261         -mv cp/*$(objext) stage4/cp
262 \f
263 # Maintenance hooks:
264
265 # This target creates the files that can be rebuilt, but go in the
266 # distribution anyway.  It then copies the files to the distdir directory.
267 c++.distdir:
268         mkdir tmp/cp
269         cd cp ; $(MAKE) $(FLAGS_TO_PASS) $(CXX_FLAGS_TO_PASS) parse.c hash.h
270         cd cp; \
271         for file in *[0-9a-zA-Z+]; do \
272           ln $$file ../tmp/cp >/dev/null 2>&1 || cp $$file ../tmp/cp; \
273         done