1## Makefile for the C++11 sources of the GNU C++ Standard library.
2##
3## Copyright (C) 1997-2020 Free Software Foundation, Inc.
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
11## Free Software Foundation; either version 3, or (at your option)
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
20## with this library; see the file COPYING3.  If not see
21## <http://www.gnu.org/licenses/>.
22
23include $(top_srcdir)/fragment.am
24
25# Convenience library for C++11 runtime.
26noinst_LTLIBRARIES = libc++11convenience.la
27
28headers =
29
30# Source files linked in via configuration/make substitution for a
31# particular host.
32host_sources = \
33	ctype_configure_char.cc \
34	ctype_members.cc
35
36ctype_configure_char.cc: ${glibcxx_srcdir}/$(OS_INC_SRCDIR)/ctype_configure_char.cc
37	$(LN_S) ${glibcxx_srcdir}/$(OS_INC_SRCDIR)/ctype_configure_char.cc . || true
38
39ctype_members.cc: ${glibcxx_srcdir}/$(CCTYPE_CC)
40	$(LN_S) ${glibcxx_srcdir}/$(CCTYPE_CC) . || true
41
42if ENABLE_DUAL_ABI
43cxx11_abi_sources = \
44	cow-locale_init.cc \
45	cow-shim_facets.cc \
46	cxx11-hash_tr1.cc \
47	cxx11-ios_failure.cc \
48	cxx11-shim_facets.cc \
49	cxx11-stdexcept.cc
50else
51cxx11_abi_sources =
52endif
53
54sources = \
55	chrono.cc \
56	codecvt.cc \
57	condition_variable.cc \
58	cow-stdexcept.cc \
59	ctype.cc \
60	debug.cc \
61	functexcept.cc \
62	functional.cc \
63	futex.cc \
64	future.cc \
65	hash_c++0x.cc \
66	hashtable_c++0x.cc \
67	ios.cc \
68	limits.cc \
69	mutex.cc \
70	placeholders.cc \
71	random.cc \
72	regex.cc  \
73	shared_ptr.cc \
74	snprintf_lite.cc \
75	system_error.cc \
76	thread.cc \
77	${cxx11_abi_sources} \
78	${host_sources}
79
80if ENABLE_DUAL_ABI
81extra_string_inst_sources = \
82	cow-fstream-inst.cc \
83	cow-sstream-inst.cc \
84	cow-string-inst.cc \
85	cow-string-io-inst.cc \
86	cow-wstring-inst.cc \
87	cow-wstring-io-inst.cc \
88	cxx11-locale-inst.cc \
89	cxx11-wlocale-inst.cc \
90	sso_string.cc
91else
92extra_string_inst_sources =
93endif
94
95if ENABLE_EXTERN_TEMPLATE
96# XTEMPLATE_FLAGS = -fno-implicit-templates
97inst_sources = \
98	$(extra_string_inst_sources) \
99	ext11-inst.cc \
100	fstream-inst.cc \
101	ios-inst.cc \
102	iostream-inst.cc \
103	istream-inst.cc \
104	locale-inst.cc \
105	ostream-inst.cc \
106	sstream-inst.cc \
107	streambuf-inst.cc \
108	string-inst.cc \
109	string-io-inst.cc \
110	wlocale-inst.cc \
111	wstring-inst.cc \
112	wstring-io-inst.cc
113else
114# XTEMPLATE_FLAGS =
115inst_sources =
116endif
117
118vpath % $(top_srcdir)/src/c++11
119
120libc__11convenience_la_SOURCES = $(sources)  $(inst_sources)
121
122# Use special rules for the hashtable.cc file so that all
123# the generated template functions are also instantiated.
124hashtable_c++0x.lo: hashtable_c++0x.cc
125	$(LTCXXCOMPILE) -fimplicit-templates -c $<
126hashtable_c++0x.o: hashtable_c++0x.cc
127	$(CXXCOMPILE) -fimplicit-templates -c $<
128
129# Use special rules for source files that require -fchar8_t.
130codecvt.lo: codecvt.cc
131	$(LTCXXCOMPILE) -fchar8_t -c $<
132codecvt.o: codecvt.cc
133	$(CXXCOMPILE) -fchar8_t -c $<
134limits.lo: limits.cc
135	$(LTCXXCOMPILE) -fchar8_t -c $<
136limits.o: limits.cc
137	$(CXXCOMPILE) -fchar8_t -c $<
138
139if ENABLE_DUAL_ABI
140# Rewrite the type info for __ios_failure.
141rewrite_ios_failure_typeinfo = sed -e '/^_*_ZTISt13__ios_failure:/,/_ZTVN10__cxxabiv120__si_class_type_infoE/s/_ZTVN10__cxxabiv120__si_class_type_infoE/_ZTVSt19__iosfail_type_info/'
142
143cxx11-ios_failure-lt.s: cxx11-ios_failure.cc
144	$(LTCXXCOMPILE) -S $< -o tmp-cxx11-ios_failure-lt.s
145	-test -f tmp-cxx11-ios_failure-lt.o && mv -f tmp-cxx11-ios_failure-lt.o tmp-cxx11-ios_failure-lt.s
146	$(rewrite_ios_failure_typeinfo) tmp-$@ > $@
147	-rm -f tmp-$@
148cxx11-ios_failure.s: cxx11-ios_failure.cc
149	$(CXXCOMPILE) -S $< -o tmp-$@
150	$(rewrite_ios_failure_typeinfo) tmp-$@ > $@
151	-rm -f tmp-$@
152
153cxx11-ios_failure.lo: cxx11-ios_failure-lt.s
154	$(LTCXXCOMPILE) -g0 -c $< -o $@
155cxx11-ios_failure.o: cxx11-ios_failure.s
156	$(CXXCOMPILE) -g0 -c $<
157endif
158
159# AM_CXXFLAGS needs to be in each subdirectory so that it can be
160# modified in a per-library or per-sub-library way.  Need to manually
161# set this option because CONFIG_CXXFLAGS has to be after
162# OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
163# as the occasion calls for it.
164AM_CXXFLAGS = \
165	-std=gnu++11 \
166	$(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \
167	$(XTEMPLATE_FLAGS) $(VTV_CXXFLAGS) \
168	$(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS)
169
170AM_MAKEFLAGS = \
171	"gxx_include_dir=$(gxx_include_dir)"
172
173# Libtool notes
174
175# 1) In general, libtool expects an argument such as `--tag=CXX' when
176# using the C++ compiler, because that will enable the settings
177# detected when C++ support was being configured.  However, when no
178# such flag is given in the command line, libtool attempts to figure
179# it out by matching the compiler name in each configuration section
180# against a prefix of the command line.  The problem is that, if the
181# compiler name and its initial flags stored in the libtool
182# configuration file don't match those in the command line, libtool
183# can't decide which configuration to use, and it gives up.  The
184# correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe
185# CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to
186# attempt to infer which configuration to use.
187#
188# The second tag argument, `--tag disable-shared` means that libtool
189# only compiles each source once, for static objects. In actuality,
190# glibcxx_lt_pic_flag and glibcxx_compiler_shared_flag are added to
191# the libtool command that is used create the object, which is
192# suitable for shared libraries.  The `--tag disable-shared` must be
193# placed after --tag CXX lest things CXX undo the affect of
194# disable-shared.
195
196# 2) Need to explicitly set LTCXXCOMPILE so that EXTRA_CXX_FLAGS is
197# last. (That way, things like -O2 passed down from the toplevel can
198# be overridden by --enable-debug.)
199LTCXXCOMPILE = \
200	$(LIBTOOL) --tag CXX --tag disable-shared \
201	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
202	--mode=compile $(CXX) $(TOPLEVEL_INCLUDES) \
203	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(EXTRA_CXX_FLAGS)
204
205LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
206
207# 3) We'd have a problem when building the shared libstdc++ object if
208# the rules automake generates would be used.  We cannot allow g++ to
209# be used since this would add -lstdc++ to the link line which of
210# course is problematic at this point.  So, we get the top-level
211# directory to configure libstdc++-v3 to use gcc as the C++
212# compilation driver.
213CXXLINK = \
214	$(LIBTOOL) --tag CXX --tag disable-shared \
215	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
216	--mode=link $(CXX) \
217	$(VTV_CXXLINKFLAGS) \
218	$(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@
219