OSDN Git Service

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