| |
| ############################################################################ |
| # libs/libxx/libstdc++/libsupc++.defs |
| # |
| # SPDX-License-Identifier: Apache-2.0 |
| # |
| # Licensed to the Apache Software Foundation (ASF) under one or more |
| # contributor license agreements. See the NOTICE file distributed with |
| # this work for additional information regarding copyright ownership. The |
| # ASF licenses this file to you under the Apache License, Version 2.0 (the |
| # "License"); you may not use this file except in compliance with the |
| # License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| # License for the specific language governing permissions and limitations |
| # under the License. |
| # |
| ########################################################################### |
| |
| LIBSTDCXX_VERSION=$(patsubst "%",%,$(CONFIG_LIBSTDCXX_VERSION)) |
| |
| # Download and unpack tarball if no git repo found |
| ifeq ($(wildcard libstdc++/libstdc++/.git),) |
| libstdc++-v3.tar.gz: |
| $(call DOWNLOAD,https://gnu.googlesource.com/gcc/+archive/refs/tags/releases/gcc-$(LIBSTDCXX_VERSION),libstdc++-v3.tar.gz) |
| |
| libstdc++/libstdc++: libstdc++-v3.tar.gz |
| $(Q) mkdir -p $@ |
| $(Q) tar -xzf $< -C $@ |
| endif |
| |
| C++DIR = $(TOPDIR)/include/c++ |
| BITSDIR = $(TOPDIR)/include/c++/bits |
| CONDIR = libstdc++/libstdc++/config |
| INCDIR = libstdc++/libstdc++/include |
| SUPDIR = libstdc++/libstdc++/libsupc++ |
| |
| ifeq ($(CONFIG_ARCH_ARM),y) |
| CPU_CONFIG = arm |
| else |
| CPU_CONFIG = generic |
| endif |
| |
| $(BITSDIR): libstdc++/libstdc++ |
| $(Q) mkdir -p $(BITSDIR) |
| |
| copy_headers: $(BITSDIR) |
| $(Q) cp libstdc++/c++config.h $(INCDIR)/bits |
| $(Q) cp $(SUPDIR)/compare $(C++DIR) |
| $(Q) cp $(SUPDIR)/exception $(C++DIR) |
| $(Q) cp $(SUPDIR)/initializer_list $(C++DIR) |
| $(Q) cp $(SUPDIR)/new $(C++DIR) |
| $(Q) cp $(SUPDIR)/typeinfo $(C++DIR) |
| $(Q) cp $(TOPDIR)/libs/libbuiltin/libgcc/libgcc/gthr.h $(C++DIR) |
| $(Q) cp $(TOPDIR)/libs/libbuiltin/libgcc/libgcc/gthr-posix.h $(C++DIR)/gthr-default.h |
| $(Q) cp $(TOPDIR)/libs/libbuiltin/libgcc/libgcc/unwind-pe.h libstdc++ |
| $(Q) cp $(SUPDIR)/atomic_lockfree_defines.h $(BITSDIR) |
| $(Q) cp $(SUPDIR)/cxxabi_forced.h $(BITSDIR) |
| $(Q) cp $(SUPDIR)/exception_defines.h $(BITSDIR) |
| $(Q) cp $(SUPDIR)/exception_ptr.h $(BITSDIR) |
| $(Q) cp $(SUPDIR)/hash_bytes.h $(BITSDIR) |
| $(Q) cp $(SUPDIR)/nested_exception.h $(BITSDIR) |
| $(Q) cp $(SUPDIR)/exception.h $(BITSDIR) |
| $(Q) cp $(SUPDIR)/cxxabi_init_exception.h $(BITSDIR) |
| $(Q) cp $(CONDIR)/cpu/generic/cpu_defines.h $(BITSDIR) |
| $(Q) cp $(CONDIR)/cpu/$(CPU_CONFIG)/cxxabi_tweaks.h $(BITSDIR) |
| $(Q) cp $(CONDIR)/cpu/generic/atomic_word.h $(BITSDIR) |
| $(Q) cp $(CONDIR)/os/generic/os_defines.h $(BITSDIR) |
| |
| context:: copy_headers |
| |
| distclean:: |
| $(call DELDIR, $(BITSDIR)) |
| $(call DELFILE, $(INCDIR)/bits/c++config.h) |
| ifeq ($(wildcard libstdc++/libstdc++/.git),) |
| $(call DELDIR, libstdc++) |
| $(call DELFILE, libstdc++.tar.gz) |
| endif |
| |
| SUPCXXFLAGS += -I$(INCDIR) -I$(SUPDIR) -I$(TOPDIR)/libs/libxx/libstdc++ |
| |
| CXXFLAGS += -Wno-undef -Wno-unused-result |
| |
| define COMPILESUPCC |
| $(ECHO_BEGIN)"CC $1 " |
| $(Q) $(CCACHE) $(CC) -c $(SUPCXXFLAGS) $3 $($(strip $1)_CXXFLAGS) $1 -o $2 |
| $(ECHO_END) |
| endef |
| |
| ifneq ($(CONFIG_CXX_RTTI),y) |
| RTTI_SUPSRCS = $(SUPDIR)/eh_arm.cc $(SUPDIR)/eh_call.cc |
| endif |
| |
| SUPSRCS += $(filter-out $(RTTI_SUPSRCS),$(wildcard $(SUPDIR)/*.cc)) |
| SUPOBJS = $(SUPSRCS:.cc=.o) |
| |
| $(SUPOBJS): %.o: %.cc |
| $(call COMPILESUPCC, $<, $@) |
| |
| OBJS += $(SUPOBJS) |