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