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
76 libstdc___la_LDFLAGS = \
77 -version-info $(libtool_VERSION) ${version_arg} -lm
79 libstdc___la_LINK = $(CXXLINK) $(libstdc___la_LDFLAGS)
82 # Use special rules for parallel mode compilation.
83 PARALLEL_FLAGS = -fopenmp -D_GLIBCXX_PARALLEL -I$(glibcxx_builddir)/../libgomp
84 compatibility-parallel_list.lo: compatibility-parallel_list.cc
86 compatibility-parallel_list.o: compatibility-parallel_list.cc
89 compatibility-parallel_list-2.lo: compatibility-parallel_list-2.cc
91 compatibility-parallel_list-2.o: compatibility-parallel_list-2.cc
94 # Use special rules for compatibility-ldbl.cc compilation, as we need to
95 # pass -mlong-double-64.
96 if GLIBCXX_LDBL_COMPAT
97 compatibility-ldbl.lo: compatibility-ldbl.cc
98 $(LTCXXCOMPILE) -mlong-double-64 -c $<
99 compatibility-ldbl.o: compatibility-ldbl.cc
100 $(CXXCOMPILE) -mlong-double-64 -c $<
103 # Use special rules for C++11 files/objects.
104 compatibility-c++0x.lo: compatibility-c++0x.cc
105 $(LTCXXCOMPILE) -std=gnu++11 -c $<
106 compatibility-c++0x.o: compatibility-c++0x.cc
107 $(CXXCOMPILE) -std=gnu++11 -c $<
109 compatibility-atomic-c++0x.lo: compatibility-atomic-c++0x.cc
110 $(LTCXXCOMPILE) -std=gnu++11 -c $<
111 compatibility-atomic-c++0x.o: compatibility-atomic-c++0x.cc
112 $(CXXCOMPILE) -std=gnu++11 -c $<
114 compatibility-thread-c++0x.lo: compatibility-thread-c++0x.cc
115 $(LTCXXCOMPILE) -std=gnu++11 -c $<
116 compatibility-thread-c++0x.o: compatibility-thread-c++0x.cc
117 $(CXXCOMPILE) -std=gnu++11 -c $<
119 # AM_CXXFLAGS needs to be in each subdirectory so that it can be
120 # modified in a per-library or per-sub-library way. Need to manually
121 # set this option because CONFIG_CXXFLAGS has to be after
122 # OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
123 # as the occasion calls for it.
126 $(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS)
130 # 1) Need to explicitly set LTCXXCOMPILE so that AM_CXXFLAGS is
131 # last. (That way, things like -O2 passed down from the toplevel can
132 # be overridden by --enable-debug.)
134 # 2) In general, libtool expects an argument such as `--tag=CXX' when
135 # using the C++ compiler, because that will enable the settings
136 # detected when C++ support was being configured. However, when no
137 # such flag is given in the command line, libtool attempts to figure
138 # it out by matching the compiler name in each configuration section
139 # against a prefix of the command line. The problem is that, if the
140 # compiler name and its initial flags stored in the libtool
141 # configuration file don't match those in the command line, libtool
142 # can't decide which configuration to use, and it gives up. The
143 # correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe
144 # CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to
145 # attempt to infer which configuration to use
147 $(LIBTOOL) --tag CXX \
148 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
149 --mode=compile $(CXX) $(INCLUDES) \
150 $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
152 LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
154 # 3) We'd have a problem when building the shared libstdc++ object if
155 # the rules automake generates would be used. We cannot allow g++ to
156 # be used since this would add -lstdc++ to the link line which of
157 # course is problematic at this point. So, we get the top-level
158 # directory to configure libstdc++-v3 to use gcc as the C++
159 # compilation driver.
161 $(LIBTOOL) --tag CXX \
162 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
164 $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@
167 # Symbol versioning for shared libraries.
169 libstdc++-symbols.ver: ${glibcxx_srcdir}/$(SYMVER_FILE) \
170 $(port_specific_symbol_files)
171 cp ${glibcxx_srcdir}/$(SYMVER_FILE) $@.tmp
173 if test "x$(port_specific_symbol_files)" != x; then \
174 if grep '^# Appended to version file.' \
175 $(port_specific_symbol_files) /dev/null > /dev/null 2>&1; then \
176 cat $(port_specific_symbol_files) >> $@.tmp; \
178 sed -n '1,/DO NOT DELETE/p' $@.tmp > tmp.top; \
179 sed -n '/DO NOT DELETE/,$$p' $@.tmp > tmp.bottom; \
180 cat tmp.top $(port_specific_symbol_files) tmp.bottom > $@.tmp; \
181 rm tmp.top tmp.bottom; \
184 $(EGREP) -v '^[ ]*#(#| |$$)' $@.tmp | \
185 $(CC) -E -P -include ../config.h - > $@ || (rm -f $@ ; exit 1)
188 CLEANFILES = libstdc++-symbols.ver
190 if ENABLE_SYMVERS_GNU
191 version_arg = -Wl,--version-script=libstdc++-symbols.ver
192 version_dep = libstdc++-symbols.ver
194 if ENABLE_SYMVERS_GNU_NAMESPACE
195 version_arg = -Wl,--version-script=libstdc++-symbols.ver
196 version_dep = libstdc++-symbols.ver
198 if ENABLE_SYMVERS_SUN
199 version_arg = -Wl,-M,libstdc++-symbols.ver-sun
200 version_dep = libstdc++-symbols.ver-sun
201 libstdc++-symbols.ver-sun : libstdc++-symbols.ver \
202 $(toplevel_srcdir)/contrib/make_sunver.pl \
203 $(libstdc___la_OBJECTS) $(libstdc___la_LIBADD)
204 CXXFILT="$(CXXFILT)"; export CXXFILT; \
205 perl $(toplevel_srcdir)/contrib/make_sunver.pl \
206 libstdc++-symbols.ver \
207 $(libstdc___la_OBJECTS:%.lo=.libs/%.o) \
208 `echo $(libstdc___la_LIBADD) | \
209 sed 's,/\([^/.]*\)\.la,/.libs/\1.a,g'` \
210 > $@ || (rm -f $@ ; exit 1)
212 if ENABLE_SYMVERS_DARWIN
213 version_arg = -Wl,-exported_symbols_list,libstdc++-symbols.explist
214 version_dep = libstdc++-symbols.explist
215 libstdc++-symbols.explist : libstdc++-symbols.ver \
216 ${glibcxx_srcdir}/scripts/make_exports.pl \
217 $(libstdc___la_OBJECTS) $(libstdc___la_LIBADD)
218 perl ${glibcxx_srcdir}/scripts/make_exports.pl \
219 libstdc++-symbols.ver \
220 $(libstdc___la_OBJECTS:%.lo=.libs/%.o) \
221 `echo $(libstdc___la_LIBADD) | \
222 sed 's,/\([^/.]*\)\.la,/.libs/\1.a,g'` \
223 > $@ || (rm -f $@ ; exit 1)
226 CLEANFILES += $(version_dep)
233 # Control additional build primary rules.
234 all-once: libstdc++convenience.la $(STAMP_DEBUG)
235 install-data-once: $(STAMP_INSTALL_DEBUG)
238 install-data-local: install-data-once
240 rm -rf libstdc++convenience.la stamp* $(CLEAN_DEBUG)
242 # Make a non-installed convenience library, so that --disable-static
244 libstdc++convenience.la: $(toolexeclib_LTLIBRARIES)
245 $(CXXLINK) $(libstdc___la_LIBADD) $(LIBS); \
246 if test ! -f .libs/libstdc++.a; then \
247 cp .libs/libstdc++convenience.a .libs/libstdc++.a; \
249 echo `date` > stamp-libstdc++convenience;
253 # 2 supra-convenience library
254 if GLIBCXX_BUILD_DEBUG
255 STAMP_DEBUG = build-debug
256 STAMP_INSTALL_DEBUG = install-debug
260 STAMP_INSTALL_DEBUG =
264 # Build a debug variant.
265 # Take care to fix all possibly-relative paths.
266 debugdir = ${glibcxx_builddir}/src/debug
268 if test ! -d ${debugdir}; then \
269 mkdir -p ${debugdir}; \
270 for d in $(SUBDIRS); do mkdir -p ${debugdir}/$$d; done; \
272 sed -e 's/top_builddir = \.\./top_builddir = ..\/../' \
273 -e 's/top_build_prefix = \.\./top_build_prefix = ..\/../' \
274 -e 's/srcdir = \.\./srcdir = ..\/../' \
275 -e 's/VPATH = \.\./VPATH = ..\/../' \
276 -e 's/glibcxx_basedir = \.\./glibcxx_basedir = ..\/../' \
277 -e 's/MKDIR_P = \.\./MKDIR_P = ..\/../' \
278 < ../Makefile > Makefile ; \
279 for d in . $(SUBDIRS); do \
280 sed -e 's/top_builddir = \.\./top_builddir = ..\/../' \
281 -e 's/top_build_prefix = \.\./top_build_prefix = ..\/../' \
282 -e 's/srcdir = \.\./srcdir = ..\/../' \
283 -e 's/VPATH = \.\./VPATH = ..\/../' \
284 -e 's/glibcxx_basedir = \.\./glibcxx_basedir = ..\/../' \
285 -e 's/MKDIR_P = \.\./MKDIR_P = ..\/../' \
286 < ../$$d/Makefile > $$d/Makefile ; \
289 echo `date` > stamp-debug;
291 build-debug: stamp-debug
293 mv Makefile Makefile.tmp; \
294 sed -e 's,all-local: all-once,all-local:,' \
295 -e 's,install-data-local: install-data-once,install-data-local:,' \
296 -e '/vpath/!s,src/c,src/debug/c,' \
297 < Makefile.tmp > Makefile ; \
298 rm -f Makefile.tmp ; \
299 $(MAKE) CXXFLAGS='$(DEBUG_FLAGS)' \
300 toolexeclibdir=$(glibcxx_toolexeclibdir)/debug all) ;
302 # Install debug library.
303 install-debug: build-debug
304 (cd ${debugdir} && $(MAKE) CXXFLAGS='$(DEBUG_FLAGS)' \
305 toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install) ;