1 ## Makefile for the C++11 sources of the GNU C++ Standard library.
3 ## Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
4 ## 2006, 2007, 2008, 2009, 2010, 2011, 2012
5 ## Free Software Foundation, Inc.
7 ## This file is part of the libstdc++ version 3 distribution.
8 ## Process this file with automake to produce Makefile.in.
10 ## This file is part of the GNU ISO C++ Library. This library is free
11 ## software; you can redistribute it and/or modify it under the
12 ## terms of the GNU General Public License as published by the
13 ## Free Software Foundation; either version 3, or (at your option)
16 ## This library is distributed in the hope that it will be useful,
17 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ## GNU General Public License for more details.
21 ## You should have received a copy of the GNU General Public License along
22 ## with this library; see the file COPYING3. If not see
23 ## <http://www.gnu.org/licenses/>.
25 include $(top_srcdir)/fragment.am
29 # Cross compiler support.
30 toolexeclib_LTLIBRARIES = libstdc++.la
32 vpath % $(top_srcdir)/src/c++98
33 vpath % $(top_srcdir)/src/c++11
35 if GLIBCXX_LDBL_COMPAT
36 ldbl_compat_sources = compatibility-ldbl.cc
42 parallel_compat_sources = \
43 compatibility-parallel_list.cc compatibility-parallel_list-2.cc
45 parallel_compat_sources =
50 compatibility-debug_list.cc \
51 compatibility-debug_list-2.cc \
52 compatibility-list.cc \
53 compatibility-list-2.cc \
54 ${ldbl_compat_sources} \
55 ${parallel_compat_sources}
58 compatibility-c++0x.cc \
59 compatibility-atomic-c++0x.cc \
60 compatibility-thread-c++0x.cc
62 libstdc___la_SOURCES = $(cxx98_sources) $(cxx11_sources)
64 libstdc___la_LIBADD = \
66 $(top_builddir)/libsupc++/libsupc++convenience.la \
67 $(top_builddir)/src/c++98/libc++98convenience.la \
68 $(top_builddir)/src/c++11/libc++11convenience.la
70 libstdc___la_DEPENDENCIES = \
72 $(top_builddir)/libsupc++/libsupc++convenience.la \
73 $(top_builddir)/src/c++98/libc++98convenience.la \
74 $(top_builddir)/src/c++11/libc++11convenience.la
77 libstdc___la_LDFLAGS = \
78 -version-info $(libtool_VERSION) ${version_arg} -lm
80 libstdc___la_LDFLAGS = \
81 -version-info $(libtool_VERSION) ${version_arg}
84 libstdc___la_LINK = $(CXXLINK) $(libstdc___la_LDFLAGS)
87 # Use special rules for parallel mode compilation.
88 PARALLEL_FLAGS = -fopenmp -D_GLIBCXX_PARALLEL -I$(glibcxx_builddir)/../libgomp
89 compatibility-parallel_list.lo: compatibility-parallel_list.cc
91 compatibility-parallel_list.o: compatibility-parallel_list.cc
94 compatibility-parallel_list-2.lo: compatibility-parallel_list-2.cc
96 compatibility-parallel_list-2.o: compatibility-parallel_list-2.cc
99 # Use special rules for compatibility-ldbl.cc compilation, as we need to
100 # pass -mlong-double-64.
101 if GLIBCXX_LDBL_COMPAT
102 compatibility-ldbl.lo: compatibility-ldbl.cc
103 $(LTCXXCOMPILE) -mlong-double-64 -c $<
104 compatibility-ldbl.o: compatibility-ldbl.cc
105 $(CXXCOMPILE) -mlong-double-64 -c $<
108 # Use special rules for C++11 files/objects.
109 compatibility-c++0x.lo: compatibility-c++0x.cc
110 $(LTCXXCOMPILE) -std=gnu++11 -c $<
111 compatibility-c++0x.o: compatibility-c++0x.cc
112 $(CXXCOMPILE) -std=gnu++11 -c $<
114 compatibility-atomic-c++0x.lo: compatibility-atomic-c++0x.cc
115 $(LTCXXCOMPILE) -std=gnu++11 -c $<
116 compatibility-atomic-c++0x.o: compatibility-atomic-c++0x.cc
117 $(CXXCOMPILE) -std=gnu++11 -c $<
119 compatibility-thread-c++0x.lo: compatibility-thread-c++0x.cc
120 $(LTCXXCOMPILE) -std=gnu++11 -c $<
121 compatibility-thread-c++0x.o: compatibility-thread-c++0x.cc
122 $(CXXCOMPILE) -std=gnu++11 -c $<
124 # AM_CXXFLAGS needs to be in each subdirectory so that it can be
125 # modified in a per-library or per-sub-library way. Need to manually
126 # set this option because CONFIG_CXXFLAGS has to be after
127 # OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
128 # as the occasion calls for it.
131 $(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS)
135 # 1) Need to explicitly set LTCXXCOMPILE so that AM_CXXFLAGS is
136 # last. (That way, things like -O2 passed down from the toplevel can
137 # be overridden by --enable-debug.)
139 # 2) In general, libtool expects an argument such as `--tag=CXX' when
140 # using the C++ compiler, because that will enable the settings
141 # detected when C++ support was being configured. However, when no
142 # such flag is given in the command line, libtool attempts to figure
143 # it out by matching the compiler name in each configuration section
144 # against a prefix of the command line. The problem is that, if the
145 # compiler name and its initial flags stored in the libtool
146 # configuration file don't match those in the command line, libtool
147 # can't decide which configuration to use, and it gives up. The
148 # correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe
149 # CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to
150 # attempt to infer which configuration to use
152 $(LIBTOOL) --tag CXX \
153 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
154 --mode=compile $(CXX) $(INCLUDES) \
155 $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
157 LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
159 # 3) We'd have a problem when building the shared libstdc++ object if
160 # the rules automake generates would be used. We cannot allow g++ to
161 # be used since this would add -lstdc++ to the link line which of
162 # course is problematic at this point. So, we get the top-level
163 # directory to configure libstdc++-v3 to use gcc as the C++
164 # compilation driver.
166 $(LIBTOOL) --tag CXX \
167 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
169 $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@
172 # Symbol versioning for shared libraries.
174 libstdc++-symbols.ver: ${glibcxx_srcdir}/$(SYMVER_FILE) \
175 $(port_specific_symbol_files)
176 cp ${glibcxx_srcdir}/$(SYMVER_FILE) $@.tmp
178 if test "x$(port_specific_symbol_files)" != x; then \
179 if grep '^# Appended to version file.' \
180 $(port_specific_symbol_files) /dev/null > /dev/null 2>&1; then \
181 cat $(port_specific_symbol_files) >> $@.tmp; \
183 sed -n '1,/DO NOT DELETE/p' $@.tmp > tmp.top; \
184 sed -n '/DO NOT DELETE/,$$p' $@.tmp > tmp.bottom; \
185 cat tmp.top $(port_specific_symbol_files) tmp.bottom > $@.tmp; \
186 rm tmp.top tmp.bottom; \
189 $(EGREP) -v '^[ ]*#(#| |$$)' $@.tmp | \
190 $(CC) -E -P -include ../config.h - > $@ || (rm -f $@ ; exit 1)
193 CLEANFILES = libstdc++-symbols.ver
195 if ENABLE_SYMVERS_GNU
196 version_arg = -Wl,--version-script=libstdc++-symbols.ver
197 version_dep = libstdc++-symbols.ver
199 if ENABLE_SYMVERS_GNU_NAMESPACE
200 version_arg = -Wl,--version-script=libstdc++-symbols.ver
201 version_dep = libstdc++-symbols.ver
203 if ENABLE_SYMVERS_SUN
204 version_arg = -Wl,-M,libstdc++-symbols.ver-sun
205 version_dep = libstdc++-symbols.ver-sun
206 libstdc++-symbols.ver-sun : libstdc++-symbols.ver \
207 $(toplevel_srcdir)/contrib/make_sunver.pl \
208 $(libstdc___la_OBJECTS) $(libstdc___la_LIBADD)
209 CXXFILT="$(CXXFILT)"; export CXXFILT; \
210 perl $(toplevel_srcdir)/contrib/make_sunver.pl \
211 libstdc++-symbols.ver \
212 $(libstdc___la_OBJECTS:%.lo=.libs/%.o) \
213 `echo $(libstdc___la_LIBADD) | \
214 sed 's,/\([^/.]*\)\.la,/.libs/\1.a,g'` \
215 > $@ || (rm -f $@ ; exit 1)
217 if ENABLE_SYMVERS_DARWIN
218 version_arg = -Wl,-exported_symbols_list,libstdc++-symbols.explist
219 version_dep = libstdc++-symbols.explist
220 libstdc++-symbols.explist : libstdc++-symbols.ver \
221 ${glibcxx_srcdir}/scripts/make_exports.pl \
222 $(libstdc___la_OBJECTS) $(libstdc___la_LIBADD)
223 perl ${glibcxx_srcdir}/scripts/make_exports.pl \
224 libstdc++-symbols.ver \
225 $(libstdc___la_OBJECTS:%.lo=.libs/%.o) \
226 `echo $(libstdc___la_LIBADD) | \
227 sed 's,/\([^/.]*\)\.la,/.libs/\1.a,g'` \
228 > $@ || (rm -f $@ ; exit 1)
231 CLEANFILES += $(version_dep)
238 # Control additional build primary rules.
239 all-once: libstdc++convenience.la $(STAMP_DEBUG)
240 install-data-once: $(STAMP_INSTALL_DEBUG)
243 install-data-local: install-data-once
245 rm -rf libstdc++convenience.la stamp* $(CLEAN_DEBUG)
247 # Make a non-installed convenience library, so that --disable-static
249 libstdc++convenience.la: $(toolexeclib_LTLIBRARIES)
250 $(CXXLINK) $(libstdc___la_LIBADD) $(LIBS); \
251 if test ! -f .libs/libstdc++.a; then \
252 cp .libs/libstdc++convenience.a .libs/libstdc++.a; \
254 echo `date` > stamp-libstdc++convenience;
258 # 2 supra-convenience library
259 if GLIBCXX_BUILD_DEBUG
260 STAMP_DEBUG = build-debug
261 STAMP_INSTALL_DEBUG = install-debug
265 STAMP_INSTALL_DEBUG =
269 # Build a debug variant.
270 # Take care to fix all possibly-relative paths.
271 debugdir = ${glibcxx_builddir}/src/debug
273 if test ! -d ${debugdir}; then \
274 mkdir -p ${debugdir}; \
275 for d in $(SUBDIRS); do mkdir -p ${debugdir}/$$d; done; \
277 sed -e 's/top_builddir = \.\./top_builddir = ..\/../' \
278 -e 's/top_build_prefix = \.\./top_build_prefix = ..\/../' \
279 -e 's/srcdir = \.\./srcdir = ..\/../' \
280 -e 's/VPATH = \.\./VPATH = ..\/../' \
281 -e 's/glibcxx_basedir = \.\./glibcxx_basedir = ..\/../' \
282 -e 's/MKDIR_P = \.\./MKDIR_P = ..\/../' \
283 < ../Makefile > Makefile ; \
284 for d in . $(SUBDIRS); do \
285 sed -e 's/top_builddir = \.\./top_builddir = ..\/../' \
286 -e 's/top_build_prefix = \.\./top_build_prefix = ..\/../' \
287 -e 's/srcdir = \.\./srcdir = ..\/../' \
288 -e 's/VPATH = \.\./VPATH = ..\/../' \
289 -e 's/glibcxx_basedir = \.\./glibcxx_basedir = ..\/../' \
290 -e 's/MKDIR_P = \.\./MKDIR_P = ..\/../' \
291 < ../$$d/Makefile > $$d/Makefile ; \
294 echo `date` > stamp-debug;
296 build-debug: stamp-debug
298 mv Makefile Makefile.tmp; \
299 sed -e 's,all-local: all-once,all-local:,' \
300 -e 's,install-data-local: install-data-once,install-data-local:,' \
301 -e '/vpath/!s,src/c,src/debug/c,' \
302 < Makefile.tmp > Makefile ; \
303 $(MAKE) CXXFLAGS='$(DEBUG_FLAGS)' \
304 toolexeclibdir=$(glibcxx_toolexeclibdir)/debug all) ;
306 # Install debug library.
307 install-debug: build-debug
308 (cd ${debugdir} && $(MAKE) CXXFLAGS='$(DEBUG_FLAGS)' \
309 toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install) ;