| 1 |
## Makefile for the C++23 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++23 runtime. |
| 26 |
noinst_LTLIBRARIES = libc++23convenience.la |
| 27 |
|
| 28 |
# Module std support. Not compiled for now, only installed. |
| 29 |
# Let's install the interface units in the bits subdirectory. |
| 30 |
toolexeclib_DATA = libstdc++.modules.json |
| 31 |
includebitsdir = $(gxx_include_dir)/bits |
| 32 |
includebits_DATA = std.cc std.compat.cc |
| 33 |
|
| 34 |
# The manifest to be installed uses the relative path between install dirs. |
| 35 |
libstdc++.modules.json: libstdc++.modules.json.in |
| 36 |
relpath=$$($(toplevel_srcdir)/contrib/relpath.sh \ |
| 37 |
$(toolexeclibdir) \ |
| 38 |
$(includebitsdir)) && \ |
| 39 |
sed "s,@MODPATH@,$$relpath," $< > $@ |
| 40 |
|
| 41 |
# The uninstalled manifest uses the relative path to builddir. |
| 42 |
stamp-module-manifest: libstdc++.modules.json.in |
| 43 |
@-mkdir -p ../.libs |
| 44 |
sed "s,@MODPATH@,../c++23," $< \ |
| 45 |
> ../.libs/libstdc++.modules.json |
| 46 |
@$(STAMP) $@ |
| 47 |
|
| 48 |
# Add the C library exports to both modules. |
| 49 |
std.cc: std.cc.in std-clib.cc.in |
| 50 |
cat $^ > $@ |
| 51 |
std.compat.cc: std.compat.cc.in std-clib.cc.in |
| 52 |
cat $^ > $@ |
| 53 |
|
| 54 |
# Also put the interface units in the build-includes bits directory. |
| 55 |
stamp-modules-bits: $(includebits_DATA) |
| 56 |
@-mkdir -p $(top_builddir)/include/bits |
| 57 |
-for f in $(includebits_DATA); do \ |
| 58 |
$(LN_S) $(abs_builddir)/$$f $(top_builddir)/include/bits; \ |
| 59 |
done 2>/dev/null |
| 60 |
@$(STAMP) $@ |
| 61 |
|
| 62 |
all-local: stamp-module-manifest stamp-modules-bits |
| 63 |
|
| 64 |
headers = |
| 65 |
|
| 66 |
if ENABLE_EXTERN_TEMPLATE |
| 67 |
# XTEMPLATE_FLAGS = -fno-implicit-templates |
| 68 |
inst_sources = |
| 69 |
else |
| 70 |
# XTEMPLATE_FLAGS = |
| 71 |
inst_sources = |
| 72 |
endif |
| 73 |
|
| 74 |
sources = stacktrace.cc print.cc |
| 75 |
|
| 76 |
vpath % $(top_srcdir)/src/c++23 |
| 77 |
|
| 78 |
|
| 79 |
if GLIBCXX_HOSTED |
| 80 |
libc__23convenience_la_SOURCES = $(sources) $(inst_sources) |
| 81 |
else |
| 82 |
libc__23convenience_la_SOURCES = |
| 83 |
endif |
| 84 |
|
| 85 |
# Use C++26 so that std::filebuf::native_handle() is available. |
| 86 |
print.lo: print.cc |
| 87 |
$(LTCXXCOMPILE) -std=gnu++26 -c $< |
| 88 |
print.o: print.cc |
| 89 |
$(CXXCOMPILE) -std=gnu++26 -c $< |
| 90 |
|
| 91 |
# AM_CXXFLAGS needs to be in each subdirectory so that it can be |
| 92 |
# modified in a per-library or per-sub-library way. Need to manually |
| 93 |
# set this option because CONFIG_CXXFLAGS has to be after |
| 94 |
# OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden |
| 95 |
# as the occasion calls for it. |
| 96 |
AM_CXXFLAGS = \ |
| 97 |
-std=gnu++23 \ |
| 98 |
$(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \ |
| 99 |
$(XTEMPLATE_FLAGS) $(VTV_CXXFLAGS) \ |
| 100 |
$(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS) \ |
| 101 |
-fimplicit-templates |
| 102 |
|
| 103 |
AM_MAKEFLAGS = \ |
| 104 |
"gxx_include_dir=$(gxx_include_dir)" |
| 105 |
|
| 106 |
# Libtool notes |
| 107 |
|
| 108 |
# 1) In general, libtool expects an argument such as `--tag=CXX' when |
| 109 |
# using the C++ compiler, because that will enable the settings |
| 110 |
# detected when C++ support was being configured. However, when no |
| 111 |
# such flag is given in the command line, libtool attempts to figure |
| 112 |
# it out by matching the compiler name in each configuration section |
| 113 |
# against a prefix of the command line. The problem is that, if the |
| 114 |
# compiler name and its initial flags stored in the libtool |
| 115 |
# configuration file don't match those in the command line, libtool |
| 116 |
# can't decide which configuration to use, and it gives up. The |
| 117 |
# correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe |
| 118 |
# CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to |
| 119 |
# attempt to infer which configuration to use. |
| 120 |
# |
| 121 |
# The second tag argument, `--tag disable-shared` means that libtool |
| 122 |
# only compiles each source once, for static objects. In actuality, |
| 123 |
# glibcxx_lt_pic_flag and glibcxx_compiler_shared_flag are added to |
| 124 |
# the libtool command that is used create the object, which is |
| 125 |
# suitable for shared libraries. The `--tag disable-shared` must be |
| 126 |
# placed after --tag CXX lest things CXX undo the affect of |
| 127 |
# disable-shared. |
| 128 |
|
| 129 |
# 2) Need to explicitly set LTCXXCOMPILE so that EXTRA_CXX_FLAGS is |
| 130 |
# last. (That way, things like -O2 passed down from the toplevel can |
| 131 |
# be overridden by --enable-debug.) |
| 132 |
LTCXXCOMPILE = \ |
| 133 |
$(LIBTOOL) --tag CXX --tag disable-shared \ |
| 134 |
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ |
| 135 |
--mode=compile $(CXX) $(TOPLEVEL_INCLUDES) \ |
| 136 |
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(EXTRA_CXX_FLAGS) |
| 137 |
|
| 138 |
LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) |
| 139 |
|
| 140 |
# 3) We'd have a problem when building the shared libstdc++ object if |
| 141 |
# the rules automake generates would be used. We cannot allow g++ to |
| 142 |
# be used since this would add -lstdc++ to the link line which of |
| 143 |
# course is problematic at this point. So, we get the top-level |
| 144 |
# directory to configure libstdc++-v3 to use gcc as the C++ |
| 145 |
# compilation driver. |
| 146 |
CXXLINK = \ |
| 147 |
$(LIBTOOL) --tag CXX --tag disable-shared \ |
| 148 |
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ |
| 149 |
--mode=link $(CXX) \ |
| 150 |
$(VTV_CXXLINKFLAGS) \ |
| 151 |
$(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@ |