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
35 libstdc___la_SOURCES =
37 libstdc___la_LIBADD = \
39 $(top_builddir)/libsupc++/libsupc++convenience.la \
40 $(top_builddir)/src/c++98/libc++98convenience.la \
41 $(top_builddir)/src/c++11/libc++11convenience.la
43 libstdc___la_DEPENDENCIES = \
45 $(top_builddir)/libsupc++/libsupc++convenience.la \
46 $(top_builddir)/src/c++98/libc++98convenience.la \
47 $(top_builddir)/src/c++11/libc++11convenience.la
49 libstdc___la_LDFLAGS = \
50 -version-info $(libtool_VERSION) ${version_arg} -lm
52 libstdc___la_LINK = $(CXXLINK) $(libstdc___la_LDFLAGS)
55 # AM_CXXFLAGS needs to be in each subdirectory so that it can be
56 # modified in a per-library or per-sub-library way. Need to manually
57 # set this option because CONFIG_CXXFLAGS has to be after
58 # OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
59 # as the occasion calls for it.
63 $(OPTIMIZE_CXXFLAGS) \
67 # libstdc++ libtool notes
69 # 1) Need to explicitly set LTCXXCOMPILE so that AM_CXXFLAGS is
70 # last. (That way, things like -O2 passed down from the toplevel can
71 # be overridden by --enable-debug.)
73 # 2) In general, libtool expects an argument such as `--tag=CXX' when
74 # using the C++ compiler, because that will enable the settings
75 # detected when C++ support was being configured. However, when no
76 # such flag is given in the command line, libtool attempts to figure
77 # it out by matching the compiler name in each configuration section
78 # against a prefix of the command line. The problem is that, if the
79 # compiler name and its initial flags stored in the libtool
80 # configuration file don't match those in the command line, libtool
81 # can't decide which configuration to use, and it gives up. The
82 # correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe
83 # CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to
84 # attempt to infer which configuration to use
85 LTCXXCOMPILE = $(LIBTOOL) --tag CXX \
86 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile \
87 $(CXX) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
88 $(AM_CXXFLAGS) $(CXXFLAGS)
90 LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
92 # 3) We'd have a problem when building the shared libstdc++ object if
93 # the rules automake generates would be used. We cannot allow g++ to
94 # be used since this would add -lstdc++ to the link line which of
95 # course is problematic at this point. So, we get the top-level
96 # directory to configure libstdc++-v3 to use gcc as the C++
98 CXXLINK = $(LIBTOOL) --tag CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
99 $(CXX) $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@
101 # Symbol versioning for shared libraries.
103 libstdc++-symbols.ver: ${glibcxx_srcdir}/$(SYMVER_FILE) \
104 $(port_specific_symbol_files)
105 cp ${glibcxx_srcdir}/$(SYMVER_FILE) $@.tmp
107 if test "x$(port_specific_symbol_files)" != x; then \
108 if grep '^# Appended to version file.' \
109 $(port_specific_symbol_files) /dev/null > /dev/null 2>&1; then \
110 cat $(port_specific_symbol_files) >> $@.tmp; \
112 sed -n '1,/DO NOT DELETE/p' $@.tmp > tmp.top; \
113 sed -n '/DO NOT DELETE/,$$p' $@.tmp > tmp.bottom; \
114 cat tmp.top $(port_specific_symbol_files) tmp.bottom > $@.tmp; \
115 rm tmp.top tmp.bottom; \
118 $(EGREP) -v '#(#| |$$)' $@.tmp | \
119 $(COMPILE) -E -P -include config.h - > $@ || (rm -f $@ ; exit 1)
122 CLEANFILES = libstdc++-symbols.ver
124 if ENABLE_SYMVERS_GNU
125 version_arg = -Wl,--version-script=libstdc++-symbols.ver
126 version_dep = libstdc++-symbols.ver
128 if ENABLE_SYMVERS_GNU_NAMESPACE
129 version_arg = -Wl,--version-script=libstdc++-symbols.ver
130 version_dep = libstdc++-symbols.ver
132 if ENABLE_SYMVERS_SUN
133 version_arg = -Wl,-M,libstdc++-symbols.ver-sun
134 version_dep = libstdc++-symbols.ver-sun
135 libstdc++-symbols.ver-sun : libstdc++-symbols.ver \
136 $(toplevel_srcdir)/contrib/make_sunver.pl \
137 $(libstdc___la_OBJECTS) $(libstdc___la_LIBADD)
138 CXXFILT="$(CXXFILT)"; export CXXFILT; \
139 perl $(toplevel_srcdir)/contrib/make_sunver.pl \
140 libstdc++-symbols.ver \
141 $(libstdc___la_OBJECTS:%.lo=.libs/%.o) \
142 `echo $(libstdc___la_LIBADD) | \
143 sed 's,/\([^/.]*\)\.la,/.libs/\1.a,g'` \
144 > $@ || (rm -f $@ ; exit 1)
146 if ENABLE_SYMVERS_DARWIN
147 version_arg = -Wl,-exported_symbols_list,libstdc++-symbols.explist
148 version_dep = libstdc++-symbols.explist
149 libstdc++-symbols.explist : libstdc++-symbols.ver \
150 ${glibcxx_srcdir}/scripts/make_exports.pl \
151 $(libstdc___la_OBJECTS) $(libstdc___la_LIBADD)
152 perl ${glibcxx_srcdir}/scripts/make_exports.pl \
153 libstdc++-symbols.ver \
154 $(libstdc___la_OBJECTS:%.lo=.libs/%.o) \
155 `echo $(libstdc___la_LIBADD) | \
156 sed 's,/\([^/.]*\)\.la,/.libs/\1.a,g'` \
157 > $@ || (rm -f $@ ; exit 1)
160 CLEANFILES += $(version_dep)
167 # Control additional build primary rules.
168 # EXTRA_LTLIBRARIES =
169 all-once: libstdc++convenience.la $(STAMP_DEBUG)
170 install-data-once: $(STAMP_INSTALL_DEBUG)
173 install-data-local: install-data-once
175 rm -rf libstdc++convenience.la stamp* $(CLEAN_DEBUG)
177 # Make a non-installed convenience library, so that --disable-static
179 libstdc++convenience.la: $(toolexeclib_LTLIBRARIES)
180 $(CXXLINK) $(libstdc___la_LIBADD) $(LIBS); \
181 if test ! -f .libs/libstdc++.a; then \
182 cp .libs/libstdc++convenience.a .libs/libstdc++.a; \
184 echo `date` > stamp-libstdc++convenience;
188 # 2 supra-convenience library
189 if GLIBCXX_BUILD_DEBUG
190 STAMP_DEBUG = build-debug
191 STAMP_INSTALL_DEBUG = install-debug
195 STAMP_INSTALL_DEBUG =
199 # Build a debug variant.
200 # Take care to fix all possibly-relative paths.
201 debugdir = ${glibcxx_builddir}/src/debug
203 if test ! -d ${debugdir}; then \
204 mkdir -p ${debugdir}; \
205 for d in $(SUBDIRS); do mkdir -p ${debugdir}/$$d; done; \
207 sed -e 's/top_builddir = \.\./top_builddir = ..\/../' \
208 -e 's/top_build_prefix = \.\./top_build_prefix = ..\/../' \
209 -e 's/srcdir = \.\./srcdir = ..\/../' \
210 -e 's/VPATH = \.\./VPATH = ..\/../' \
211 -e 's/glibcxx_basedir = \.\./glibcxx_basedir = ..\/../' \
212 -e 's/MKDIR_P = \.\./MKDIR_P = ..\/../' \
213 < ../Makefile > Makefile ; \
214 for d in . $(SUBDIRS); do \
215 sed -e 's/top_builddir = \.\./top_builddir = ..\/../' \
216 -e 's/top_build_prefix = \.\./top_build_prefix = ..\/../' \
217 -e 's/srcdir = \.\./srcdir = ..\/../' \
218 -e 's/VPATH = \.\./VPATH = ..\/../' \
219 -e 's/glibcxx_basedir = \.\./glibcxx_basedir = ..\/../' \
220 -e 's/MKDIR_P = \.\./MKDIR_P = ..\/../' \
221 < ../$$d/Makefile > $$d/Makefile ; \
224 echo `date` > stamp-debug;
226 build-debug: stamp-debug
228 mv Makefile Makefile.tmp; \
229 sed -e 's,all-local: all-once,all-local:,' \
230 -e 's,install-data-local: install-data-once,install-data-local:,' \
231 -e 's,src/c,src/debug/c,' \
232 < Makefile.tmp > Makefile ; \
233 $(MAKE) CXXFLAGS='$(DEBUG_FLAGS)' \
234 toolexeclibdir=$(glibcxx_toolexeclibdir)/debug all) ;
236 # Install debug library.
237 install-debug: build-debug
238 (cd ${debugdir} && $(MAKE) CXXFLAGS='$(DEBUG_FLAGS)' \
239 toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install) ;