OSDN Git Service

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