OSDN Git Service

* configure.in: Prune nonexistent files from build_xm_file,
[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
3 #   Free Software Foundation, Inc.
4
5 #This file is part of GNU CC.
6
7 #GNU CC 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 #GNU CC 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 GNU CC; 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 = `t='$(program_transform_name)'; echo c++ | sed $$t`
42 GXX_INSTALL_NAME = `t='$(program_transform_name)'; echo g++ | sed $$t`
43 DEMANGLER_INSTALL_NAME = `t='$(program_transform_name)'; echo c++filt | sed $$t`
44
45 # Actual names to use when installing a cross-compiler.
46 CXX_CROSS_NAME = `t='$(program_transform_cross_name)'; echo c++ | sed $$t`
47 GXX_CROSS_NAME = `t='$(program_transform_cross_name)'; echo g++ | sed $$t`
48 DEMANGLER_CROSS_NAME = `t='$(program_transform_cross_name)'; echo c++filt | sed $$t`
49
50 # The name to use for the demangler program.
51 DEMANGLER_PROG = c++filt$(exeext)
52
53 #\f
54 # Define the names for selecting c++ in LANGUAGES.
55 # Note that it would be nice to move the dependency on g++
56 # into the C++ rule, but that needs a little bit of work
57 # to do the right thing within all.cross.
58 C++ c++: cc1plus$(exeext)
59
60 # Tell GNU make to ignore these if they exist.
61 .PHONY: C++ c++
62
63 g++spec.o: $(srcdir)/cp/g++spec.c system.h $(GCC_H) $(CONFIG_H)
64         (SHLIB_LINK='$(SHLIB_LINK)' \
65         SHLIB_MULTILIB='$(SHLIB_MULTILIB)'; \
66         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \
67                 $(INCLUDES) $(srcdir)/cp/g++spec.c)
68
69 $(INTL_TARGETS): $(srcdir)/cp/parse.c
70
71 # Create the compiler driver for g++.
72 GXX_OBJS = gcc.o g++spec.o intl.o prefix.o version.o 
73 g++$(exeext): $(GXX_OBJS) $(EXTRA_GCC_OBJS) $(LIBDEPS)
74         $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
75           $(GXX_OBJS) $(EXTRA_GCC_OBJS) $(LIBS)
76
77 # Create a version of the g++ driver which calls the cross-compiler.
78 g++-cross$(exeext): g++$(exeext)
79         -rm -f g++-cross$(exeext)
80         cp g++$(exeext) g++-cross$(exeext)
81
82 # The demangler.
83 cxxmain.o: $(srcdir)/../libiberty/cplus-dem.c $(DEMANGLE_H) $(CONFIG_H)
84         rm -f cxxmain.c
85         $(LN_S) $(srcdir)/../libiberty/cplus-dem.c cxxmain.c
86         $(CC) -c -DMAIN $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
87           -DVERSION=\"$(version)\" cxxmain.c
88
89 # Apparently OpenVM needs the -o to be at the beginning of the link line.
90 $(DEMANGLER_PROG): cxxmain.o underscore.o $(LIBDEPS)
91         $(CC) -o $@ $(ALL_CFLAGS) $(LDFLAGS) \
92           cxxmain.o underscore.o $(LIBS)
93
94 # The compiler itself.
95 # Shared with C front end:
96 CXX_C_OBJS = c-common.o c-format.o c-pragma.o c-semantics.o c-lex.o c-dump.o $(CXX_TARGET_OBJS)
97
98 # Language-specific object files.
99 CXX_OBJS = cp/call.o cp/decl.o cp/errfn.o cp/expr.o cp/pt.o cp/typeck2.o \
100  cp/class.o cp/decl2.o cp/error.o cp/lex.o cp/parse.o cp/ptree.o cp/rtti.o \
101  cp/spew.o cp/typeck.o cp/cvt.o cp/except.o cp/friend.o cp/init.o cp/method.o \
102  cp/search.o cp/semantics.o cp/tree.o cp/xref.o cp/repo.o cp/dump.o \
103  cp/optimize.o cp/mangle.o
104
105 # Use loose warnings for this front end.
106 cp-warn =
107
108 cc1plus$(exeext): $(CXX_OBJS) $(CXX_C_OBJS) $(BACKEND) \
109                   libcpp.a $(LIBDEPS)
110         $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
111               $(CXX_OBJS) $(CXX_C_OBJS) $(BACKEND) libcpp.a $(LIBS)
112
113 # Special build rules.
114 $(srcdir)/cp/cfns.h: $(srcdir)/cp/cfns.gperf
115         gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' \
116                 $(srcdir)/cp/cfns.gperf > $(srcdir)/cp/cfns.h
117
118 $(srcdir)/cp/parse.h $(srcdir)/cp/parse.c: $(srcdir)/cp/parse.y
119         @echo "Expect 33 shift/reduce conflicts and 58 reduce/reduce conflicts."
120         cd $(srcdir)/cp; $(BISON) $(BISONFLAGS) -d -o p$$$$.c parse.y ; \
121         grep '^#define[         ]*YYEMPTY' p$$$$.c >> p$$$$.h ; \
122         mv -f p$$$$.c parse.c ; mv -f p$$$$.h parse.h
123
124 #\f
125 # Build hooks:
126
127 c++.all.build: g++$(exeext)
128 c++.all.cross: g++-cross$(exeext) $(DEMANGLER_PROG)
129 c++.start.encap: g++$(exeext)
130 c++.rest.encap: $(DEMANGLER_PROG)
131
132 c++.info: $(srcdir)/cp/g++int.info
133 c++.dvi:
134
135 $(srcdir)/cp/g++int.info: $(srcdir)/cp/gxxint.texi
136         if [ x$(BUILD_INFO) = xinfo ]; then \
137           rm -f $(srcdir)/cp/g++int.info*; \
138           cd $(srcdir)/cp && $(MAKEINFO) -o g++int.info gxxint.texi; \
139         else true; fi
140
141 #\f
142 # Install hooks:
143 # cc1plus is installed elsewhere as part of $(COMPILERS).
144
145 # Nothing to do here.
146 c++.install-normal:
147
148 # Install the driver program as $(target)-g++
149 # and also as either g++ (if native) or $(tooldir)/bin/g++.
150 c++.install-common: installdirs
151         -if [ -f cc1plus$(exeext) ] ; then \
152           if [ -f g++-cross$(exeext) ] ; then \
153             rm -f $(bindir)/$(GXX_CROSS_NAME)$(exeext); \
154             $(INSTALL_PROGRAM) g++-cross$(exeext) $(bindir)/$(GXX_CROSS_NAME)$(exeext); \
155             chmod a+x $(bindir)/$(GXX_CROSS_NAME)$(exeext); \
156             rm -f $(bindir)/$(CXX_CROSS_NAME)$(exeext); \
157             $(LN) $(bindir)/$(GXX_CROSS_NAME)$(exeext) $(bindir)/$(CXX_CROSS_NAME)$(exeext); \
158             if [ -d $(gcc_tooldir)/bin/. ] ; then \
159               rm -f $(gcc_tooldir)/bin/g++$(exeext); \
160               $(INSTALL_PROGRAM) g++-cross$(exeext) $(gcc_tooldir)/bin/g++$(exeext); \
161               rm -f $(gcc_tooldir)/bin/c++$(exeext); \
162               $(LN) $(gcc_tooldir)/bin/g++$(exeext) $(gcc_tooldir)/bin/c++$(exeext); \
163             else true; fi; \
164           else \
165             rm -f $(bindir)/$(GXX_INSTALL_NAME)$(exeext); \
166             $(INSTALL_PROGRAM) g++$(exeext) $(bindir)/$(GXX_INSTALL_NAME)$(exeext); \
167             chmod a+x $(bindir)/$(GXX_INSTALL_NAME)$(exeext); \
168             rm -f $(bindir)/$(CXX_INSTALL_NAME)$(exeext); \
169             $(LN) $(bindir)/$(GXX_INSTALL_NAME)$(exeext) $(bindir)/$(CXX_INSTALL_NAME)$(exeext); \
170             rm -f $(bindir)/$(target_alias)-g++$(exeext); \
171             $(LN) $(bindir)/$(GXX_INSTALL_NAME)$(exeext) $(bindir)/$(target_alias)-g++$(exeext); \
172             rm -f $(bindir)/$(target_alias)-c++$(exeext); \
173             $(LN) $(bindir)/$(CXX_INSTALL_NAME)$(exeext) $(bindir)/$(target_alias)-c++$(exeext); \
174           fi ; \
175           if [ x$(DEMANGLER_PROG) != x ] && [ -x "$(DEMANGLER_PROG)" ]; then \
176             if [ -f g++-cross$(exeext) ] ; then \
177               rm -f $(bindir)/$(DEMANGLER_CROSS_NAME)$(exeext); \
178               $(INSTALL_PROGRAM) $(DEMANGLER_PROG) $(bindir)/$(DEMANGLER_CROSS_NAME)$(exeext); \
179               chmod a+x $(bindir)/$(DEMANGLER_CROSS_NAME)$(exeext); \
180             else \
181               rm -f $(bindir)/$(DEMANGLER_INSTALL_NAME)$(exeext); \
182               $(INSTALL_PROGRAM) $(DEMANGLER_PROG) $(bindir)/$(DEMANGLER_INSTALL_NAME)$(exeext); \
183               chmod a+x $(bindir)/$(DEMANGLER_INSTALL_NAME)$(exeext); \
184             fi ; \
185           fi ; \
186         fi
187
188 c++.install-info: c++.info installdirs
189         if [ -f cc1plus$(exeext) ] ; then \
190           if [ -f $(srcdir)/cp/g++int.info ]; then \
191             rm -f $(infodir)/g++int.info*; \
192             for f in $(srcdir)/cp/g++int.info*; do \
193               realfile=`echo $$f | sed -e 's|.*/\([^/]*\)$$|\1|'`; \
194               $(INSTALL_DATA) $$f $(infodir)/$$realfile; \
195             done; \
196             chmod a-x $(infodir)/g++int.info*; \
197           else true; fi; \
198         else true; fi
199         -if [ -f cc1plus$(exeext) ] && [ -f $(infodir)/g++int.info ]; then \
200           if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
201             install-info --dir-file=$(infodir)/dir $(infodir)/g++int.info; \
202           else true; fi; \
203         else true; fi
204
205 c++.install-man: installdirs $(srcdir)/cp/g++.1
206         -if [ -f cc1plus$(exeext) ] ; then \
207           if [ -f g++-cross$(exeext) ] ; then \
208             rm -f $(man1dir)/$(GXX_CROSS_NAME)$(manext); \
209             $(INSTALL_DATA) $(srcdir)/cp/g++.1 $(man1dir)/$(GXX_CROSS_NAME)$(manext); \
210             chmod a-x $(man1dir)/$(GXX_CROSS_NAME)$(manext); \
211           else \
212             rm -f $(man1dir)/$(GXX_INSTALL_NAME)$(manext); \
213             $(INSTALL_DATA) $(srcdir)/cp/g++.1 $(man1dir)/$(GXX_INSTALL_NAME)$(manext); \
214             chmod a-x $(man1dir)/$(GXX_INSTALL_NAME)$(manext); \
215           fi; \
216         else true; fi
217
218 c++.uninstall:
219         -rm -rf $(bindir)/$(CXX_INSTALL_NAME)$(exeext)
220         -rm -rf $(bindir)/$(CXX_CROSS_NAME)$(exeext)
221         -rm -rf $(bindir)/$(GXX_INSTALL_NAME)$(exeext)
222         -rm -rf $(bindir)/$(GXX_CROSS_NAME)$(exeext)
223         -rm -rf $(bindir)/$(DEMANGLER_INSTALL_NAME)$(exeext)
224         -rm -rf $(bindir)/$(DEMANGLER_CROSS_NAME)$(exeext)
225         -rm -rf $(man1dir)/$(GXX_INSTALL_NAME)$(manext)
226         -rm -rf $(man1dir)/$(GXX_CROSS_NAME)$(manext)
227         -rm -rf $(infodir)/g++int.info*
228 #\f
229 # Clean hooks:
230 # A lot of the ancillary files are deleted by the main makefile.
231 # We just have to delete files specific to us.
232
233 c++.mostlyclean:
234         -rm -f cp/*$(objext) $(DEMANGLER_PROG)
235 c++.clean:
236 c++.distclean:
237         -rm -f cp/config.status cp/Makefile
238         -rm -f $(srcdir)/cp/parse.output
239 c++.extraclean:
240 c++.maintainer-clean:
241         -rm -f $(srcdir)/cp/parse.c $(srcdir)/cp/parse.h
242         -rm -f $(srcdir)/cp/g++int.info*
243 #\f
244 # Stage hooks:
245 # The main makefile has already created stage?/cp.
246
247 c++.stage1: stage1-start
248         -mv cp/*$(objext) stage1/cp
249 c++.stage2: stage2-start
250         -mv cp/*$(objext) stage2/cp
251 c++.stage3: stage3-start
252         -mv cp/*$(objext) stage3/cp
253 c++.stage4: stage4-start
254         -mv cp/*$(objext) stage4/cp
255
256 #\f
257 # .o: .h dependencies.
258 CXX_TREE_H = $(TREE_H) cp/cp-tree.h c-common.h cp/cp-tree.def c-common.def \
259         function.h varray.h system.h $(CONFIG_H) \
260         $(srcdir)/../include/hashtab.h $(srcdir)/../include/splay-tree.h
261
262 cp/spew.o: cp/spew.c $(CXX_TREE_H) cp/parse.h flags.h cp/lex.h toplev.h
263 cp/lex.o: cp/lex.c $(CXX_TREE_H) cp/parse.h flags.h cp/lex.h c-pragma.h \
264   toplev.h output.h mbchar.h $(GGC_H) input.h diagnostic.h cp/operators.def \
265   $(TM_P_H)
266 cp/decl.o: cp/decl.c $(CXX_TREE_H) flags.h cp/lex.h cp/decl.h stack.h \
267   output.h $(EXPR_H) except.h toplev.h hash.h $(GGC_H) $(RTL_H) \
268   cp/operators.def $(TM_P_H)
269 cp/decl2.o: cp/decl2.c $(CXX_TREE_H) flags.h cp/lex.h cp/decl.h $(EXPR_H) \
270   output.h except.h toplev.h dwarf2out.h dwarfout.h $(GGC_H) $(RTL_H)
271 cp/typeck2.o: cp/typeck2.c $(CXX_TREE_H) flags.h toplev.h output.h $(TM_P_H)
272 cp/typeck.o: cp/typeck.c $(CXX_TREE_H) flags.h $(RTL_H) $(EXPR_H) toplev.h 
273 cp/class.o: cp/class.c $(CXX_TREE_H) flags.h toplev.h $(RTL_H)
274 cp/call.o: cp/call.c $(CXX_TREE_H) flags.h toplev.h $(RTL_H) $(EXPR_H) $(GGC_H)
275 cp/friend.o: cp/friend.c $(CXX_TREE_H) flags.h $(RTL_H) toplev.h $(EXPR_H)
276 cp/init.o: cp/init.c $(CXX_TREE_H) flags.h $(RTL_H) $(EXPR_H) toplev.h \
277   $(GGC_H) except.h
278 cp/method.o: cp/method.c $(CXX_TREE_H) toplev.h $(GGC_H) $(RTL_H) $(EXPR_H) \
279   $(TM_P_H)
280 cp/cvt.o: cp/cvt.c $(CXX_TREE_H) cp/decl.h flags.h toplev.h convert.h
281 cp/search.o: cp/search.c $(CXX_TREE_H) stack.h flags.h toplev.h $(RTL_H)
282 cp/tree.o: cp/tree.c $(CXX_TREE_H) flags.h toplev.h $(GGC_H) $(RTL_H) \
283   insn-config.h integrate.h
284 cp/ptree.o: cp/ptree.c $(CXX_TREE_H) system.h
285 cp/rtti.o: cp/rtti.c $(CXX_TREE_H) flags.h toplev.h
286 cp/except.o: cp/except.c $(CXX_TREE_H) flags.h $(RTL_H) except.h toplev.h \
287   cp/cfns.h $(EXPR_H) insn-flags.h cp/decl.h $(OBSTACK_H)
288 cp/expr.o: cp/expr.c $(CXX_TREE_H) $(RTL_H) flags.h $(EXPR_H) toplev.h \
289   except.h $(TM_P_H)
290 cp/xref.o: cp/xref.c $(CXX_TREE_H) input.h toplev.h
291 cp/pt.o: cp/pt.c $(CXX_TREE_H) cp/decl.h cp/parse.h cp/lex.h toplev.h \
292   $(GGC_H) $(RTL_H) except.h
293 cp/error.o: cp/error.c $(CXX_TREE_H) toplev.h diagnostic.h
294 cp/errfn.o: cp/errfn.c $(CXX_TREE_H) toplev.h
295 cp/repo.o: cp/repo.c $(CXX_TREE_H) toplev.h $(GGC_H)
296 cp/semantics.o: cp/semantics.c $(CXX_TREE_H) cp/lex.h except.h toplev.h \
297   flags.h $(GGC_H) output.h $(RTL_H) $(TIMEVAR_H)
298 cp/dump.o: cp/dump.c $(CXX_TREE_H) c-dump.h
299 cp/optimize.o: cp/optimize.c $(CXX_TREE_H) rtl.h integrate.h insn-config.h \
300   input.h
301 cp/mangle.o: cp/mangle.c $(CXX_TREE_H) toplev.h
302
303 cp/parse.o: cp/parse.c $(CXX_TREE_H) flags.h cp/lex.h except.h output.h \
304         system.h toplev.h $(GGC_H)
305         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(BIG_SWITCHFLAG) \
306                 $(srcdir)/cp/parse.c $(OUTPUT_OPTION)
307 #\f
308 # These exist for maintenance purposes.
309
310 # Update the tags table.
311 cp/TAGS: force
312         cd $(srcdir)/cp ;                       \
313         etags --no-globals -l c `echo *.c | sed 's/parse.c//'` \
314           parse.y *.h ../*.c ../*.h;
315
316 .PHONY: cp/TAGS