OSDN Git Service

(cplib2.ready): Also depend on $(LANGUAGES).
[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/friend.c $(srcdir)/cp/init.c \
122  $(srcdir)/cp/parse.y $(srcdir)/cp/sig.c $(srcdir)/cp/typeck2.c \
123  $(srcdir)/cp/repo.c
124
125 cc1plus: $(P) $(CXX_SRCS) $(LIBDEPS) stamp-objlist c-common.o c-pragma.o
126         cd cp; $(MAKE) $(FLAGS_TO_PASS) $(CXX_FLAGS_TO_PASS) ../cc1plus
127 #\f
128 # Build hooks:
129
130 c++.all.build: g++$(exeext) $(DEMANGLER_PROG)
131 c++.all.cross: g++-cross$(exeext) $(DEMANGLER_PROG)
132 c++.start.encap: g++$(exeext)
133 c++.rest.encap: $(DEMANGLER_PROG)
134
135 c++.info:
136 c++.dvi:
137
138 # C++ language-support library pieces for libgcc.
139 tinfo.o: cc1plus $(srcdir)/cp/tinfo.cc
140         $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) \
141           -c $(srcdir)/cp/tinfo.cc
142 tinfo2.o: cc1plus $(srcdir)/cp/tinfo2.cc
143         $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) \
144           -c $(srcdir)/cp/tinfo2.cc
145 exception.o: cc1plus $(srcdir)/cp/exception.cc
146         $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) \
147           -c -fexceptions $(srcdir)/cp/exception.cc
148 new.o: cc1plus $(srcdir)/cp/new.cc
149         $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) \
150           -c $(srcdir)/cp/new.cc
151 new1.o: cc1plus $(srcdir)/cp/new1.cc
152         $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) \
153           -c $(srcdir)/cp/new1.cc
154 new2.o: cc1plus $(srcdir)/cp/new2.cc
155         $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) \
156           -c $(srcdir)/cp/new2.cc
157
158 # We want to update cplib2.txt if any of the source files change...
159 cplib2.txt: $(CXX_LIB2SRCS) $(CXX_EXTRA_HEADERS) cplib2.ready
160         if [ -f cc1plus ]; then \
161           echo $(CXX_LIB2FUNCS) > cplib2.new; \
162         else \
163           echo "" > cplib2.new; \
164         fi
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           if [ -f cc1plus ]; then \
171             echo $(CXX_LIB2FUNCS) > cplib2.new; \
172           else \
173             echo "" > cplib2.new; \
174           fi; \
175           if cmp -s cplib2.new cplib2.txt; then true; else \
176             touch cplib2.ready; \
177           fi; \
178           rm -f cplib2.new; \
179         else true ; \
180         fi
181         @if [ -f cplib2.ready ]; then true; else \
182           touch cplib2.ready; \
183         fi
184 #\f
185 # Install hooks:
186 # cc1plus is installed elsewhere as part of $(COMPILERS).
187
188 # Nothing to do here.
189 c++.install-normal:
190
191 # Install the driver program as $(target)-g++
192 # and also as either g++ (if native) or $(tooldir)/bin/g++.
193 c++.install-common:
194         -if [ -f cc1plus$(exeext) ] ; then \
195           if [ -f g++-cross$(exeext) ] ; then \
196             rm -f $(bindir)/$(GXX_CROSS_NAME)$(exeext); \
197             $(INSTALL_PROGRAM) g++-cross$(exeext) $(bindir)/$(GXX_CROSS_NAME)$(exeext); \
198             chmod a+x $(bindir)/$(GXX_CROSS_NAME)$(exeext); \
199             rm -f $(bindir)/$(CXX_CROSS_NAME)$(exeext); \
200             ln $(bindir)/$(GXX_CROSS_NAME)$(exeext) $(bindir)/$(CXX_CROSS_NAME)$(exeext) \
201               > /dev/null 2>&1 \
202               || cp $(bindir)/$(GXX_CROSS_NAME)$(exeext) $(bindir)/$(CXX_CROSS_NAME)$(exeext) ; \
203           else \
204             rm -f $(bindir)/$(GXX_INSTALL_NAME)$(exeext); \
205             $(INSTALL_PROGRAM) g++$(exeext) $(bindir)/$(GXX_INSTALL_NAME)$(exeext); \
206             chmod a+x $(bindir)/$(GXX_INSTALL_NAME)$(exeext); \
207             rm -f $(bindir)/$(CXX_INSTALL_NAME)$(exeext); \
208             ln $(bindir)/$(GXX_INSTALL_NAME)$(exeext) $(bindir)/$(CXX_INSTALL_NAME)$(exeext) \
209               > /dev/null 2>&1 \
210               || cp $(bindir)/$(GXX_INSTALL_NAME)$(exeext) $(bindir)/$(CXX_INSTALL_NAME)$(exeext) ; \
211           fi ; \
212         fi
213
214 c++.install-info:
215
216 c++.install-man: $(srcdir)/cp/g++.1
217         -if [ -f cc1plus$(exeext) ] ; then \
218           if [ -f g++-cross$(exeext) ] ; then \
219             rm -f $(mandir)/$(GXX_CROSS_NAME)$(manext); \
220             $(INSTALL_DATA) $(srcdir)/cp/g++.1 $(mandir)/$(GXX_CROSS_NAME)$(manext); \
221             chmod a-x $(mandir)/$(GXX_CROSS_NAME)$(manext); \
222           else \
223             rm -f $(mandir)/$(GXX_INSTALL_NAME)$(manext); \
224             $(INSTALL_DATA) $(srcdir)/cp/g++.1 $(mandir)/$(GXX_INSTALL_NAME)$(manext); \
225             chmod a-x $(mandir)/$(GXX_INSTALL_NAME)$(manext); \
226           fi; \
227         else true; fi
228
229 c++.uninstall:
230         -rm -rf $(bindir)/$(CXX_INSTALL_NAME)$(exeext)
231         -rm -rf $(bindir)/$(CXX_CROSS_NAME)$(exeext)
232         -rm -rf $(bindir)/$(GXX_INSTALL_NAME)$(exeext)
233         -rm -rf $(bindir)/$(GXX_CROSS_NAME)$(exeext)
234         -rm -rf $(mandir)/$(GXX_INSTALL_NAME)$(manext)
235         -rm -rf $(mandir)/$(GXX_CROSS_NAME)$(manext)
236 #\f
237 # Clean hooks:
238 # A lot of the ancillary files are deleted by the main makefile.
239 # We just have to delete files specific to us.
240
241 c++.mostlyclean:
242         -rm -f cp/*$(objext) $(DEMANGLER_PROG)
243 c++.clean:
244         -rm -f cplib2.txt cplib2.ready
245 c++.distclean:
246         -rm -f cp/config.status cp/Makefile
247         -rm -f cp/parse.output
248 c++.extraclean:
249 c++.maintainer-clean:
250         -rm -f cp/parse.c cp/parse.h
251 #\f
252 # Stage hooks:
253 # The main makefile has already created stage?/cp.
254
255 c++.stage1: stage1-start
256         -mv cp/*$(objext) stage1/cp
257 c++.stage2: stage2-start
258         -mv cp/*$(objext) stage2/cp
259 c++.stage3: stage3-start
260         -mv cp/*$(objext) stage3/cp
261 c++.stage4: stage4-start
262         -mv cp/*$(objext) stage4/cp
263 #\f
264 # Maintenance hooks:
265
266 # This target creates the files that can be rebuilt, but go in the
267 # distribution anyway.  It then copies the files to the distdir directory.
268 c++.distdir:
269         mkdir tmp/cp
270         cd cp ; $(MAKE) $(FLAGS_TO_PASS) $(CXX_FLAGS_TO_PASS) parse.c hash.h
271         cd cp; \
272         for file in *[0-9a-zA-Z+]; do \
273           ln $$file ../tmp/cp >/dev/null 2>&1 || cp $$file ../tmp/cp; \
274         done