| 1 |
## Makefile for experimental additions to the GNU C++ Standard library. |
| 2 |
## |
| 3 |
## Copyright (C) 2014-2025 Free Software Foundation, Inc. |
| 4 |
## |
| 5 |
## Process this file with automake to produce Makefile.in. |
| 6 |
## |
| 7 |
## This file is part of GCC. |
| 8 |
## |
| 9 |
## GCC is free software; you can redistribute it and/or modify |
| 10 |
## it under the terms of the GNU General Public License as published by |
| 11 |
## the Free Software Foundation; either version 3, or (at your option) |
| 12 |
## any later version. |
| 13 |
## |
| 14 |
## GCC 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 |
| 20 |
## along with GCC; see the file COPYING3. If not see |
| 21 |
## <http://www.gnu.org/licenses/>. |
| 22 |
|
| 23 |
include $(top_srcdir)/fragment.am |
| 24 |
|
| 25 |
toolexeclib_LTLIBRARIES = libstdc++exp.la |
| 26 |
|
| 27 |
if ENABLE_FILESYSTEM_TS |
| 28 |
filesystem_lib = $(top_builddir)/src/filesystem/libstdc++fsconvenience.la |
| 29 |
else |
| 30 |
filesystem_lib = |
| 31 |
endif |
| 32 |
|
| 33 |
if ENABLE_BACKTRACE |
| 34 |
backtrace_lib = $(top_builddir)/src/libbacktrace/libstdc++_libbacktrace.la |
| 35 |
else |
| 36 |
backtrace_lib = |
| 37 |
endif |
| 38 |
|
| 39 |
headers = |
| 40 |
|
| 41 |
sources = \ |
| 42 |
contract.cc |
| 43 |
|
| 44 |
# vpath % $(top_srcdir)/src/experimental |
| 45 |
|
| 46 |
libstdc__exp_la_SOURCES = $(sources) |
| 47 |
|
| 48 |
libstdc__exp_la_LIBADD = \ |
| 49 |
$(top_builddir)/src/c++23/libc++23convenience.la \ |
| 50 |
$(top_builddir)/src/c++26/libc++26convenience.la \ |
| 51 |
$(filesystem_lib) $(backtrace_lib) |
| 52 |
|
| 53 |
libstdc__exp_la_DEPENDENCIES = \ |
| 54 |
$(top_builddir)/src/c++23/libc++23convenience.la \ |
| 55 |
$(top_builddir)/src/c++26/libc++26convenience.la \ |
| 56 |
$(filesystem_lib) $(backtrace_lib) |
| 57 |
|
| 58 |
# AM_CXXFLAGS needs to be in each subdirectory so that it can be |
| 59 |
# modified in a per-library or per-sub-library way. Need to manually |
| 60 |
# set this option because CONFIG_CXXFLAGS has to be after |
| 61 |
# OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden |
| 62 |
# as the occasion calls for it. |
| 63 |
AM_CXXFLAGS = \ |
| 64 |
-std=gnu++17 -nostdinc++ \ |
| 65 |
$(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \ |
| 66 |
$(XTEMPLATE_FLAGS) $(VTV_CXXFLAGS) \ |
| 67 |
$(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS) \ |
| 68 |
-fimplicit-templates |
| 69 |
|
| 70 |
AM_MAKEFLAGS = \ |
| 71 |
"gxx_include_dir=$(gxx_include_dir)" |
| 72 |
|
| 73 |
# Libtool notes |
| 74 |
|
| 75 |
# 1) In general, libtool expects an argument such as `--tag=CXX' when |
| 76 |
# using the C++ compiler, because that will enable the settings |
| 77 |
# detected when C++ support was being configured. However, when no |
| 78 |
# such flag is given in the command line, libtool attempts to figure |
| 79 |
# it out by matching the compiler name in each configuration section |
| 80 |
# against a prefix of the command line. The problem is that, if the |
| 81 |
# compiler name and its initial flags stored in the libtool |
| 82 |
# configuration file don't match those in the command line, libtool |
| 83 |
# can't decide which configuration to use, and it gives up. The |
| 84 |
# correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe |
| 85 |
# CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to |
| 86 |
# attempt to infer which configuration to use. |
| 87 |
# |
| 88 |
# The second tag argument, `--tag disable-shared` means that libtool |
| 89 |
# only compiles each source once, for static objects. In actuality, |
| 90 |
# glibcxx_lt_pic_flag and glibcxx_compiler_shared_flag are added to |
| 91 |
# the libtool command that is used create the object, which is |
| 92 |
# suitable for shared libraries. The `--tag disable-shared` must be |
| 93 |
# placed after --tag CXX lest things CXX undo the affect of |
| 94 |
# disable-shared. |
| 95 |
|
| 96 |
# 2) Need to explicitly set LTCXXCOMPILE so that EXTRA_CXX_FLAGS is |
| 97 |
# last. (That way, things like -O2 passed down from the toplevel can |
| 98 |
# be overridden by --enable-debug.) |
| 99 |
LTCXXCOMPILE = \ |
| 100 |
$(LIBTOOL) --tag CXX --tag disable-shared \ |
| 101 |
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ |
| 102 |
--mode=compile $(CXX) $(TOPLEVEL_INCLUDES) \ |
| 103 |
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(EXTRA_CXX_FLAGS) |
| 104 |
|
| 105 |
LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) |
| 106 |
|
| 107 |
# 3) We'd have a problem when building the shared libstdc++ object if |
| 108 |
# the rules automake generates would be used. We cannot allow g++ to |
| 109 |
# be used since this would add -lstdc++ to the link line which of |
| 110 |
# course is problematic at this point. So, we get the top-level |
| 111 |
# directory to configure libstdc++-v3 to use gcc as the C++ |
| 112 |
# compilation driver. |
| 113 |
CXXLINK = \ |
| 114 |
$(LIBTOOL) --tag CXX --tag disable-shared \ |
| 115 |
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ |
| 116 |
--mode=link $(CXX) \ |
| 117 |
$(VTV_CXXLINKFLAGS) \ |
| 118 |
$(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@ |