2013-07-25 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / cp / Make-lang.in
blob2cb919a21728fba7619679fa114185fe652d9744
1 # Top level -*- makefile -*- fragment for GNU C++.
2 #   Copyright (C) 1994-2013 Free Software Foundation, Inc.
4 #This file is part of GCC.
6 #GCC 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 3, or (at your option)
9 #any later version.
11 #GCC 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.
16 # You should have received a copy of the GNU General Public License
17 # along with GCC; see the file COPYING3.  If not see
18 # <http://www.gnu.org/licenses/>.
20 # This file provides the language dependent support in the main Makefile.
21 # Each language makefile fragment must provide the following targets:
23 # foo.all.cross, foo.start.encap, foo.rest.encap,
24 # foo.install-common, foo.install-man, foo.install-info, foo.install-pdf,
25 # foo.install-html, foo.info, foo.dvi, foo.pdf, foo.html, foo.uninstall,
26 # foo.mostlyclean, foo.clean, foo.distclean,
27 # foo.maintainer-clean, foo.stage1, foo.stage2, foo.stage3, foo.stage4
29 # where `foo' is the name of the language.
31 # It should also provide rules for:
33 # - making any compiler driver (eg: g++)
34 # - the compiler proper (eg: cc1plus)
35 # - define the names for selecting the language in LANGUAGES.
37 # Actual names to use when installing a native compiler.
38 CXX_INSTALL_NAME := $(shell echo c++|sed '$(program_transform_name)')
39 GXX_INSTALL_NAME := $(shell echo g++|sed '$(program_transform_name)')
40 CXX_TARGET_INSTALL_NAME := $(target_noncanonical)-$(shell echo c++|sed '$(program_transform_name)')
41 GXX_TARGET_INSTALL_NAME := $(target_noncanonical)-$(shell echo g++|sed '$(program_transform_name)')
42 CP_PLUGIN_HEADERS := cp-tree.h cxx-pretty-print.h name-lookup.h
44 #\f
45 # Define the names for selecting c++ in LANGUAGES.
46 # Note that it would be nice to move the dependency on g++
47 # into the C++ rule, but that needs a little bit of work
48 # to do the right thing within all.cross.
49 c++: cc1plus$(exeext)
51 # Tell GNU make to ignore these if they exist.
52 .PHONY: c++
54 g++spec.o: $(srcdir)/cp/g++spec.c $(SYSTEM_H) coretypes.h $(TM_H) $(GCC_H) \
55     $(CONFIG_H) $(OPTS_H)
56         (SHLIB='$(SHLIB)'; \
57         $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \
58                 $(INCLUDES) $(srcdir)/cp/g++spec.c)
60 # Create the compiler driver for g++.
61 GXX_OBJS = $(GCC_OBJS) g++spec.o
62 xg++$(exeext): $(GXX_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a $(LIBDEPS)
63         +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \
64           $(GXX_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a \
65           $(EXTRA_GCC_LIBS) $(LIBS)
67 # Create a version of the g++ driver which calls the cross-compiler.
68 g++-cross$(exeext): xg++$(exeext)
69         -rm -f g++-cross$(exeext)
70         cp xg++$(exeext) g++-cross$(exeext)
72 # The compiler itself.
73 # Shared with C front end:
74 CXX_C_OBJS = attribs.o incpath.o \
75         $(C_COMMON_OBJS) $(CXX_TARGET_OBJS)
77 # Language-specific object files for C++ and Objective C++.
78 CXX_AND_OBJCXX_OBJS = cp/call.o cp/decl.o cp/expr.o cp/pt.o cp/typeck2.o \
79  cp/class.o cp/decl2.o cp/error.o cp/lex.o cp/parser.o cp/ptree.o cp/rtti.o \
80  cp/typeck.o cp/cvt.o cp/except.o cp/friend.o cp/init.o cp/method.o \
81  cp/search.o cp/semantics.o cp/tree.o cp/repo.o cp/dump.o cp/optimize.o \
82  cp/mangle.o cp/cp-objcp-common.o cp/name-lookup.o cp/cxx-pretty-print.o \
83  cp/cp-gimplify.o cp/cp-array-notation.o cp/lambda.o $(CXX_C_OBJS)
85 # Language-specific object files for C++.
86 CXX_OBJS = cp/cp-lang.o c-family/stub-objc.o $(CXX_AND_OBJCXX_OBJS)
88 c++_OBJS = $(CXX_OBJS) cc1plus-checksum.o cp/g++spec.o
90 # Use strict warnings for this front end.
91 cp-warn = $(STRICT_WARN)
93 # compute checksum over all object files and the options
94 cc1plus-checksum.c : build/genchecksum$(build_exeext) checksum-options \
95         $(CXX_OBJS) $(BACKEND) $(LIBDEPS) 
96         build/genchecksum$(build_exeext) $(CXX_OBJS) $(BACKEND) $(LIBDEPS) \
97                      checksum-options > cc1plus-checksum.c.tmp &&          \
98         $(srcdir)/../move-if-change cc1plus-checksum.c.tmp cc1plus-checksum.c
100 cc1plus-checksum.o : cc1plus-checksum.c $(CONFIG_H) $(SYSTEM_H)
102 cc1plus$(exeext): $(CXX_OBJS) cc1plus-checksum.o $(BACKEND) $(LIBDEPS)
103         +$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \
104               $(CXX_OBJS) cc1plus-checksum.o $(BACKEND) $(LIBS) $(BACKENDLIBS)
106 ifeq ($(ENABLE_MAINTAINER_RULES), true)
107 # Special build rule.  This is a maintainer rule, that is only
108 # available when GCC is configured with --enable-maintainer-mode.  In
109 # other cases, it is not available to avoid triggering rebuilds if a
110 # user has the source checked out with unusual timestamps.
111 $(srcdir)/cp/cfns.h: $(srcdir)/cp/cfns.gperf
112 else
113 # We keep the rule so that you can still force a rebuild, even if you
114 # didn't configure GCC with --enable-maintainer-mode, by manually
115 # deleting the $(srcdir)/cp/cfns.h file.
116 $(srcdir)/cp/cfns.h:
117 endif
118         gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' -L ANSI-C \
119                 $(srcdir)/cp/cfns.gperf --output-file $(srcdir)/cp/cfns.h
122 # Build hooks:
124 c++.all.cross: g++-cross$(exeext)
125 c++.start.encap: xg++$(exeext)
126 c++.rest.encap:
127 c++.info:
128 c++.install-info:
129 c++.dvi:
130 c++.pdf:
131 c++.install-pdf:
132 c++.install-html:
133 c++.html:
134 c++.srcinfo:
135 c++.srcextra:
137 c++.tags: force
138         cd $(srcdir)/cp; etags -o TAGS.sub *.c *.h --language=none \
139           --regex='/DEFTREECODE [(]\([A-Z_]+\)/\1/' cp-tree.def; \
140         etags --include TAGS.sub --include ../TAGS.sub
142 c++.man: doc/g++.1
144 c++.srcman: doc/g++.1
145         -cp -p $^ $(srcdir)/doc
147 # 'make check' in gcc/ looks for check-c++, as do all toplevel C++-related
148 # check targets.  However, our DejaGNU framework requires 'check-g++' as its
149 # entry point.  We feed the former to the latter here.
150 check-c++ : check-g++
151 # Run the testsute in C++0x mode.
152 check-c++0x:
153         @echo Normal 'make check' now runs the testsuite in C++11 mode as well as C++98.
154 # Run the testsuite with garbage collection at every opportunity.
155 check-g++-strict-gc:
156         $(MAKE) RUNTESTFLAGS="$(RUNTESTFLAGS) --extra_opts,--param,ggc-min-heapsize=0,--param,ggc-min-expand=0" \
157           TESTSUITEDIR="$(TESTSUITEDIR).gc" check-g++
158 check-c++-subtargets : check-g++-subtargets
159 # List of targets that can use the generic check- rule and its // variant.
160 lang_checks += check-g++
161 lang_checks_parallelized += check-g++
162 # For description see comment above check_gcc_parallelize in gcc/Makefile.in.
163 check_g++_parallelize = old-deja.exp dg.exp dg-torture.exp
166 # Install hooks:
167 # cc1plus is installed elsewhere as part of $(COMPILERS).
169 # Install the driver program as $(target)-g++
170 # and also as either g++ (if native) or $(tooldir)/bin/g++.
171 c++.install-common: installdirs
172         -rm -f $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext)
173         -$(INSTALL_PROGRAM) xg++$(exeext) $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext)
174         -chmod a+x $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext)
175         -rm -f $(DESTDIR)$(bindir)/$(CXX_INSTALL_NAME)$(exeext)
176         -( cd $(DESTDIR)$(bindir) && \
177               $(LN) $(GXX_INSTALL_NAME)$(exeext) $(CXX_INSTALL_NAME)$(exeext) )
178         -if [ -f cc1plus$(exeext) ] ; then \
179           if [ -f g++-cross$(exeext) ] ; then \
180             if [ -d $(DESTDIR)$(gcc_tooldir)/bin/. ] ; then \
181               rm -f $(DESTDIR)$(gcc_tooldir)/bin/g++$(exeext); \
182               $(INSTALL_PROGRAM) g++-cross$(exeext) $(DESTDIR)$(gcc_tooldir)/bin/g++$(exeext); \
183               rm -f $(DESTDIR)$(gcc_tooldir)/bin/c++$(exeext); \
184               ( cd $(DESTDIR)$(gcc_tooldir)/bin && \
185                 $(LN) g++$(exeext) c++$(exeext) ); \
186             else true; fi; \
187           else \
188             rm -f $(DESTDIR)$(bindir)/$(GXX_TARGET_INSTALL_NAME)$(exeext); \
189             ( cd $(DESTDIR)$(bindir) && \
190               $(LN) $(GXX_INSTALL_NAME)$(exeext) $(GXX_TARGET_INSTALL_NAME)$(exeext) ); \
191             rm -f $(DESTDIR)$(bindir)/$(CXX_TARGET_INSTALL_NAME)$(exeext); \
192             ( cd $(DESTDIR)$(bindir) && \
193               $(LN) $(CXX_INSTALL_NAME)$(exeext) $(CXX_TARGET_INSTALL_NAME)$(exeext) ); \
194           fi ; \
195         fi
197 # We can't use links because not everyone supports them.  So just copy the
198 # manpage.
199 doc/g++.1: doc/gcc.1
200         cp $< doc/g++.1
202 c++.install-man: $(DESTDIR)$(man1dir)/$(GXX_INSTALL_NAME)$(man1ext)
204 $(DESTDIR)$(man1dir)/$(GXX_INSTALL_NAME)$(man1ext): doc/g++.1 installdirs
205         -rm -f $@
206         -$(INSTALL_DATA) $< $@
207         -chmod a-x $@
209 c++.install-plugin: installdirs
210 # We keep the directory structure for files in config and .def files. All
211 # other files are flattened to a single directory.
212         headers="$(CP_PLUGIN_HEADERS)"; \
213         for file in $$headers; do \
214           path=$(srcdir)/cp/$$file; \
215           dest=$(plugin_includedir)/cp/$$file; \
216           echo $(INSTALL_DATA) $$path $(DESTDIR)$$dest; \
217           dir=`dirname $$dest`; \
218           $(mkinstalldirs) $(DESTDIR)$$dir; \
219           $(INSTALL_DATA) $$path $(DESTDIR)$$dest; \
220         done
222 c++.uninstall:
223         -rm -rf $(DESTDIR)$(bindir)/$(CXX_INSTALL_NAME)$(exeext)
224         -rm -rf $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext)
225         -rm -rf $(DESTDIR)$(man1dir)/$(GXX_INSTALL_NAME)$(man1ext)
227 # Clean hooks:
228 # A lot of the ancillary files are deleted by the main makefile.
229 # We just have to delete files specific to us.
231 c++.mostlyclean:
232         -rm -f doc/g++.1
233         -rm -f cp/*$(objext)
234         -rm -f cp/*$(coverageexts)
235 c++.clean:
236 c++.distclean:
237         -rm -f cp/config.status cp/Makefile
238         -rm -f cxxmain.c
239 c++.maintainer-clean:
241 # Stage hooks:
242 # The main makefile has already created stage?/cp.
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 c++.stageprofile: stageprofile-start
253         -mv cp/*$(objext) stageprofile/cp
254 c++.stagefeedback: stagefeedback-start
255         -mv cp/*$(objext) stagefeedback/cp
258 # .o: .h dependencies.
259 CXX_TREE_H = $(TREE_H) cp/name-lookup.h cp/cp-tree.h $(C_COMMON_H) \
260         $(FUNCTION_H) \
261         $(SYSTEM_H) coretypes.h $(CONFIG_H) $(TARGET_H) $(GGC_H) \
262         $(srcdir)/../include/hashtab.h
263 CXX_PARSER_H = tree.h $(CXX_TREE_H) c-family/c-pragma.h cp/parser.h
264 CXX_PRETTY_PRINT_H = cp/cxx-pretty-print.h $(C_PRETTY_PRINT_H)
266 cp/lex.o: cp/lex.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) \
267   $(C_PRAGMA_H) input.h cp/operators.def $(TM_P_H) \
268   c-family/c-objc.h
269 cp/cp-array-notation.o: cp/cp-array-notation.c $(CONFIG_H) $(SYSTEM_H) \
270   coretypes.h $(TREE_H) $(CXX_TREE_H) $(DIAGNOSTIC_H) tree-iterator.h vec.h \
271   $(GIMPLE_H) c-family/array-notation-common.o $(C_COMMON_H) 
272 cp/cp-lang.o: cp/cp-lang.c $(CXX_TREE_H) $(TM_H) debug.h langhooks.h \
273   $(LANGHOOKS_DEF_H) $(C_COMMON_H) gtype-cp.h gt-cp-cp-lang.h \
274   cp/cp-objcp-common.h $(EXPR_H) $(TARGET_H) $(CXX_PARSER_H)
275 cp/decl.o: cp/decl.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) cp/decl.h \
276   output.h toplev.h $(HASHTAB_H) $(RTL_H) \
277   cp/operators.def $(TM_P_H) $(TREE_INLINE_H) $(DIAGNOSTIC_H) $(C_PRAGMA_H) \
278   debug.h gt-cp-decl.h $(TIMEVAR_H) $(TARGET_H) $(PLUGIN_H) \
279   intl.h tree-iterator.h pointer-set.h $(SPLAY_TREE_H) \
280   c-family/c-objc.h
281 cp/decl2.o: cp/decl2.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) cp/decl.h \
282   toplev.h $(C_COMMON_H) gt-cp-decl2.h $(CGRAPH_H) \
283   $(C_PRAGMA_H) dumpfile.h intl.h $(TARGET_H) $(GIMPLE_H) pointer-set.h \
284   $(SPLAY_TREE_H) c-family/c-ada-spec.h \
285   c-family/c-objc.h
286 cp/cp-objcp-common.o : cp/cp-objcp-common.c $(CONFIG_H) $(SYSTEM_H) \
287   coretypes.h $(TM_H) $(TREE_H) $(CXX_TREE_H) $(C_COMMON_H) \
288   langhooks.h $(LANGHOOKS_DEF_H) $(DIAGNOSTIC_H) debug.h \
289   $(CXX_PRETTY_PRINT_H) cp/cp-objcp-common.h gt-cp-cp-objcp-common.h
290 cp/typeck2.o: cp/typeck2.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) \
291   $(TM_P_H) $(DIAGNOSTIC_CORE_H) gt-cp-typeck2.h $(REAL_H) intl.h
292 cp/typeck.o: cp/typeck.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) $(PARAMS_H) \
293   toplev.h $(DIAGNOSTIC_H) convert.h $(C_COMMON_H) $(TARGET_H) \
294   c-family/c-objc.h
295 cp/class.o: cp/class.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) toplev.h \
296   $(TARGET_H) convert.h $(CGRAPH_H) dumpfile.h gt-cp-class.h \
297   $(SPLAY_TREE_H) pointer-set.h $(HASH_TABLE_H)
298 cp/call.o: cp/call.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) toplev.h \
299   $(DIAGNOSTIC_CORE_H) intl.h gt-cp-call.h convert.h $(TARGET_H) langhooks.h \
300   $(TIMEVAR_H) c-family/c-objc.h
301 cp/friend.o: cp/friend.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H)
302 cp/init.o: cp/init.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) \
303   $(EXCEPT_H) $(TARGET_H)
304 cp/method.o: cp/method.c $(CXX_TREE_H) $(TM_H) toplev.h \
305   $(TM_P_H) $(TARGET_H) $(DIAGNOSTIC_H) gt-cp-method.h $(GIMPLE_H) \
306   $(COMMON_TARGET_H)
307 cp/cvt.o: cp/cvt.c $(CXX_TREE_H) $(TM_H) cp/decl.h $(FLAGS_H) \
308   convert.h $(TARGET_H) intl.h
309 cp/search.o: cp/search.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) toplev.h \
310   intl.h
311 cp/tree.o: cp/tree.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) \
312   $(TREE_INLINE_H) $(REAL_H) gt-cp-tree.h \
313   $(TARGET_H) debug.h $(CGRAPH_H) $(SPLAY_TREE_H) $(GIMPLE_H) $(HASH_TABLE_H)
314 cp/ptree.o: cp/ptree.c $(CXX_TREE_H) $(TM_H)
315 cp/rtti.o: cp/rtti.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) convert.h \
316   $(TARGET_H) $(C_PRAGMA_H) gt-cp-rtti.h intl.h
317 cp/except.o: cp/except.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) \
318   cp/cfns.h $(TREE_INLINE_H) $(TARGET_H) gt-cp-except.h
319 cp/expr.o: cp/expr.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) $(TM_P_H)
320 cp/pt.o: cp/pt.c $(CXX_TREE_H) $(TM_H) cp/decl.h cp/cp-objcp-common.h \
321   toplev.h $(TREE_INLINE_H) pointer-set.h gt-cp-pt.h intl.h \
322   c-family/c-objc.h
323 cp/error.o: cp/error.c $(CXX_TREE_H) $(TM_H) $(DIAGNOSTIC_H) \
324   $(FLAGS_H) $(REAL_H) $(LANGHOOKS_DEF_H) $(CXX_PRETTY_PRINT_H) \
325   tree-diagnostic.h tree-pretty-print.h pointer-set.h c-family/c-objc.h
326 cp/repo.o: cp/repo.c $(CXX_TREE_H) $(TM_H) toplev.h $(DIAGNOSTIC_CORE_H) \
327   gt-cp-repo.h
328 cp/semantics.o: cp/semantics.c $(CXX_TREE_H) $(TM_H) toplev.h \
329   $(FLAGS_H) $(RTL_H) $(TIMEVAR_H) \
330   $(TREE_INLINE_H) $(CGRAPH_H) $(TARGET_H) $(C_COMMON_H) $(GIMPLE_H) \
331   bitmap.h gt-cp-semantics.h c-family/c-objc.h $(HASH_TABLE_H)
332 cp/dump.o: cp/dump.c $(CXX_TREE_H) $(TM_H) $(TREE_DUMP_H)
333 cp/optimize.o: cp/optimize.c $(CXX_TREE_H) $(TM_H) \
334   input.h $(PARAMS_H) debug.h $(TREE_INLINE_H) $(GIMPLE_H) \
335   $(TARGET_H) tree-iterator.h $(CGRAPH_H) $(DIAGNOSTIC_CORE_H) \
336   dumpfile.h
337 cp/mangle.o: cp/mangle.c $(CXX_TREE_H) $(TM_H) $(REAL_H) \
338   gt-cp-mangle.h $(TARGET_H) $(TM_P_H) $(CGRAPH_H)
339 cp/parser.o: cp/parser.c $(CXX_TREE_H) $(TM_H) $(DIAGNOSTIC_CORE_H) \
340   gt-cp-parser.h $(TARGET_H) $(PLUGIN_H) intl.h cp/decl.h \
341   c-family/c-objc.h tree-pretty-print.h $(CXX_PARSER_H) $(TIMEVAR_H)
342 cp/cp-gimplify.o: cp/cp-gimplify.c $(CXX_TREE_H) $(C_COMMON_H) \
343         $(TM_H) coretypes.h pointer-set.h tree-iterator.h $(SPLAY_TREE_H)
345 cp/name-lookup.o: cp/name-lookup.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
346         $(TM_H) $(CXX_TREE_H) $(TIMEVAR_H) gt-cp-name-lookup.h $(PARAMS_H) \
347         $(DIAGNOSTIC_CORE_H) $(FLAGS_H) debug.h pointer-set.h
349 cp/cxx-pretty-print.o: cp/cxx-pretty-print.c $(CXX_PRETTY_PRINT_H) \
350   $(CONFIG_H) $(SYSTEM_H) $(TM_H) coretypes.h $(CXX_TREE_H) tree-pretty-print.h