| 1 |
## Makefile for the GNU C++ Filesystem 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 |
# Separate libstdc++fs.a to be installed. |
| 26 |
toolexeclib_LTLIBRARIES = libstdc++fs.la |
| 27 |
# Duplicate lib that is to be part of libstdc++exp.a |
| 28 |
noinst_LTLIBRARIES = libstdc++fsconvenience.la |
| 29 |
|
| 30 |
headers = |
| 31 |
|
| 32 |
if ENABLE_DUAL_ABI |
| 33 |
cxx11_abi_sources = \ |
| 34 |
cow-dir.cc \ |
| 35 |
cow-ops.cc \ |
| 36 |
cow-path.cc |
| 37 |
else |
| 38 |
cxx11_abi_sources = |
| 39 |
endif |
| 40 |
|
| 41 |
sources = \ |
| 42 |
dir.cc \ |
| 43 |
ops.cc \ |
| 44 |
path.cc \ |
| 45 |
${cxx11_abi_sources} |
| 46 |
|
| 47 |
# vpath % $(top_srcdir)/src/filesystem |
| 48 |
|
| 49 |
libstdc__fs_la_SOURCES = $(sources) |
| 50 |
libstdc__fsconvenience_la_SOURCES = $(sources) |
| 51 |
|
| 52 |
# AM_CXXFLAGS needs to be in each subdirectory so that it can be |
| 53 |
# modified in a per-library or per-sub-library way. Need to manually |
| 54 |
# set this option because CONFIG_CXXFLAGS has to be after |
| 55 |
# OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden |
| 56 |
# as the occasion call for it. |
| 57 |
AM_CXXFLAGS = \ |
| 58 |
$(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \ |
| 59 |
-std=gnu++17 \ |
| 60 |
$(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS) |
| 61 |
|
| 62 |
AM_MAKEFLAGS = \ |
| 63 |
"gxx_include_dir=$(gxx_include_dir)" |
| 64 |
|
| 65 |
|
| 66 |
# Libtool notes |
| 67 |
|
| 68 |
# 1) In general, libtool expects an argument such as `--tag=CXX' when |
| 69 |
# using the C++ compiler, because that will enable the settings |
| 70 |
# detected when C++ support was being configured. However, when no |
| 71 |
# such flag is given in the command line, libtool attempts to figure |
| 72 |
# it out by matching the compiler name in each configuration section |
| 73 |
# against a prefix of the command line. The problem is that, if the |
| 74 |
# compiler name and its initial flags stored in the libtool |
| 75 |
# configuration file don't match those in the command line, libtool |
| 76 |
# can't decide which configuration to use, and it gives up. The |
| 77 |
# correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe |
| 78 |
# CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to |
| 79 |
# attempt to infer which configuration to use. |
| 80 |
# |
| 81 |
# The second tag argument, `--tag disable-shared` means that libtool |
| 82 |
# only compiles each source once, for static objects. In actuality, |
| 83 |
# glibcxx_lt_pic_flag and glibcxx_compiler_shared_flag are added to |
| 84 |
# the libtool command that is used create the object, which is |
| 85 |
# suitable for shared libraries. The `--tag disable-shared` must be |
| 86 |
# placed after --tag CXX lest things CXX undo the affect of |
| 87 |
# disable-shared. |
| 88 |
|
| 89 |
# 2) Need to explicitly set LTCXXCOMPILE so that EXTRA_CXX_FLAGS is |
| 90 |
# last. (That way, things like -O2 passed down from the toplevel can |
| 91 |
# be overridden by --enable-debug.) |
| 92 |
LTCXXCOMPILE = \ |
| 93 |
$(LIBTOOL) --tag CXX --tag disable-shared \ |
| 94 |
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ |
| 95 |
--mode=compile $(CXX) $(TOPLEVEL_INCLUDES) \ |
| 96 |
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(EXTRA_CXX_FLAGS) |
| 97 |
|
| 98 |
LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) |
| 99 |
|
| 100 |
# 3) We'd have a problem when building the shared libstdc++ object if |
| 101 |
# the rules automake generates would be used. We cannot allow g++ to |
| 102 |
# be used since this would add -lstdc++ to the link line which of |
| 103 |
# course is problematic at this point. So, we get the top-level |
| 104 |
# directory to configure libstdc++-v3 to use gcc as the C++ |
| 105 |
# compilation driver. |
| 106 |
CXXLINK = \ |
| 107 |
$(LIBTOOL) --tag CXX --tag disable-shared \ |
| 108 |
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ |
| 109 |
--mode=link $(CXX) \ |
| 110 |
$(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@ |
| 111 |
|
| 112 |
# By adding these files here, automake will remove them for 'make clean' |
| 113 |
CLEANFILES = stamp-* |
| 114 |
|