]>
Commit | Line | Data |
---|---|---|
8bae34da | 1 | ## Makefile for the C++11 sources of the GNU C++ Standard library. |
b2dad0e3 | 2 | ## |
818ab71a | 3 | ## Copyright (C) 1997-2016 Free Software Foundation, Inc. |
b2dad0e3 BK |
4 | ## |
5 | ## This file is part of the libstdc++ version 3 distribution. | |
6 | ## Process this file with automake to produce Makefile.in. | |
7 | ||
8 | ## This file is part of the GNU ISO C++ Library. This library is free | |
9 | ## software; you can redistribute it and/or modify it under the | |
10 | ## terms of the GNU General Public License as published by the | |
748086b7 | 11 | ## Free Software Foundation; either version 3, or (at your option) |
b2dad0e3 BK |
12 | ## any later version. |
13 | ||
14 | ## This library is distributed in the hope that it will be useful, | |
15 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | ## GNU General Public License for more details. | |
18 | ||
19 | ## You should have received a copy of the GNU General Public License along | |
748086b7 JJ |
20 | ## with this library; see the file COPYING3. If not see |
21 | ## <http://www.gnu.org/licenses/>. | |
b2dad0e3 | 22 | |
0df3f383 | 23 | include $(top_srcdir)/fragment.am |
ae9dc931 | 24 | |
0ca7ba9a JW |
25 | if ENABLE_FILESYSTEM_TS |
26 | filesystem_dir = filesystem | |
27 | else | |
28 | filesystem_dir = | |
29 | endif | |
30 | ||
31 | SUBDIRS = c++98 c++11 $(filesystem_dir) | |
8bae34da | 32 | |
714e9334 | 33 | # Cross compiler support. |
f7f049fa CT |
34 | if VTV_CYGMIN |
35 | toolexeclib_LTLIBRARIES = libvtv.la libstdc++.la | |
36 | else | |
b2dad0e3 | 37 | toolexeclib_LTLIBRARIES = libstdc++.la |
f7f049fa CT |
38 | endif |
39 | ||
40 | if VTV_CYGMIN | |
41 | vtv_stubs.cc: | |
42 | rm -f $@ | |
43 | $(LN_S) $(toplevel_srcdir)/libstdc++-v3/libsupc++/vtv_stubs.cc $@ | |
44 | ||
45 | libvtv_la_SOURCES = vtv_stubs.cc | |
46 | libvtv_la_LDFLAGS = $(lt_host_flags) | |
47 | ||
48 | libvtv_la_AM_CXXFLAGS = \ | |
49 | $(glibcxx_compiler_pic_flag) \ | |
50 | $(XTEMPLATE_FLAGS) \ | |
51 | -Wl,-u_vtable_map_vars_start,-u_vtable_map_vars_end \ | |
52 | $(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS) | |
53 | ||
54 | libvtv_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ | |
55 | $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(libvtv_la_AM_CXXFLAGS) \ | |
56 | $(CXXFLAGS) $(libvtv_la_LDFLAGS) $(LDFLAGS) -o $@ | |
57 | endif | |
b2dad0e3 | 58 | |
0b284728 BK |
59 | vpath % $(top_srcdir)/src/c++98 |
60 | vpath % $(top_srcdir)/src/c++11 | |
0ca7ba9a JW |
61 | if ENABLE_FILESYSTEM_TS |
62 | vpath % $(top_srcdir)/src/filesystem | |
63 | endif | |
8bae34da | 64 | |
0b284728 BK |
65 | if GLIBCXX_LDBL_COMPAT |
66 | ldbl_compat_sources = compatibility-ldbl.cc | |
67 | else | |
68 | ldbl_compat_sources = | |
69 | endif | |
70 | ||
495de4f4 | 71 | |
0b284728 BK |
72 | parallel_compat_sources = \ |
73 | compatibility-parallel_list.cc compatibility-parallel_list-2.cc | |
495de4f4 | 74 | |
0b284728 BK |
75 | |
76 | cxx98_sources = \ | |
77 | compatibility.cc \ | |
78 | compatibility-debug_list.cc \ | |
79 | compatibility-debug_list-2.cc \ | |
f92ab29f | 80 | ${ldbl_compat_sources} |
0b284728 BK |
81 | |
82 | cxx11_sources = \ | |
83 | compatibility-c++0x.cc \ | |
84 | compatibility-atomic-c++0x.cc \ | |
2e8a9734 | 85 | compatibility-thread-c++0x.cc \ |
3429db0f JW |
86 | compatibility-chrono.cc \ |
87 | compatibility-condvar.cc | |
0b284728 BK |
88 | |
89 | libstdc___la_SOURCES = $(cxx98_sources) $(cxx11_sources) | |
8bae34da BK |
90 | |
91 | libstdc___la_LIBADD = \ | |
92 | $(GLIBCXX_LIBS) \ | |
93 | $(top_builddir)/libsupc++/libsupc++convenience.la \ | |
94 | $(top_builddir)/src/c++98/libc++98convenience.la \ | |
95 | $(top_builddir)/src/c++11/libc++11convenience.la | |
96 | ||
97 | libstdc___la_DEPENDENCIES = \ | |
98 | ${version_dep} \ | |
99 | $(top_builddir)/libsupc++/libsupc++convenience.la \ | |
100 | $(top_builddir)/src/c++98/libc++98convenience.la \ | |
101 | $(top_builddir)/src/c++11/libc++11convenience.la | |
102 | ||
103 | libstdc___la_LDFLAGS = \ | |
104 | -version-info $(libtool_VERSION) ${version_arg} -lm | |
105 | ||
106 | libstdc___la_LINK = $(CXXLINK) $(libstdc___la_LDFLAGS) | |
107 | ||
0b284728 BK |
108 | # Use special rules for compatibility-ldbl.cc compilation, as we need to |
109 | # pass -mlong-double-64. | |
110 | if GLIBCXX_LDBL_COMPAT | |
111 | compatibility-ldbl.lo: compatibility-ldbl.cc | |
112 | $(LTCXXCOMPILE) -mlong-double-64 -c $< | |
113 | compatibility-ldbl.o: compatibility-ldbl.cc | |
114 | $(CXXCOMPILE) -mlong-double-64 -c $< | |
115 | endif | |
116 | ||
117 | # Use special rules for C++11 files/objects. | |
118 | compatibility-c++0x.lo: compatibility-c++0x.cc | |
119 | $(LTCXXCOMPILE) -std=gnu++11 -c $< | |
120 | compatibility-c++0x.o: compatibility-c++0x.cc | |
121 | $(CXXCOMPILE) -std=gnu++11 -c $< | |
122 | ||
123 | compatibility-atomic-c++0x.lo: compatibility-atomic-c++0x.cc | |
124 | $(LTCXXCOMPILE) -std=gnu++11 -c $< | |
125 | compatibility-atomic-c++0x.o: compatibility-atomic-c++0x.cc | |
126 | $(CXXCOMPILE) -std=gnu++11 -c $< | |
127 | ||
128 | compatibility-thread-c++0x.lo: compatibility-thread-c++0x.cc | |
129 | $(LTCXXCOMPILE) -std=gnu++11 -c $< | |
130 | compatibility-thread-c++0x.o: compatibility-thread-c++0x.cc | |
131 | $(CXXCOMPILE) -std=gnu++11 -c $< | |
132 | ||
2e8a9734 JJ |
133 | compatibility-chrono.lo: compatibility-chrono.cc |
134 | $(LTCXXCOMPILE) -std=gnu++11 -c $< | |
135 | compatibility-chrono.o: compatibility-chrono.cc | |
136 | $(CXXCOMPILE) -std=gnu++11 -c $< | |
137 | ||
3429db0f JW |
138 | compatibility-condvar.lo: compatibility-condvar.cc |
139 | $(LTCXXCOMPILE) -std=gnu++11 -c $< | |
140 | compatibility-condvar.o: compatibility-condvar.cc | |
141 | $(CXXCOMPILE) -std=gnu++11 -c $< | |
142 | ||
ac6d1200 | 143 | # A note on compatibility and static libraries. |
f92ab29f | 144 | # |
ac6d1200 BK |
145 | # static lib == linked against only this version, should not need compat |
146 | # shared lib == linked against potentially all compat versions | |
147 | # | |
148 | # Thus, the shared libs have more compat symbols, which can be found | |
149 | # segregated in the sources with -D_GLIBCXX_SHARED. | |
150 | # | |
151 | # In the sub-directories of libsupc++, src/c++98, src/c++11, only | |
152 | # -prefer-pic objects are generated for the convenience libraries. | |
f92ab29f | 153 | # |
ac6d1200 BK |
154 | # In the main src directory, make shared and static objects just for |
155 | # the compat libraries. Shared objects are compiled with -prefer-pic | |
156 | # -D_GLIBCXX_SHARED and in the .libs sub-directory, static objects are | |
157 | # compiled with -prefer-pic (ie, -fPIC but not -D_GLIBCXX_SHARED) and | |
158 | # the main src directory. | |
159 | # | |
160 | # Why are objects destined for libstdc++.a compiled with -fPIC? First, | |
161 | # because -fPIC is not harmful to use for objects destined for static | |
162 | # libraries. In addition, using -fPIC will allow the use of static | |
163 | # libstdc++.a in the creation of other C++ shared libraries. | |
164 | ||
165 | # AM_CXXFLAGS needs to be in each sub-directory so that it can be | |
8bae34da BK |
166 | # modified in a per-library or per-sub-library way. Need to manually |
167 | # set this option because CONFIG_CXXFLAGS has to be after | |
168 | # OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden | |
169 | # as the occasion calls for it. | |
170 | AM_CXXFLAGS = \ | |
6cd9cb89 | 171 | -std=gnu++98 \ |
ac6d1200 | 172 | $(glibcxx_compiler_pic_flag) \ |
2077db1b | 173 | $(XTEMPLATE_FLAGS) $(VTV_CXXFLAGS) \ |
0b284728 | 174 | $(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS) |
8bae34da | 175 | |
0b284728 | 176 | # Libtool notes |
8bae34da | 177 | |
ac6d1200 | 178 | # 1) In general, libtool expects an argument such as `--tag=CXX' when |
8bae34da BK |
179 | # using the C++ compiler, because that will enable the settings |
180 | # detected when C++ support was being configured. However, when no | |
181 | # such flag is given in the command line, libtool attempts to figure | |
182 | # it out by matching the compiler name in each configuration section | |
183 | # against a prefix of the command line. The problem is that, if the | |
184 | # compiler name and its initial flags stored in the libtool | |
185 | # configuration file don't match those in the command line, libtool | |
186 | # can't decide which configuration to use, and it gives up. The | |
187 | # correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe | |
188 | # CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to | |
ac6d1200 | 189 | # attempt to infer which configuration to use. |
f92ab29f | 190 | # |
ac6d1200 BK |
191 | # The second tag argument, `--tag disable-shared` means that libtool |
192 | # only compiles each source once, for static objects. In actuality, | |
193 | # glibcxx_lt_pic_flag and glibcxx_compiler_shared_flag are added to | |
194 | # the libtool command that is used create the object, which is | |
195 | # suitable for shared libraries. The `--tag disable-shared` must be | |
196 | # placed after --tag CXX lest things CXX undo the affect of | |
197 | # disable-shared. | |
198 | ||
b1d6986c | 199 | # 2) Need to explicitly set LTCXXCOMPILE so that EXTRA_CXX_FLAGS is |
ac6d1200 | 200 | # last. (That way, things like -O2 passed down from the toplevel can |
b1d6986c | 201 | # be overridden by --enable-debug and --enable-cxx-flags.) |
0b284728 BK |
202 | LTCXXCOMPILE = \ |
203 | $(LIBTOOL) --tag CXX \ | |
204 | $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ | |
205 | --mode=compile $(CXX) $(INCLUDES) \ | |
b1d6986c | 206 | $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(EXTRA_CXX_FLAGS) |
8bae34da BK |
207 | |
208 | LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) | |
209 | ||
210 | # 3) We'd have a problem when building the shared libstdc++ object if | |
211 | # the rules automake generates would be used. We cannot allow g++ to | |
212 | # be used since this would add -lstdc++ to the link line which of | |
213 | # course is problematic at this point. So, we get the top-level | |
214 | # directory to configure libstdc++-v3 to use gcc as the C++ | |
215 | # compilation driver. | |
0b284728 BK |
216 | CXXLINK = \ |
217 | $(LIBTOOL) --tag CXX \ | |
218 | $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ | |
219 | --mode=link $(CXX) \ | |
2077db1b | 220 | $(VTV_CXXLINKFLAGS) \ |
0b284728 BK |
221 | $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@ |
222 | ||
6aa43d99 | 223 | # Symbol versioning for shared libraries. |
fb5c309d BK |
224 | if ENABLE_SYMVERS |
225 | libstdc++-symbols.ver: ${glibcxx_srcdir}/$(SYMVER_FILE) \ | |
f9314d01 | 226 | $(port_specific_symbol_files) |
cc2de92d RO |
227 | cp ${glibcxx_srcdir}/$(SYMVER_FILE) $@.tmp |
228 | chmod +w $@.tmp | |
0df3f383 | 229 | if test "x$(port_specific_symbol_files)" != x; then \ |
6defecc2 | 230 | if grep '^# Appended to version file.' \ |
49a52ebc | 231 | $(port_specific_symbol_files) > /dev/null 2>&1; then \ |
cc2de92d | 232 | cat $(port_specific_symbol_files) >> $@.tmp; \ |
6defecc2 | 233 | else \ |
cc2de92d RO |
234 | sed -n '1,/DO NOT DELETE/p' $@.tmp > tmp.top; \ |
235 | sed -n '/DO NOT DELETE/,$$p' $@.tmp > tmp.bottom; \ | |
236 | cat tmp.top $(port_specific_symbol_files) tmp.bottom > $@.tmp; \ | |
6defecc2 JJ |
237 | rm tmp.top tmp.bottom; \ |
238 | fi; \ | |
e6b7a69a | 239 | fi |
9396206b | 240 | $(EGREP) -v '^[ ]*#(#| |$$)' $@.tmp | \ |
d392c399 | 241 | $(CC) -E -P -include $(CONFIG_HEADER) - > $@ || (rm -f $@ ; exit 1) |
cc2de92d | 242 | rm -f $@.tmp |
f9314d01 | 243 | |
c18dc5cc RO |
244 | CLEANFILES = libstdc++-symbols.ver |
245 | ||
f9314d01 | 246 | if ENABLE_SYMVERS_GNU |
fb5c309d BK |
247 | version_arg = -Wl,--version-script=libstdc++-symbols.ver |
248 | version_dep = libstdc++-symbols.ver | |
249 | endif | |
3cbc7af0 BK |
250 | if ENABLE_SYMVERS_GNU_NAMESPACE |
251 | version_arg = -Wl,--version-script=libstdc++-symbols.ver | |
252 | version_dep = libstdc++-symbols.ver | |
253 | endif | |
c18dc5cc RO |
254 | if ENABLE_SYMVERS_SUN |
255 | version_arg = -Wl,-M,libstdc++-symbols.ver-sun | |
256 | version_dep = libstdc++-symbols.ver-sun | |
257 | libstdc++-symbols.ver-sun : libstdc++-symbols.ver \ | |
258 | $(toplevel_srcdir)/contrib/make_sunver.pl \ | |
259 | $(libstdc___la_OBJECTS) $(libstdc___la_LIBADD) | |
260 | CXXFILT="$(CXXFILT)"; export CXXFILT; \ | |
261 | perl $(toplevel_srcdir)/contrib/make_sunver.pl \ | |
262 | libstdc++-symbols.ver \ | |
263 | $(libstdc___la_OBJECTS:%.lo=.libs/%.o) \ | |
264 | `echo $(libstdc___la_LIBADD) | \ | |
265 | sed 's,/\([^/.]*\)\.la,/.libs/\1.a,g'` \ | |
266 | > $@ || (rm -f $@ ; exit 1) | |
267 | endif | |
fb5c309d BK |
268 | if ENABLE_SYMVERS_DARWIN |
269 | version_arg = -Wl,-exported_symbols_list,libstdc++-symbols.explist | |
270 | version_dep = libstdc++-symbols.explist | |
271 | libstdc++-symbols.explist : libstdc++-symbols.ver \ | |
a9fdd472 GK |
272 | ${glibcxx_srcdir}/scripts/make_exports.pl \ |
273 | $(libstdc___la_OBJECTS) $(libstdc___la_LIBADD) | |
274 | perl ${glibcxx_srcdir}/scripts/make_exports.pl \ | |
fb5c309d | 275 | libstdc++-symbols.ver \ |
a9fdd472 GK |
276 | $(libstdc___la_OBJECTS:%.lo=.libs/%.o) \ |
277 | `echo $(libstdc___la_LIBADD) | \ | |
278 | sed 's,/\([^/.]*\)\.la,/.libs/\1.a,g'` \ | |
279 | > $@ || (rm -f $@ ; exit 1) | |
fb5c309d | 280 | endif |
c18dc5cc RO |
281 | |
282 | CLEANFILES += $(version_dep) | |
a9fdd472 | 283 | else |
6aa43d99 | 284 | version_arg = |
7b865c36 | 285 | version_dep = |
6aa43d99 BK |
286 | endif |
287 | ||
56378d0e BK |
288 | |
289 | # Control additional build primary rules. | |
56378d0e BK |
290 | all-once: libstdc++convenience.la $(STAMP_DEBUG) |
291 | install-data-once: $(STAMP_INSTALL_DEBUG) | |
292 | ||
293 | all-local: all-once | |
294 | install-data-local: install-data-once | |
295 | clean-local: | |
296 | rm -rf libstdc++convenience.la stamp* $(CLEAN_DEBUG) | |
6aa43d99 | 297 | |
8bae34da BK |
298 | # Make a non-installed convenience library, so that --disable-static |
299 | # may work. | |
300 | libstdc++convenience.la: $(toolexeclib_LTLIBRARIES) | |
301 | $(CXXLINK) $(libstdc___la_LIBADD) $(LIBS); \ | |
302 | if test ! -f .libs/libstdc++.a; then \ | |
a7a790e9 BK |
303 | cp .libs/libstdc++convenience.a .libs/libstdc++.a; \ |
304 | fi; \ | |
305 | echo `date` > stamp-libstdc++convenience; | |
8bae34da | 306 | |
56378d0e BK |
307 | # Added rules. |
308 | # 1 debug library | |
309 | # 2 supra-convenience library | |
310 | if GLIBCXX_BUILD_DEBUG | |
311 | STAMP_DEBUG = build-debug | |
312 | STAMP_INSTALL_DEBUG = install-debug | |
313 | CLEAN_DEBUG = debug | |
314 | else | |
315 | STAMP_DEBUG = | |
316 | STAMP_INSTALL_DEBUG = | |
317 | CLEAN_DEBUG = | |
318 | endif | |
6aa43d99 | 319 | |
56378d0e | 320 | # Build a debug variant. |
8d03ad01 | 321 | # Take care to fix all possibly-relative paths. |
56378d0e | 322 | debugdir = ${glibcxx_builddir}/src/debug |
e6b7a69a | 323 | stamp-debug: |
6aa43d99 BK |
324 | if test ! -d ${debugdir}; then \ |
325 | mkdir -p ${debugdir}; \ | |
56378d0e | 326 | for d in $(SUBDIRS); do mkdir -p ${debugdir}/$$d; done; \ |
6aa43d99 | 327 | (cd ${debugdir}; \ |
7ec3af37 | 328 | sed -e 's/top_builddir = \.\./top_builddir = ..\/../' \ |
8d03ad01 | 329 | -e 's/top_build_prefix = \.\./top_build_prefix = ..\/../' \ |
7ec3af37 | 330 | -e 's/srcdir = \.\./srcdir = ..\/../' \ |
9606fadb | 331 | -e 's/VPATH = \.\./VPATH = ..\/../' \ |
3d7c150e | 332 | -e 's/glibcxx_basedir = \.\./glibcxx_basedir = ..\/../' \ |
8d03ad01 | 333 | -e 's/MKDIR_P = \.\./MKDIR_P = ..\/../' \ |
56378d0e BK |
334 | < ../Makefile > Makefile ; \ |
335 | for d in . $(SUBDIRS); do \ | |
336 | sed -e 's/top_builddir = \.\./top_builddir = ..\/../' \ | |
337 | -e 's/top_build_prefix = \.\./top_build_prefix = ..\/../' \ | |
338 | -e 's/srcdir = \.\./srcdir = ..\/../' \ | |
339 | -e 's/VPATH = \.\./VPATH = ..\/../' \ | |
340 | -e 's/glibcxx_basedir = \.\./glibcxx_basedir = ..\/../' \ | |
341 | -e 's/MKDIR_P = \.\./MKDIR_P = ..\/../' \ | |
342 | < ../$$d/Makefile > $$d/Makefile ; \ | |
343 | done) ; \ | |
6aa43d99 | 344 | fi; \ |
e6b7a69a | 345 | echo `date` > stamp-debug; |
6aa43d99 | 346 | |
56378d0e BK |
347 | build-debug: stamp-debug |
348 | (cd ${debugdir}; \ | |
349 | mv Makefile Makefile.tmp; \ | |
350 | sed -e 's,all-local: all-once,all-local:,' \ | |
351 | -e 's,install-data-local: install-data-once,install-data-local:,' \ | |
c07e30ca | 352 | -e '/vpath/!s,src/c,src/debug/c,' \ |
56378d0e | 353 | < Makefile.tmp > Makefile ; \ |
c07e30ca | 354 | rm -f Makefile.tmp ; \ |
56378d0e BK |
355 | $(MAKE) CXXFLAGS='$(DEBUG_FLAGS)' \ |
356 | toolexeclibdir=$(glibcxx_toolexeclibdir)/debug all) ; | |
357 | ||
358 | # Install debug library. | |
359 | install-debug: build-debug | |
360 | (cd ${debugdir} && $(MAKE) CXXFLAGS='$(DEBUG_FLAGS)' \ | |
361 | toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install) ; |