1## Makefile for the C++03 sources of the GNU C++ Standard library.
2##
3## Copyright (C) 1997-2014 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
30sources = \
31	chrono.cc \
32	condition_variable.cc \
33	debug.cc \
34	functexcept.cc \
35	functional.cc \
36	future.cc \
37	hash_c++0x.cc \
38	hashtable_c++0x.cc \
39	limits.cc \
40	mutex.cc \
41	placeholders.cc \
42	random.cc \
43	regex.cc  \
44	shared_ptr.cc \
45	snprintf_lite.cc \
46	system_error.cc \
47	thread.cc
48
49if ENABLE_EXTERN_TEMPLATE
50# XTEMPLATE_FLAGS = -fno-implicit-templates
51inst_sources = \
52	fstream-inst.cc \
53	string-inst.cc \
54	wstring-inst.cc
55else
56# XTEMPLATE_FLAGS =
57inst_sources =
58endif
59
60vpath % $(top_srcdir)/src/c++11
61
62libc__11convenience_la_SOURCES = $(sources)  $(inst_sources)
63
64# Use special rules for the hashtable.cc file so that all
65# the generated template functions are also instantiated.
66hashtable_c++0x.lo: hashtable_c++0x.cc
67	$(LTCXXCOMPILE) -fimplicit-templates -c $<
68hashtable_c++0x.o: hashtable_c++0x.cc
69	$(CXXCOMPILE) -fimplicit-templates -c $<
70
71# AM_CXXFLAGS needs to be in each subdirectory so that it can be
72# modified in a per-library or per-sub-library way.  Need to manually
73# set this option because CONFIG_CXXFLAGS has to be after
74# OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
75# as the occasion calls for it.
76AM_CXXFLAGS = \
77	-std=gnu++11 \
78	$(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \
79	$(XTEMPLATE_FLAGS) $(VTV_CXXFLAGS) \
80	$(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS)
81
82AM_MAKEFLAGS = \
83	"gxx_include_dir=$(gxx_include_dir)"
84
85# Libtool notes
86
87# 1) In general, libtool expects an argument such as `--tag=CXX' when
88# using the C++ compiler, because that will enable the settings
89# detected when C++ support was being configured.  However, when no
90# such flag is given in the command line, libtool attempts to figure
91# it out by matching the compiler name in each configuration section
92# against a prefix of the command line.  The problem is that, if the
93# compiler name and its initial flags stored in the libtool
94# configuration file don't match those in the command line, libtool
95# can't decide which configuration to use, and it gives up.  The
96# correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe
97# CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to
98# attempt to infer which configuration to use.
99#
100# The second tag argument, `--tag disable-shared` means that libtool
101# only compiles each source once, for static objects. In actuality,
102# glibcxx_lt_pic_flag and glibcxx_compiler_shared_flag are added to
103# the libtool command that is used create the object, which is
104# suitable for shared libraries.  The `--tag disable-shared` must be
105# placed after --tag CXX lest things CXX undo the affect of
106# disable-shared.
107
108# 2) Need to explicitly set LTCXXCOMPILE so that EXTRA_CXX_FLAGS is
109# last. (That way, things like -O2 passed down from the toplevel can
110# be overridden by --enable-debug.)
111LTCXXCOMPILE = \
112	$(LIBTOOL) --tag CXX --tag disable-shared \
113	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
114	--mode=compile $(CXX) $(TOPLEVEL_INCLUDES) \
115	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(EXTRA_CXX_FLAGS)
116
117LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
118
119# 3) We'd have a problem when building the shared libstdc++ object if
120# the rules automake generates would be used.  We cannot allow g++ to
121# be used since this would add -lstdc++ to the link line which of
122# course is problematic at this point.  So, we get the top-level
123# directory to configure libstdc++-v3 to use gcc as the C++
124# compilation driver.
125CXXLINK = \
126	$(LIBTOOL) --tag CXX --tag disable-shared \
127	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
128	--mode=link $(CXX) \
129	$(VTV_CXXLINKFLAGS) \
130	$(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@
131