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