Debian Codegraph @

libstdc++-v3/src/c++20/Makefile.am

raw
1 ## Makefile for the C++20 sources of the GNU C++ Standard library.
2 ##
3 ## Copyright (C) 1997-2025 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
23 include $(top_srcdir)/fragment.am
24
25 # Convenience library for C++20 runtime.
26 noinst_LTLIBRARIES = libc++20convenience.la
27
28 headers =
29
30 if ENABLE_EXTERN_TEMPLATE
31 # XTEMPLATE_FLAGS = -fno-implicit-templates
32 inst_sources = \
33 sstream-inst.cc
34 else
35 # XTEMPLATE_FLAGS =
36 inst_sources =
37 endif
38
39 sources = tzdb.cc format.cc
40
41 vpath % $(top_srcdir)/src/c++20
42
43 if USE_STATIC_TZDATA
44 tzdata.zi.h: $(top_srcdir)/src/c++20/tzdata.zi
45 echo 'static const char tzdata_chars[] = R"__libstdcxx__(' > [email protected]
46 cat $^ >> [email protected]
47 echo ')__libstdcxx__";' >> [email protected]
48 mv [email protected] $@
49
50 tzdb.lo: tzdb.cc tzdata.zi.h
51 $(LTCXXCOMPILE) -I. -c $<
52 tzdb.o: tzdb.cc tzdata.zi.h
53 $(CXXCOMPILE) -I. -c $<
54 endif
55
56 # This needs access to std::text_encoding and to the internals of std::locale.
57 format.lo: format.cc
58 $(LTCXXCOMPILE) -std=gnu++26 -fno-access-control -c $<
59 format.o: format.cc
60 $(CXXCOMPILE) -std=gnu++26 -fno-access-control -c $<
61
62 if GLIBCXX_HOSTED
63 libc__20convenience_la_SOURCES = $(sources) $(inst_sources)
64 else
65 libc__20convenience_la_SOURCES =
66 endif
67
68 # AM_CXXFLAGS needs to be in each subdirectory so that it can be
69 # modified in a per-library or per-sub-library way. Need to manually
70 # set this option because CONFIG_CXXFLAGS has to be after
71 # OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
72 # as the occasion calls for it.
73 AM_CXXFLAGS = \
74 -std=gnu++20 \
75 $(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \
76 $(XTEMPLATE_FLAGS) $(VTV_CXXFLAGS) \
77 $(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS) \
78 -fimplicit-templates
79
80 AM_MAKEFLAGS = \
81 "gxx_include_dir=$(gxx_include_dir)"
82
83 # Libtool notes
84
85 # 1) In general, libtool expects an argument such as `--tag=CXX' when
86 # using the C++ compiler, because that will enable the settings
87 # detected when C++ support was being configured. However, when no
88 # such flag is given in the command line, libtool attempts to figure
89 # it out by matching the compiler name in each configuration section
90 # against a prefix of the command line. The problem is that, if the
91 # compiler name and its initial flags stored in the libtool
92 # configuration file don't match those in the command line, libtool
93 # can't decide which configuration to use, and it gives up. The
94 # correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe
95 # CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to
96 # attempt to infer which configuration to use.
97 #
98 # The second tag argument, `--tag disable-shared` means that libtool
99 # only compiles each source once, for static objects. In actuality,
100 # glibcxx_lt_pic_flag and glibcxx_compiler_shared_flag are added to
101 # the libtool command that is used create the object, which is
102 # suitable for shared libraries. The `--tag disable-shared` must be
103 # placed after --tag CXX lest things CXX undo the affect of
104 # disable-shared.
105
106 # 2) Need to explicitly set LTCXXCOMPILE so that EXTRA_CXX_FLAGS is
107 # last. (That way, things like -O2 passed down from the toplevel can
108 # be overridden by --enable-debug.)
109 LTCXXCOMPILE = \
110 $(LIBTOOL) --tag CXX --tag disable-shared \
111 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
112 --mode=compile $(CXX) $(TOPLEVEL_INCLUDES) \
113 $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(EXTRA_CXX_FLAGS)
114
115 LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
116
117 # 3) We'd have a problem when building the shared libstdc++ object if
118 # the rules automake generates would be used. We cannot allow g++ to
119 # be used since this would add -lstdc++ to the link line which of
120 # course is problematic at this point. So, we get the top-level
121 # directory to configure libstdc++-v3 to use gcc as the C++
122 # compilation driver.
123 CXXLINK = \
124 $(LIBTOOL) --tag CXX --tag disable-shared \
125 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
126 --mode=link $(CXX) \
127 $(VTV_CXXLINKFLAGS) \
128 $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@