OSDN Git Service

gcc
[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, 2004,
3 #   2005, 2007, 2008
4 #   Free Software Foundation, Inc.
5
6 #This file is part of GCC.
7
8 #GCC is free software; you can redistribute it and/or modify
9 #it under the terms of the GNU General Public License as published by
10 #the Free Software Foundation; either version 3, or (at your option)
11 #any later version.
12
13 #GCC is distributed in the hope that it will be useful,
14 #but WITHOUT ANY WARRANTY; without even the implied warranty of
15 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 #GNU General Public License for more details.
17
18 # You should have received a copy of the GNU General Public License
19 # along with GCC; see the file COPYING3.  If not see
20 # <http://www.gnu.org/licenses/>.
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.cross, foo.start.encap, foo.rest.encap,
26 # foo.install-common, foo.install-man, foo.install-info, foo.install-pdf,
27 # foo.info, foo.dvi, foo.pdf, foo.html, foo.uninstall,
28 # foo.mostlyclean, foo.clean, foo.distclean,
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
39 # Actual names to use when installing a native compiler.
40 CXX_INSTALL_NAME := $(shell echo c++|sed '$(program_transform_name)')
41 GXX_INSTALL_NAME := $(shell echo g++|sed '$(program_transform_name)')
42 CXX_TARGET_INSTALL_NAME := $(target_noncanonical)-$(shell echo c++|sed '$(program_transform_name)')
43 GXX_TARGET_INSTALL_NAME := $(target_noncanonical)-$(shell echo g++|sed '$(program_transform_name)')
44
45 #\f
46 # Define the names for selecting c++ in LANGUAGES.
47 # Note that it would be nice to move the dependency on g++
48 # into the C++ rule, but that needs a little bit of work
49 # to do the right thing within all.cross.
50 c++: cc1plus$(exeext)
51
52 # Tell GNU make to ignore these if they exist.
53 .PHONY: c++
54
55 cp/g++spec.o: \
56         ALL_CPPFLAGS := $(ALL_CPPFLAGS) $(DRIVER_DEFINES)
57
58 # Create the compiler driver for g++.
59 GXX_OBJS = $(GCC_OBJS) cp/g++spec.o intl.o prefix.o version.o
60 g++$(exeext): $(GXX_OBJS) $(EXTRA_GCC_OBJS) $(LIBDEPS)
61         $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
62           $(GXX_OBJS) $(EXTRA_GCC_OBJS) $(LIBS)
63
64 # Create a version of the g++ driver which calls the cross-compiler.
65 g++-cross$(exeext): g++$(exeext)
66         -rm -f g++-cross$(exeext)
67         cp g++$(exeext) g++-cross$(exeext)
68
69 # The compiler itself.
70 # Shared with C front end:
71 CXX_C_OBJS = attribs.o c-common.o c-format.o c-pragma.o c-semantics.o c-lex.o \
72         c-dump.o $(CXX_TARGET_OBJS) c-pretty-print.o c-opts.o c-pch.o \
73         c-incpath.o cppdefault.o c-ppoutput.o c-cppbuiltin.o prefix.o \
74         c-gimplify.o c-omp.o tree-inline.o
75
76 # Language-specific object files for C++ and Objective C++.
77 CXX_AND_OBJCXX_OBJS = cp/call.o cp/decl.o cp/expr.o cp/pt.o cp/typeck2.o \
78  cp/class.o cp/decl2.o cp/error.o cp/lex.o cp/parser.o cp/ptree.o cp/rtti.o \
79  cp/typeck.o cp/cvt.o cp/except.o cp/friend.o cp/init.o cp/method.o \
80  cp/search.o cp/semantics.o cp/tree.o cp/repo.o cp/dump.o cp/optimize.o \
81  cp/mangle.o cp/cp-objcp-common.o cp/name-lookup.o cp/cxx-pretty-print.o \
82  cp/cp-gimplify.o tree-mudflap.o $(CXX_C_OBJS)
83
84 # Language-specific object files for C++.
85 CXX_OBJS = cp/cp-lang.o stub-objc.o $(CXX_AND_OBJCXX_OBJS)
86
87 c++_OBJS = $(CXX_OBJS) dummy-checksum.o cc1plus-checksum.o cp/g++spec.o
88
89 # Use strict warnings for this front end.
90 cp-warn = $(STRICT_WARN) $(CXX_COMPAT_WARN)
91
92 cc1plus-dummy$(exeext): $(CXX_OBJS) dummy-checksum.o $(BACKEND) $(LIBDEPS)
93         $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
94               $(CXX_OBJS) dummy-checksum.o $(BACKEND) $(LIBS) $(GMPLIBS)
95
96 cc1plus-checksum.c : cc1plus-dummy$(exeext) build/genchecksum$(build_exeext)
97         build/genchecksum$(build_exeext) cc1plus-dummy$(exeext) > $@
98
99 cc1plus$(exeext): $(CXX_OBJS) cc1plus-checksum.o $(BACKEND) $(LIBDEPS)
100         $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
101               $(CXX_OBJS) cc1plus-checksum.o $(BACKEND) $(LIBS) $(GMPLIBS)
102
103 # Special build rules.
104 $(srcdir)/cp/cfns.h: $(srcdir)/cp/cfns.gperf
105         gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' -L ANSI-C \
106                 $(srcdir)/cp/cfns.gperf > $(srcdir)/cp/cfns.h
107
108 #\f
109 # Build hooks:
110
111 c++.all.cross: g++-cross$(exeext)
112 c++.start.encap: g++$(exeext)
113 c++.rest.encap:
114 c++.info:
115 c++.install-info:
116 c++.dvi:
117 c++.pdf:
118 c++.install-pdf:
119 c++.html:
120 c++.srcinfo:
121 c++.srcextra:
122
123 c++.tags: force
124         cd $(srcdir)/cp; etags -o TAGS.sub *.c *.h --language=none \
125           --regex='/DEFTREECODE [(]\([A-Z_]+\)/\1/' cp-tree.def; \
126         etags --include TAGS.sub --include ../TAGS.sub
127
128 c++.man: doc/g++.1
129
130 c++.srcman: doc/g++.1
131         -cp -p $^ $(srcdir)/doc
132
133 # 'make check' in gcc/ looks for check-c++, as do all toplevel C++-related
134 # check targets.  However, our DejaGNU framework requires 'check-g++' as its
135 # entry point.  We feed the former to the latter here.
136 check-c++ : check-g++
137 # List of targets that can use the generic check- rule and its // variant.
138 lang_checks += check-g++
139
140 #\f
141 # Install hooks:
142 # cc1plus is installed elsewhere as part of $(COMPILERS).
143
144 # Install the driver program as $(target)-g++
145 # and also as either g++ (if native) or $(tooldir)/bin/g++.
146 c++.install-common: installdirs
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         -if [ -f cc1plus$(exeext) ] ; then \
154           if [ -f g++-cross$(exeext) ] ; then \
155             if [ -d $(DESTDIR)$(gcc_tooldir)/bin/. ] ; then \
156               rm -f $(DESTDIR)$(gcc_tooldir)/bin/g++$(exeext); \
157               $(INSTALL_PROGRAM) g++-cross$(exeext) $(DESTDIR)$(gcc_tooldir)/bin/g++$(exeext); \
158               rm -f $(DESTDIR)$(gcc_tooldir)/bin/c++$(exeext); \
159               ( cd $(DESTDIR)$(gcc_tooldir)/bin && \
160                 $(LN) g++$(exeext) c++$(exeext) ); \
161             else true; fi; \
162           else \
163             rm -f $(DESTDIR)$(bindir)/$(GXX_TARGET_INSTALL_NAME)$(exeext); \
164             ( cd $(DESTDIR)$(bindir) && \
165               $(LN) $(GXX_INSTALL_NAME)$(exeext) $(GXX_TARGET_INSTALL_NAME)$(exeext) ); \
166             rm -f $(DESTDIR)$(bindir)/$(CXX_TARGET_INSTALL_NAME)$(exeext); \
167             ( cd $(DESTDIR)$(bindir) && \
168               $(LN) $(CXX_INSTALL_NAME)$(exeext) $(CXX_TARGET_INSTALL_NAME)$(exeext) ); \
169           fi ; \
170         fi
171
172 # We can't use links because not everyone supports them, and we can't use
173 # .so because Irix 6.5 doesn't support them.  So just copy the manpage.
174 doc/g++.1: doc/gcc.1
175         cp $< doc/g++.1
176
177 c++.install-man: $(DESTDIR)$(man1dir)/$(GXX_INSTALL_NAME)$(man1ext)
178
179 $(DESTDIR)$(man1dir)/$(GXX_INSTALL_NAME)$(man1ext): doc/g++.1 installdirs
180         -rm -f $@
181         -$(INSTALL_DATA) $< $@
182         -chmod a-x $@
183
184 c++.uninstall:
185         -rm -rf $(DESTDIR)$(bindir)/$(CXX_INSTALL_NAME)$(exeext)
186         -rm -rf $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext)
187         -rm -rf $(DESTDIR)$(man1dir)/$(GXX_INSTALL_NAME)$(man1ext)
188 #\f
189 # Clean hooks:
190 # A lot of the ancillary files are deleted by the main makefile.
191 # We just have to delete files specific to us.
192
193 c++.mostlyclean:
194         -rm -f doc/g++.1
195         -rm -f cp/*$(objext)
196         -rm -f cp/*$(coverageexts)
197 c++.clean:
198 c++.distclean:
199         -rm -f cp/config.status cp/Makefile
200 c++.maintainer-clean:
201 #\f
202 # Stage hooks:
203 # The main makefile has already created stage?/cp.
204
205 c++.stage1: stage1-start
206         -mv cp/*$(objext) stage1/cp
207 c++.stage2: stage2-start
208         -mv cp/*$(objext) stage2/cp
209 c++.stage3: stage3-start
210         -mv cp/*$(objext) stage3/cp
211 c++.stage4: stage4-start
212         -mv cp/*$(objext) stage4/cp
213 c++.stageprofile: stageprofile-start
214         -mv cp/*$(objext) stageprofile/cp
215 c++.stagefeedback: stagefeedback-start
216         -mv cp/*$(objext) stagefeedback/cp