OSDN Git Service

6944ab1ee50a5c9a1fef0cde410f4068a987d908
[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, 2001, 2002, 2003
3 #   Free Software Foundation, Inc.
4
5 #This file is part of GCC.
6
7 #GCC 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 #GCC 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 GCC; 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,
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
40 # Actual names to use when installing a native compiler.
41 CXX_INSTALL_NAME = `echo c++|sed '$(program_transform_name)'`
42 GXX_INSTALL_NAME = `echo g++|sed '$(program_transform_name)'`
43 CXX_TARGET_INSTALL_NAME = $(target_alias)-`echo c++|sed '$(program_transform_name)'`
44 GXX_TARGET_INSTALL_NAME = $(target_alias)-`echo g++|sed '$(program_transform_name)'`
45
46 # Actual names to use when installing a cross-compiler.
47 CXX_CROSS_NAME = `echo c++|sed '$(program_transform_cross_name)'`
48 GXX_CROSS_NAME = `echo g++|sed '$(program_transform_cross_name)'`
49
50 #\f
51 # Define the names for selecting c++ in LANGUAGES.
52 # Note that it would be nice to move the dependency on g++
53 # into the C++ rule, but that needs a little bit of work
54 # to do the right thing within all.cross.
55 C++ c++: cc1plus$(exeext)
56
57 # Tell GNU make to ignore these if they exist.
58 .PHONY: C++ c++
59
60 g++spec.o: $(srcdir)/cp/g++spec.c $(SYSTEM_H) coretypes.h $(TM_H) $(GCC_H) $(CONFIG_H)
61         (SHLIB_LINK='$(SHLIB_LINK)' \
62         SHLIB_MULTILIB='$(SHLIB_MULTILIB)'; \
63         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \
64                 $(INCLUDES) $(srcdir)/cp/g++spec.c)
65
66 po-generated:
67
68 # Create the compiler driver for g++.
69 GXX_OBJS = gcc.o g++spec.o intl.o prefix.o version.o 
70 g++$(exeext): $(GXX_OBJS) $(EXTRA_GCC_OBJS) $(LIBDEPS)
71         $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
72           $(GXX_OBJS) $(EXTRA_GCC_OBJS) $(LIBS)
73
74 # Create a version of the g++ driver which calls the cross-compiler.
75 g++-cross$(exeext): g++$(exeext)
76         -rm -f g++-cross$(exeext)
77         cp g++$(exeext) g++-cross$(exeext)
78
79 # The compiler itself.
80 # Shared with C front end:
81 CXX_C_OBJS = attribs.o c-common.o c-format.o c-pragma.o c-semantics.o c-lex.o \
82         c-dump.o $(CXX_TARGET_OBJS) c-pretty-print.o c-opts.o c-pch.o \
83         c-incpath.o cppdefault.o c-ppoutput.o
84
85 # Language-specific object files.
86 CXX_OBJS = cp/call.o cp/decl.o cp/expr.o cp/pt.o cp/typeck2.o \
87  cp/class.o cp/decl2.o cp/error.o cp/lex.o cp/parser.o cp/ptree.o cp/rtti.o \
88  cp/typeck.o cp/cvt.o cp/except.o cp/friend.o cp/init.o cp/method.o \
89  cp/search.o cp/semantics.o cp/tree.o cp/repo.o cp/dump.o \
90  cp/optimize.o cp/mangle.o cp/cp-lang.o
91
92 # Use loose warnings for this front end.
93 cp-warn =
94
95 cc1plus$(exeext): $(CXX_OBJS) $(CXX_C_OBJS) $(BACKEND) \
96                   libcpp.a $(LIBDEPS)
97         $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
98               $(CXX_OBJS) $(CXX_C_OBJS) $(BACKEND) libcpp.a $(LIBS)
99
100 # Special build rules.
101 $(srcdir)/cp/cfns.h: $(srcdir)/cp/cfns.gperf
102         gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' \
103                 $(srcdir)/cp/cfns.gperf > $(srcdir)/cp/cfns.h
104
105 gtype-cp.h gt-cp-call.h gt-cp-decl.h gt-cp-decl2.h : s-gtype; @true
106 gt-cp-pt.h gt-cp-repo.h gt-cp-parser.h : s-gtype; @true
107 gt-cp-tree.h : s-gtype; @true
108
109 #\f
110 # Build hooks:
111
112 c++.all.build: g++$(exeext)
113 c++.all.cross: g++-cross$(exeext)
114 c++.start.encap: g++$(exeext)
115 c++.rest.encap:
116
117 c++.info: 
118 c++.dvi:
119 c++.generated-manpages:
120
121 #\f
122 # Install hooks:
123 # cc1plus is installed elsewhere as part of $(COMPILERS).
124
125 # Nothing to do here.
126 c++.install-normal:
127
128 # Install the driver program as $(target)-g++
129 # and also as either g++ (if native) or $(tooldir)/bin/g++.
130 c++.install-common: installdirs
131         -if [ -f cc1plus$(exeext) ] ; then \
132           if [ -f g++-cross$(exeext) ] ; then \
133             rm -f $(DESTDIR)$(bindir)/$(GXX_CROSS_NAME)$(exeext); \
134             $(INSTALL_PROGRAM) g++-cross$(exeext) $(DESTDIR)$(bindir)/$(GXX_CROSS_NAME)$(exeext); \
135             chmod a+x $(DESTDIR)$(bindir)/$(GXX_CROSS_NAME)$(exeext); \
136             rm -f $(DESTDIR)$(bindir)/$(CXX_CROSS_NAME)$(exeext); \
137             ( cd $(DESTDIR)$(bindir) && \
138               $(LN) $(GXX_CROSS_NAME)$(exeext) $(CXX_CROSS_NAME)$(exeext) ); \
139             if [ -d $(DESTDIR)$(gcc_tooldir)/bin/. ] ; then \
140               rm -f $(DESTDIR)$(gcc_tooldir)/bin/g++$(exeext); \
141               $(INSTALL_PROGRAM) g++-cross$(exeext) $(DESTDIR)$(gcc_tooldir)/bin/g++$(exeext); \
142               rm -f $(DESTDIR)$(gcc_tooldir)/bin/c++$(exeext); \
143               ( cd $(DESTDIR)$(gcc_tooldir)/bin && \
144                 $(LN) g++$(exeext) c++$(exeext) ); \
145             else true; fi; \
146           else \
147             rm -f $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext); \
148             $(INSTALL_PROGRAM) g++$(exeext) $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext); \
149             chmod a+x $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext); \
150             rm -f $(DESTDIR)$(bindir)/$(CXX_INSTALL_NAME)$(exeext); \
151             ( cd $(DESTDIR)$(bindir) && \
152               $(LN) $(GXX_INSTALL_NAME)$(exeext) $(CXX_INSTALL_NAME)$(exeext) ); \
153             rm -f $(DESTDIR)$(bindir)/$(GXX_TARGET_INSTALL_NAME)$(exeext); \
154             ( cd $(DESTDIR)$(bindir) && \
155               $(LN) $(GXX_INSTALL_NAME)$(exeext) $(GXX_TARGET_INSTALL_NAME)$(exeext) ); \
156             rm -f $(DESTDIR)$(bindir)/$(CXX_TARGET_INSTALL_NAME)$(exeext); \
157             ( cd $(DESTDIR)$(bindir) && \
158               $(LN) $(CXX_INSTALL_NAME)$(exeext) $(CXX_TARGET_INSTALL_NAME)$(exeext) ); \
159           fi ; \
160         fi
161
162 c++.install-info: 
163
164 c++.install-man: installdirs $(srcdir)/cp/g++.1
165         -if [ -f cc1plus$(exeext) ] ; then \
166           if [ -f g++-cross$(exeext) ] ; then \
167             rm -f $(DESTDIR)$(man1dir)/$(GXX_CROSS_NAME)$(man1ext); \
168             $(INSTALL_DATA) $(srcdir)/cp/g++.1 $(DESTDIR)$(man1dir)/$(GXX_CROSS_NAME)$(man1ext); \
169             chmod a-x $(DESTDIR)$(man1dir)/$(GXX_CROSS_NAME)$(man1ext); \
170           else \
171             rm -f $(DESTDIR)$(man1dir)/$(GXX_INSTALL_NAME)$(man1ext); \
172             $(INSTALL_DATA) $(srcdir)/cp/g++.1 $(DESTDIR)$(man1dir)/$(GXX_INSTALL_NAME)$(man1ext); \
173             chmod a-x $(DESTDIR)$(man1dir)/$(GXX_INSTALL_NAME)$(man1ext); \
174           fi; \
175         else true; fi
176
177 c++.uninstall:
178         -rm -rf $(DESTDIR)$(bindir)/$(CXX_INSTALL_NAME)$(exeext)
179         -rm -rf $(DESTDIR)$(bindir)/$(CXX_CROSS_NAME)$(exeext)
180         -rm -rf $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext)
181         -rm -rf $(DESTDIR)$(bindir)/$(GXX_CROSS_NAME)$(exeext)
182         -rm -rf $(DESTDIR)$(man1dir)/$(GXX_INSTALL_NAME)$(man1ext)
183         -rm -rf $(DESTDIR)$(man1dir)/$(GXX_CROSS_NAME)$(man1ext)
184 #\f
185 # Clean hooks:
186 # A lot of the ancillary files are deleted by the main makefile.
187 # We just have to delete files specific to us.
188
189 c++.mostlyclean:
190         -rm -f cp/*$(objext)
191         -rm -f cp/*$(coverageexts)
192 c++.clean:
193 c++.distclean:
194         -rm -f cp/config.status cp/Makefile
195 c++.extraclean:
196 c++.maintainer-clean:
197 #\f
198 # Stage hooks:
199 # The main makefile has already created stage?/cp.
200
201 c++.stage1: stage1-start
202         -mv cp/*$(objext) stage1/cp
203 c++.stage2: stage2-start
204         -mv cp/*$(objext) stage2/cp
205 c++.stage3: stage3-start
206         -mv cp/*$(objext) stage3/cp
207 c++.stage4: stage4-start
208         -mv cp/*$(objext) stage4/cp
209
210 #\f
211 # .o: .h dependencies.
212 CXX_TREE_H = $(TREE_H) cp/cp-tree.h c-common.h cp/cp-tree.def c-common.def \
213         function.h varray.h $(SYSTEM_H) coretypes.h $(CONFIG_H) $(TARGET_H) \
214         $(GGC_H) \
215         $(srcdir)/../include/hashtab.h $(srcdir)/../include/splay-tree.h
216
217 cp/lex.o: cp/lex.c $(CXX_TREE_H) $(TM_H) flags.h cp/lex.h \
218   c-pragma.h toplev.h output.h mbchar.h input.h diagnostic.h \
219   cp/operators.def $(TM_P_H)
220 cp/cp-lang.o: cp/cp-lang.c $(CXX_TREE_H) $(TM_H) toplev.h langhooks.h \
221   $(LANGHOOKS_DEF_H) c-common.h
222 cp/decl.o: cp/decl.c $(CXX_TREE_H) $(TM_H) flags.h cp/lex.h cp/decl.h stack.h \
223   output.h $(EXPR_H) except.h toplev.h $(HASHTAB_H) $(RTL_H) \
224   cp/operators.def $(TM_P_H) tree-inline.h diagnostic.h c-pragma.h \
225   debug.h gt-cp-decl.h gtype-cp.h timevar.h
226 cp/decl2.o: cp/decl2.c $(CXX_TREE_H) $(TM_H) flags.h cp/lex.h cp/decl.h $(EXPR_H) \
227   output.h except.h toplev.h $(RTL_H) c-common.h gt-cp-decl2.h
228 cp/typeck2.o: cp/typeck2.c $(CXX_TREE_H) $(TM_H) flags.h toplev.h output.h $(TM_P_H) \
229    diagnostic.h
230 cp/typeck.o: cp/typeck.c $(CXX_TREE_H) $(TM_H) flags.h $(RTL_H) $(EXPR_H) toplev.h \
231    diagnostic.h
232 cp/class.o: cp/class.c $(CXX_TREE_H) $(TM_H) flags.h toplev.h $(RTL_H) $(TARGET_H)
233 cp/call.o: cp/call.c $(CXX_TREE_H) $(TM_H) flags.h toplev.h $(RTL_H) $(EXPR_H) \
234      diagnostic.h gt-cp-call.h
235 cp/friend.o: cp/friend.c $(CXX_TREE_H) $(TM_H) flags.h $(RTL_H) toplev.h $(EXPR_H)
236 cp/init.o: cp/init.c $(CXX_TREE_H) $(TM_H) flags.h $(RTL_H) $(EXPR_H) toplev.h \
237   except.h
238 cp/method.o: cp/method.c $(CXX_TREE_H) $(TM_H) toplev.h $(RTL_H) $(EXPR_H) \
239   $(TM_P_H) $(TARGET_H)
240 cp/cvt.o: cp/cvt.c $(CXX_TREE_H) $(TM_H) cp/decl.h flags.h toplev.h convert.h
241 cp/search.o: cp/search.c $(CXX_TREE_H) $(TM_H) stack.h flags.h toplev.h $(RTL_H)
242 cp/tree.o: cp/tree.c $(CXX_TREE_H) $(TM_H) flags.h toplev.h $(RTL_H) \
243   insn-config.h integrate.h tree-inline.h real.h gt-cp-tree.h $(TARGET_H)
244 cp/ptree.o: cp/ptree.c $(CXX_TREE_H) $(TM_H)
245 cp/rtti.o: cp/rtti.c $(CXX_TREE_H) $(TM_H) flags.h toplev.h
246 cp/except.o: cp/except.c $(CXX_TREE_H) $(TM_H) flags.h $(RTL_H) except.h toplev.h \
247   cp/cfns.h $(EXPR_H) libfuncs.h tree-inline.h
248 cp/expr.o: cp/expr.c $(CXX_TREE_H) $(TM_H) $(RTL_H) flags.h $(EXPR_H) toplev.h \
249   except.h $(TM_P_H)
250 cp/pt.o: cp/pt.c $(CXX_TREE_H) $(TM_H) cp/decl.h cp/lex.h \
251   toplev.h $(RTL_H) except.h tree-inline.h gt-cp-pt.h
252 cp/error.o: cp/error.c $(CXX_TREE_H) $(TM_H) toplev.h diagnostic.h flags.h real.h \
253   $(LANGHOOKS_DEF_H)
254 cp/repo.o: cp/repo.c $(CXX_TREE_H) $(TM_H) toplev.h diagnostic.h \
255   gt-cp-repo.h
256 cp/semantics.o: cp/semantics.c $(CXX_TREE_H) $(TM_H) cp/lex.h except.h toplev.h \
257   flags.h debug.h output.h $(RTL_H) $(TIMEVAR_H) $(EXPR_H) \
258   tree-inline.h
259 cp/dump.o: cp/dump.c $(CXX_TREE_H) $(TM_H) tree-dump.h
260 cp/optimize.o: cp/optimize.c $(CXX_TREE_H) $(TM_H) rtl.h integrate.h insn-config.h \
261   input.h $(PARAMS_H) debug.h tree-inline.h
262 cp/mangle.o: cp/mangle.c $(CXX_TREE_H) $(TM_H) toplev.h real.h
263
264 cp/parser.o: cp/parser.c $(CXX_TREE_H) $(TM_H) diagnostic.h gt-cp-parser.h output.h
265 #\f
266 # These exist for maintenance purposes.
267
268 # Update the tags table.
269 cp/TAGS: force
270         cd $(srcdir)/cp ;                       \
271         etags --no-globals -l c *.c *.h ../*.c ../*.h;
272
273 .PHONY: cp/TAGS