1## Makefile for the C++03 sources of the GNU C++ Standard library. 2## 3## Copyright (C) 1997-2019 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++98 runtime. 26noinst_LTLIBRARIES = libc++98convenience.la 27 28headers = 29 30if ENABLE_DUAL_ABI 31cow_string_host_sources = \ 32 collate_members_cow.cc \ 33 messages_members_cow.cc \ 34 monetary_members_cow.cc \ 35 numeric_members_cow.cc 36endif 37 38# Source files linked in via configuration/make substitution for a 39# particular host. 40host_sources = \ 41 $(cow_string_host_sources) \ 42 codecvt_members.cc \ 43 collate_members.cc \ 44 messages_members.cc \ 45 monetary_members.cc \ 46 numeric_members.cc \ 47 time_members.cc 48 49codecvt_members.cc: ${glibcxx_srcdir}/$(CCODECVT_CC) 50 $(LN_S) ${glibcxx_srcdir}/$(CCODECVT_CC) . || true 51 52collate_members.cc: ${glibcxx_srcdir}/$(CCOLLATE_CC) 53 $(LN_S) ${glibcxx_srcdir}/$(CCOLLATE_CC) . || true 54 55messages_members.cc: ${glibcxx_srcdir}/$(CMESSAGES_CC) 56 $(LN_S) ${glibcxx_srcdir}/$(CMESSAGES_CC) . || true 57 58monetary_members.cc: ${glibcxx_srcdir}/$(CMONEY_CC) 59 $(LN_S) ${glibcxx_srcdir}/$(CMONEY_CC) . || true 60 61numeric_members.cc: ${glibcxx_srcdir}/$(CNUMERIC_CC) 62 $(LN_S) ${glibcxx_srcdir}/$(CNUMERIC_CC) . || true 63 64time_members.cc: ${glibcxx_srcdir}/$(CTIME_CC) 65 $(LN_S) ${glibcxx_srcdir}/$(CTIME_CC) . || true 66 67if ENABLE_DUAL_ABI 68collate_members_cow.cc: ${glibcxx_srcdir}/$(CCOLLATE_CC) 69 $(LN_S) ${glibcxx_srcdir}/$(CCOLLATE_CC) ./$@ || true 70 71messages_members_cow.cc: ${glibcxx_srcdir}/$(CMESSAGES_CC) 72 $(LN_S) ${glibcxx_srcdir}/$(CMESSAGES_CC) ./$@ || true 73 74monetary_members_cow.cc: ${glibcxx_srcdir}/$(CMONEY_CC) 75 $(LN_S) ${glibcxx_srcdir}/$(CMONEY_CC) ./$@ || true 76 77numeric_members_cow.cc: ${glibcxx_srcdir}/$(CNUMERIC_CC) 78 $(LN_S) ${glibcxx_srcdir}/$(CNUMERIC_CC) ./$@ || true 79endif 80 81# Source files linked in via configuration/make substitution for a 82# particular host, but with ad hoc naming rules. 83host_sources_extra = \ 84 basic_file.cc c++locale.cc \ 85 ${inst_sources} ${parallel_sources} 86 87c++locale.cc: ${glibcxx_srcdir}/$(CLOCALE_CC) 88 $(LN_S) ${glibcxx_srcdir}/$(CLOCALE_CC) ./$@ || true 89 90basic_file.cc: ${glibcxx_srcdir}/$(BASIC_FILE_CC) 91 $(LN_S) ${glibcxx_srcdir}/$(BASIC_FILE_CC) ./$@ || true 92 93if ENABLE_DUAL_ABI 94cxx11_abi_sources = \ 95 cow-istream-string.cc 96else 97cxx11_abi_sources = 98endif 99 100if ENABLE_EXTERN_TEMPLATE 101# XTEMPLATE_FLAGS = -fno-implicit-templates 102inst_sources = \ 103 allocator-inst.cc \ 104 concept-inst.cc \ 105 ext-inst.cc \ 106 misc-inst.cc 107else 108# XTEMPLATE_FLAGS = 109inst_sources = 110endif 111 112parallel_sources = parallel_settings.cc 113 114# Sources present in the src directory, always present. 115sources = \ 116 bitmap_allocator.cc \ 117 pool_allocator.cc \ 118 mt_allocator.cc \ 119 codecvt.cc \ 120 complex_io.cc \ 121 globals_io.cc \ 122 hash_tr1.cc \ 123 hashtable_tr1.cc \ 124 ios_failure.cc \ 125 ios_init.cc \ 126 ios_locale.cc \ 127 list.cc \ 128 list-aux.cc \ 129 list-aux-2.cc \ 130 list_associated.cc \ 131 list_associated-2.cc \ 132 locale.cc \ 133 locale_init.cc \ 134 locale_facets.cc \ 135 localename.cc \ 136 math_stubs_float.cc \ 137 math_stubs_long_double.cc \ 138 stdexcept.cc \ 139 strstream.cc \ 140 tree.cc \ 141 istream.cc \ 142 istream-string.cc \ 143 streambuf.cc \ 144 valarray.cc \ 145 ${cxx11_abi_sources} \ 146 ${host_sources} \ 147 ${host_sources_extra} 148 149vpath % $(top_srcdir)/src/c++98 150 151libc__98convenience_la_SOURCES = $(sources) 152 153# Use special rules to compile with -fimplicit-templates. 154c++locale.lo: c++locale.cc 155 $(LTCXXCOMPILE) -fimplicit-templates -c $< 156c++locale.o: c++locale.cc 157 $(CXXCOMPILE) -fimplicit-templates -c $< 158 159if ENABLE_DUAL_ABI 160GLIBCXX_ABI_FLAGS = -D_GLIBCXX_USE_CXX11_ABI=@glibcxx_cxx98_abi@ 161# Use special rules to compile with the non-default string ABI. 162collate_members_cow.lo: collate_members_cow.cc 163 $(LTCXXCOMPILE) $(GLIBCXX_ABI_FLAGS) -fimplicit-templates -c $< 164collate_members_cow.o: collate_members_cow.cc 165 $(CXXCOMPILE) $(GLIBCXX_ABI_FLAGS) -fimplicit-templates -c $< 166messages_members_cow.lo: messages_members_cow.cc 167 $(LTCXXCOMPILE) $(GLIBCXX_ABI_FLAGS) -fimplicit-templates -c $< 168messages_members_cow.o: messages_members_cow.cc 169 $(CXXCOMPILE) $(GLIBCXX_ABI_FLAGS) -fimplicit-templates -c $< 170monetary_members_cow.lo: monetary_members_cow.cc 171 $(LTCXXCOMPILE) $(GLIBCXX_ABI_FLAGS) -fimplicit-templates -c $< 172monetary_members_cow.o: monetary_members_cow.cc 173 $(CXXCOMPILE) $(GLIBCXX_ABI_FLAGS) -fimplicit-templates -c $< 174numeric_members_cow.lo: numeric_members_cow.cc 175 $(LTCXXCOMPILE) $(GLIBCXX_ABI_FLAGS) -fimplicit-templates -c $< 176numeric_members_cow.o: numeric_members_cow.cc 177 $(CXXCOMPILE) $(GLIBCXX_ABI_FLAGS) -fimplicit-templates -c $< 178endif 179 180# XXX TODO move locale_init.cc and localename.cc to src/c++11 181locale_init.lo: locale_init.cc 182 $(LTCXXCOMPILE) -std=gnu++11 -fchar8_t -c $< 183locale_init.o: locale_init.cc 184 $(LTCXXCOMPILE) -std=gnu++11 -fchar8_t -c $< 185localename.lo: localename.cc 186 $(LTCXXCOMPILE) -std=gnu++11 -fchar8_t -c $< 187localename.o: localename.cc 188 $(LTCXXCOMPILE) -std=gnu++11 -fchar8_t -c $< 189 190# Use special rules for the deprecated source files so that they find 191# deprecated include files. 192GLIBCXX_INCLUDE_DIR=$(glibcxx_builddir)/include 193strstream.lo: strstream.cc 194 $(LTCXXCOMPILE) -I$(GLIBCXX_INCLUDE_DIR)/backward -Wno-deprecated -c $< 195strstream.o: strstream.cc 196 $(CXXCOMPILE) -I$(GLIBCXX_INCLUDE_DIR)/backward -Wno-deprecated -c $< 197 198# Use special rules for the concept-checking instantiations so that all 199# the generated template functions are also instantiated. Force the checks 200# to be on so that the instantiations are actually seen. 201concept-inst.lo: concept-inst.cc 202 $(LTCXXCOMPILE) -D_GLIBCXX_CONCEPT_CHECKS -fimplicit-templates -c $< 203concept-inst.o: concept-inst.cc 204 $(CXXCOMPILE) -D_GLIBCXX_CONCEPT_CHECKS -fimplicit-templates -c $< 205 206# Use special rules for parallel mode compilation. 207PARALLEL_FLAGS = -D_GLIBCXX_PARALLEL 208parallel_settings.lo: parallel_settings.cc 209 $(LTCXXCOMPILE) $(PARALLEL_FLAGS) -c $< 210parallel_settings.o: parallel_settings.cc 211 $(CXXCOMPILE) $(PARALLEL_FLAGS) -c $< 212 213# AM_CXXFLAGS needs to be in each subdirectory so that it can be 214# modified in a per-library or per-sub-library way. Need to manually 215# set this option because CONFIG_CXXFLAGS has to be after 216# OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden 217# as the occasion calls for it. 218AM_CXXFLAGS = \ 219 -std=gnu++98 \ 220 $(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \ 221 $(XTEMPLATE_FLAGS) $(VTV_CXXFLAGS) \ 222 $(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS) 223 224AM_MAKEFLAGS = \ 225 "gxx_include_dir=$(gxx_include_dir)" 226 227# Libtool notes 228 229# 1) In general, libtool expects an argument such as `--tag=CXX' when 230# using the C++ compiler, because that will enable the settings 231# detected when C++ support was being configured. However, when no 232# such flag is given in the command line, libtool attempts to figure 233# it out by matching the compiler name in each configuration section 234# against a prefix of the command line. The problem is that, if the 235# compiler name and its initial flags stored in the libtool 236# configuration file don't match those in the command line, libtool 237# can't decide which configuration to use, and it gives up. The 238# correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe 239# CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to 240# attempt to infer which configuration to use. 241# 242# The second tag argument, `--tag disable-shared` means that libtool 243# only compiles each source once, for static objects. In actuality, 244# glibcxx_lt_pic_flag and glibcxx_compiler_shared_flag are added to 245# the libtool command that is used create the object, which is 246# suitable for shared libraries. The `--tag disable-shared` must be 247# placed after --tag CXX lest things CXX undo the affect of 248# disable-shared. 249 250# 2) Need to explicitly set LTCXXCOMPILE so that EXTRA_CXX_FLAGS is 251# last. (That way, things like -O2 passed down from the toplevel can 252# be overridden by --enable-debug.) 253LTCXXCOMPILE = \ 254 $(LIBTOOL) --tag CXX --tag disable-shared \ 255 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ 256 --mode=compile $(CXX) $(TOPLEVEL_INCLUDES) \ 257 $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(EXTRA_CXX_FLAGS) 258 259LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) 260 261# 3) We'd have a problem when building the shared libstdc++ object if 262# the rules automake generates would be used. We cannot allow g++ to 263# be used since this would add -lstdc++ to the link line which of 264# course is problematic at this point. So, we get the top-level 265# directory to configure libstdc++-v3 to use gcc as the C++ 266# compilation driver. 267CXXLINK = \ 268 $(LIBTOOL) --tag CXX --tag disable-shared \ 269 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ 270 --mode=link $(CXX) \ 271 $(VTV_CXXLINKFLAGS) \ 272 $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@ 273