]>
Commit | Line | Data |
---|---|---|
90a83261 | 1 | # Top level -*- makefile -*- fragment for GNU C++. |
f1717362 | 2 | # Copyright (C) 1994-2016 Free Software Foundation, Inc. |
6e498b5c | 3 | |
5d1e9c98 | 4 | #This file is part of GCC. |
6e498b5c | 5 | |
5d1e9c98 | 6 | #GCC is free software; you can redistribute it and/or modify |
6e498b5c | 7 | #it under the terms of the GNU General Public License as published by |
aa139c3f | 8 | #the Free Software Foundation; either version 3, or (at your option) |
6e498b5c | 9 | #any later version. |
10 | ||
5d1e9c98 | 11 | #GCC is distributed in the hope that it will be useful, |
6e498b5c | 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. | |
15 | ||
aa139c3f | 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/>. | |
6e498b5c | 19 | |
20 | # This file provides the language dependent support in the main Makefile. | |
21 | # Each language makefile fragment must provide the following targets: | |
22 | # | |
ae6555f9 | 23 | # foo.all.cross, foo.start.encap, foo.rest.encap, |
26e296a8 | 24 | # foo.install-common, foo.install-man, foo.install-info, foo.install-pdf, |
fb433b0b | 25 | # foo.install-html, foo.info, foo.dvi, foo.pdf, foo.html, foo.uninstall, |
80e909c6 | 26 | # foo.mostlyclean, foo.clean, foo.distclean, |
a8514488 | 27 | # foo.maintainer-clean, foo.stage1, foo.stage2, foo.stage3, foo.stage4 |
6e498b5c | 28 | # |
29 | # where `foo' is the name of the language. | |
30 | # | |
31 | # It should also provide rules for: | |
32 | # | |
33 | # - making any compiler driver (eg: g++) | |
34 | # - the compiler proper (eg: cc1plus) | |
35 | # - define the names for selecting the language in LANGUAGES. | |
6e498b5c | 36 | |
ddb9bca7 | 37 | # Actual names to use when installing a native compiler. |
88a86c80 | 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)') | |
d78cc47b | 42 | CP_PLUGIN_HEADERS := cp-tree.h cxx-pretty-print.h name-lookup.h type-utils.h |
ddb9bca7 | 43 | |
6686e84d | 44 | #\f |
6e498b5c | 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. | |
9f30f9e7 | 49 | c++: cc1plus$(exeext) |
6e498b5c | 50 | |
c9db0571 | 51 | # Tell GNU make to ignore these if they exist. |
9f30f9e7 | 52 | .PHONY: c++ |
c9db0571 | 53 | |
4c42ae66 | 54 | CFLAGS-cp/g++spec.o += $(DRIVER_DEFINES) |
b0df6589 | 55 | |
6e498b5c | 56 | # Create the compiler driver for g++. |
4c42ae66 | 57 | GXX_OBJS = $(GCC_OBJS) cp/g++spec.o |
3e54888f | 58 | xg++$(exeext): $(GXX_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a $(LIBDEPS) |
70293f47 | 59 | +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \ |
76fd9e61 | 60 | $(GXX_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a \ |
61 | $(EXTRA_GCC_LIBS) $(LIBS) | |
6e498b5c | 62 | |
63 | # Create a version of the g++ driver which calls the cross-compiler. | |
3e54888f | 64 | g++-cross$(exeext): xg++$(exeext) |
b0df6589 | 65 | -rm -f g++-cross$(exeext) |
3e54888f | 66 | cp xg++$(exeext) g++-cross$(exeext) |
6e498b5c | 67 | |
f357ac87 | 68 | # The compiler itself. |
69 | # Shared with C front end: | |
eb65953e | 70 | CXX_C_OBJS = attribs.o incpath.o \ |
7bedc3a0 | 71 | $(C_COMMON_OBJS) $(CXX_TARGET_OBJS) |
f357ac87 | 72 | |
11a35d8f | 73 | # Language-specific object files for C++ and Objective C++. |
74 | CXX_AND_OBJCXX_OBJS = cp/call.o cp/decl.o cp/expr.o cp/pt.o cp/typeck2.o \ | |
0a3b29ad | 75 | cp/class.o cp/decl2.o cp/error.o cp/lex.o cp/parser.o cp/ptree.o cp/rtti.o \ |
76 | cp/typeck.o cp/cvt.o cp/except.o cp/friend.o cp/init.o cp/method.o \ | |
0de2b732 | 77 | cp/search.o cp/semantics.o cp/tree.o cp/repo.o cp/dump.o cp/optimize.o \ |
5dd72fac | 78 | cp/mangle.o cp/cp-objcp-common.o cp/name-lookup.o cp/cxx-pretty-print.o \ |
f2697631 | 79 | cp/cp-cilkplus.o \ |
b710ec85 | 80 | cp/cp-gimplify.o cp/cp-array-notation.o cp/lambda.o \ |
56c12fd4 | 81 | cp/vtable-class-hierarchy.o cp/constexpr.o cp/cp-ubsan.o \ |
82 | cp/constraint.o cp/logic.o $(CXX_C_OBJS) | |
11a35d8f | 83 | |
84 | # Language-specific object files for C++. | |
7bedc3a0 | 85 | CXX_OBJS = cp/cp-lang.o c-family/stub-objc.o $(CXX_AND_OBJCXX_OBJS) |
f357ac87 | 86 | |
18cfeada | 87 | c++_OBJS = $(CXX_OBJS) cc1plus-checksum.o cp/g++spec.o |
6fb2153a | 88 | |
9e91bfe8 | 89 | # Use strict warnings for this front end. |
9d61b2aa | 90 | cp-warn = $(STRICT_WARN) |
f357ac87 | 91 | |
18cfeada | 92 | # compute checksum over all object files and the options |
93 | cc1plus-checksum.c : build/genchecksum$(build_exeext) checksum-options \ | |
94 | $(CXX_OBJS) $(BACKEND) $(LIBDEPS) | |
95 | build/genchecksum$(build_exeext) $(CXX_OBJS) $(BACKEND) $(LIBDEPS) \ | |
96 | checksum-options > cc1plus-checksum.c.tmp && \ | |
97 | $(srcdir)/../move-if-change cc1plus-checksum.c.tmp cc1plus-checksum.c | |
f1035767 | 98 | |
f1035767 | 99 | cc1plus$(exeext): $(CXX_OBJS) cc1plus-checksum.o $(BACKEND) $(LIBDEPS) |
be5f9e46 | 100 | +$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \ |
268a100a | 101 | $(CXX_OBJS) cc1plus-checksum.o $(BACKEND) $(LIBS) $(BACKENDLIBS) |
f357ac87 | 102 | |
141d02d1 | 103 | ifeq ($(ENABLE_MAINTAINER_RULES), true) |
104 | # Special build rule. This is a maintainer rule, that is only | |
105 | # available when GCC is configured with --enable-maintainer-mode. In | |
106 | # other cases, it is not available to avoid triggering rebuilds if a | |
107 | # user has the source checked out with unusual timestamps. | |
f357ac87 | 108 | $(srcdir)/cp/cfns.h: $(srcdir)/cp/cfns.gperf |
141d02d1 | 109 | else |
110 | # We keep the rule so that you can still force a rebuild, even if you | |
111 | # didn't configure GCC with --enable-maintainer-mode, by manually | |
112 | # deleting the $(srcdir)/cp/cfns.h file. | |
113 | $(srcdir)/cp/cfns.h: | |
114 | endif | |
f82b06e0 | 115 | gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' -L ANSI-C \ |
141d02d1 | 116 | $(srcdir)/cp/cfns.gperf --output-file $(srcdir)/cp/cfns.h |
f357ac87 | 117 | |
6686e84d | 118 | #\f |
6e498b5c | 119 | # Build hooks: |
120 | ||
05988adb | 121 | c++.all.cross: g++-cross$(exeext) |
3e54888f | 122 | c++.start.encap: xg++$(exeext) |
05988adb | 123 | c++.rest.encap: |
ca6eabd1 | 124 | c++.info: |
352ea6ae | 125 | c++.install-info: |
126 | c++.dvi: | |
51f93521 | 127 | c++.pdf: |
26e296a8 | 128 | c++.install-pdf: |
fb433b0b | 129 | c++.install-html: |
352ea6ae | 130 | c++.html: |
ca6eabd1 | 131 | c++.srcinfo: |
a6b4c5a9 | 132 | c++.srcextra: |
6e498b5c | 133 | |
975d01b5 | 134 | c++.tags: force |
56c12fd4 | 135 | cd $(srcdir)/cp; etags -o TAGS.sub *.c *.cc *.h --language=none \ |
39aebbc3 | 136 | --regex='/DEFTREECODE [(]\([A-Z_]+\)/\1/' cp-tree.def; \ |
137 | etags --include TAGS.sub --include ../TAGS.sub | |
975d01b5 | 138 | |
ca6eabd1 | 139 | c++.man: doc/g++.1 |
140 | ||
141 | c++.srcman: doc/g++.1 | |
142 | -cp -p $^ $(srcdir)/doc | |
215d428d | 143 | |
a00dec3b | 144 | # 'make check' in gcc/ looks for check-c++, as do all toplevel C++-related |
145 | # check targets. However, our DejaGNU framework requires 'check-g++' as its | |
146 | # entry point. We feed the former to the latter here. | |
71a3866b | 147 | check-c++ : check-g++ |
0001fd8d | 148 | |
149 | # Run the testsuite in C++1z mode. | |
150 | check-c++1z: | |
03af97e1 | 151 | $(MAKE) GXX_TESTSUITE_STDS=1z check-g++ |
0001fd8d | 152 | |
153 | # Run the testsuite in all standard conformance levels. | |
154 | check-c++-all: | |
155 | $(MAKE) RUNTESTFLAGS="$(RUNTESTFLAGS) --stds=98,11,14,1z" check-g++ | |
156 | ||
cf797b5e | 157 | # Run the testsuite with garbage collection at every opportunity. |
158 | check-g++-strict-gc: | |
159 | $(MAKE) RUNTESTFLAGS="$(RUNTESTFLAGS) --extra_opts,--param,ggc-min-heapsize=0,--param,ggc-min-expand=0" \ | |
160 | TESTSUITEDIR="$(TESTSUITEDIR).gc" check-g++ | |
a0d20ccb | 161 | check-c++-subtargets : check-g++-subtargets |
a00dec3b | 162 | # List of targets that can use the generic check- rule and its // variant. |
71a3866b | 163 | lang_checks += check-g++ |
a0d20ccb | 164 | lang_checks_parallelized += check-g++ |
eeec71b4 | 165 | # For description see the check_$lang_parallelize comment in gcc/Makefile.in. |
eb9bd3cc | 166 | check_g++_parallelize = 10000 |
6686e84d | 167 | #\f |
6e498b5c | 168 | # Install hooks: |
169 | # cc1plus is installed elsewhere as part of $(COMPILERS). | |
170 | ||
955edcde | 171 | # Install the driver program as $(target)-g++ and $(target)-c++, and |
172 | # also as g++ and c++ if native. | |
414d46fe | 173 | c++.install-common: installdirs |
a3d93be3 | 174 | -if test "$(enable_as_accelerator)" != "yes" ; then \ |
175 | rm -f $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext); \ | |
176 | $(INSTALL_PROGRAM) xg++$(exeext) $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext); \ | |
177 | chmod a+x $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext); \ | |
178 | rm -f $(DESTDIR)$(bindir)/$(CXX_INSTALL_NAME)$(exeext); \ | |
179 | ( cd $(DESTDIR)$(bindir) && \ | |
180 | $(LN) $(GXX_INSTALL_NAME)$(exeext) $(CXX_INSTALL_NAME)$(exeext) ); \ | |
181 | if [ -f cc1plus$(exeext) ] ; then \ | |
182 | if [ ! -f g++-cross$(exeext) ] ; then \ | |
183 | rm -f $(DESTDIR)$(bindir)/$(GXX_TARGET_INSTALL_NAME)$(exeext); \ | |
184 | ( cd $(DESTDIR)$(bindir) && \ | |
185 | $(LN) $(GXX_INSTALL_NAME)$(exeext) $(GXX_TARGET_INSTALL_NAME)$(exeext) ); \ | |
186 | rm -f $(DESTDIR)$(bindir)/$(CXX_TARGET_INSTALL_NAME)$(exeext); \ | |
187 | ( cd $(DESTDIR)$(bindir) && \ | |
188 | $(LN) $(CXX_INSTALL_NAME)$(exeext) $(CXX_TARGET_INSTALL_NAME)$(exeext) ); \ | |
189 | fi ; \ | |
190 | fi; \ | |
6e498b5c | 191 | fi |
192 | ||
5641963c | 193 | # We can't use links because not everyone supports them. So just copy the |
194 | # manpage. | |
ca6eabd1 | 195 | doc/g++.1: doc/gcc.1 |
49e86385 | 196 | cp $< doc/g++.1 |
a7a78208 | 197 | |
9031d10b | 198 | c++.install-man: $(DESTDIR)$(man1dir)/$(GXX_INSTALL_NAME)$(man1ext) |
ca6eabd1 | 199 | |
01ac74a6 | 200 | $(DESTDIR)$(man1dir)/$(GXX_INSTALL_NAME)$(man1ext): doc/g++.1 installdirs |
ca6eabd1 | 201 | -rm -f $@ |
202 | -$(INSTALL_DATA) $< $@ | |
203 | -chmod a-x $@ | |
6e498b5c | 204 | |
c02b6f4e | 205 | c++.install-plugin: installdirs |
206 | # We keep the directory structure for files in config and .def files. All | |
207 | # other files are flattened to a single directory. | |
208 | headers="$(CP_PLUGIN_HEADERS)"; \ | |
209 | for file in $$headers; do \ | |
210 | path=$(srcdir)/cp/$$file; \ | |
211 | dest=$(plugin_includedir)/cp/$$file; \ | |
212 | echo $(INSTALL_DATA) $$path $(DESTDIR)$$dest; \ | |
213 | dir=`dirname $$dest`; \ | |
214 | $(mkinstalldirs) $(DESTDIR)$$dir; \ | |
215 | $(INSTALL_DATA) $$path $(DESTDIR)$$dest; \ | |
216 | done | |
217 | ||
6e498b5c | 218 | c++.uninstall: |
b113996a | 219 | -rm -rf $(DESTDIR)$(bindir)/$(CXX_INSTALL_NAME)$(exeext) |
b113996a | 220 | -rm -rf $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext) |
b113996a | 221 | -rm -rf $(DESTDIR)$(man1dir)/$(GXX_INSTALL_NAME)$(man1ext) |
6686e84d | 222 | #\f |
6e498b5c | 223 | # Clean hooks: |
224 | # A lot of the ancillary files are deleted by the main makefile. | |
225 | # We just have to delete files specific to us. | |
226 | ||
227 | c++.mostlyclean: | |
ca6eabd1 | 228 | -rm -f doc/g++.1 |
05988adb | 229 | -rm -f cp/*$(objext) |
d5a37d75 | 230 | -rm -f cp/*$(coverageexts) |
b1891a46 | 231 | -rm -f xg++$(exeext) g++-cross$(exeext) cc1plus$(exeext) |
6e498b5c | 232 | c++.clean: |
233 | c++.distclean: | |
234 | -rm -f cp/config.status cp/Makefile | |
e53d55e7 | 235 | -rm -f cxxmain.c |
a8514488 | 236 | c++.maintainer-clean: |
6686e84d | 237 | #\f |
6e498b5c | 238 | # Stage hooks: |
239 | # The main makefile has already created stage?/cp. | |
240 | ||
860740a7 | 241 | c++.stage1: stage1-start |
a14eefe6 | 242 | -mv cp/*$(objext) stage1/cp |
860740a7 | 243 | c++.stage2: stage2-start |
a14eefe6 | 244 | -mv cp/*$(objext) stage2/cp |
860740a7 | 245 | c++.stage3: stage3-start |
a14eefe6 | 246 | -mv cp/*$(objext) stage3/cp |
860740a7 | 247 | c++.stage4: stage4-start |
a14eefe6 | 248 | -mv cp/*$(objext) stage4/cp |
ef3bb540 | 249 | c++.stageprofile: stageprofile-start |
250 | -mv cp/*$(objext) stageprofile/cp | |
251 | c++.stagefeedback: stagefeedback-start | |
252 | -mv cp/*$(objext) stagefeedback/cp |