2 L4DIR ?= $(PKGDIR)/../..
4 STDCXX_PKG_DIR ?= $(PKGDIR_ABS)/../libstdc++-v3
8 INCSRC_DIR = $(STDCXX_CONTRIB_DIR)/include
9 TARGET = $(shell (cd $(INCSRC_DIR) && find . -type f -not -name 'Make*' -print))
11 LIBSUPC_H := exception new typeinfo
12 LIBSUPC_H-4.6_PLUS- := exception_defines.h cxxabi-forced.h
13 LIBSUPC_H-4.6_PLUS-y := bits/exception_defines.h bits/cxxabi_forced.h bits/hash_bytes.h
15 ALLOCATOR_H := config/allocator/new_allocator_base.h
16 CLOCALE_H := config/locale/generic/c_locale.h
17 ATOMIC_WORD_H := atomic_word.h
18 CPU_DEFINES_H := cpu_defines.h
19 TIME_MEMBERS_H := config/locale/generic/time_members.h
20 MESSAGES_MEMBERS_H := config/locale/generic/messages_members.h
21 BASIC_FILE_H := config/io/basic_file_stdio.h
22 CSTDIO_H := config/io/c_io_stdio.h
23 CMATH_TCC := include/c_std/cmath.tcc
28 include $(L4DIR)/mk/include.mk
29 include $(STDCXX_PKG_DIR)/contrib.inc
31 ifeq ("$(STDCXX_0x)", "y")
32 LIBSUPC_H += initializer_list
33 LIBSUPC_H-4.6_PLUS- += exception_ptr.h nested_exception.h
34 LIBSUPC_H-4.6_PLUS-y += bits/exception_ptr.h bits/nested_exception.h
36 STDCXX_CSTD_HEADERS := \
37 cassert cctype cerrno cfloat ciso646 climits clocale cmath csetjmp csignal \
38 cstdarg cstddef cstdio cstdlib cstring ctime cwchar cwctype cstdint
41 STDCXX_CSTD_HEADERS += $(patsubst std_%.h,%,$(notdir $(wildcard $(INCSRC_DIR)/std/*)))
43 STDCXX_STD_DIRS := std c_global c_std tr1
46 INSTALL_INCDIR_X = $(INSTALLDIR_LOCAL)/$(INSTALL_INC_PREFIX)
47 SRCDIR_X = $(STDCXX_CONTRIB_DIR)
49 CTYPE_HEADERS := $(filter-out %/os_defines.h,$(wildcard $(SRCDIR_X)/config/os/generic/*))
51 install_header_x = $(MKDIR) $(dir $(INSTALL_INCDIR_X)/$(strip $(2))) && $(LN) -sf $(call absfilename,$(strip $(1)) $(INSTALL_INCDIR_X)/$(strip $(2)))
52 install_header = $(MKDIR) $(dir $(INSTALL_INCDIR_X)/$(strip $(2))) && $(LN) -sf $(SRCDIR_X)/$(strip $(1)) $(INSTALL_INCDIR_X)/$(strip $(2))
54 install_config_header = $(call install_header, $(1), bits/$(strip $(2)))
56 cpu_header = $(word 1,$(wildcard $(SRCDIR_X)/$(CPU_H_arch)/$(strip $(1)) $(SRCDIR_X)/$(CPU_H_generic)/$(strip $(1))))
58 install_cpu_header = $(VERBOSE)$(if $(call cpu_header,$(1)),$(LN) -sf $(call cpu_header,$(1)) $(INSTALL_INCDIR_X)/bits/$(strip $(1)))
60 LIBSUPC_H += $(foreach V,$(STDCXX_AVAILABLE_VERSIONS),$(LIBSUPC_H-$(V)_PLUS-$(STDCXX_CONTRIB_VERSION_$(V)_PLUS)))
62 LIBSUPC_HI = $(addprefix $(INSTALL_INCDIR_X)/, $(LIBSUPC_H))
63 STDCXX_CSTD_HEADERS_ABS = $(addprefix $(INSTALL_INCDIR_X)/, $(STDCXX_CSTD_HEADERS))
66 std_header_list = $(strip $(1)) std_$(strip $(1)).h
68 choose_std_header = $(word 1, $(wildcard $(foreach DIR,$(STDCXX_STD_DIRS),$(addprefix $(INCSRC_DIR)/$(DIR)/, $(call std_header_list, $(1))))))
70 $(STDCXX_CSTD_HEADERS_ABS): %: $(INSTALL_INCDIR_X)
71 @$(INSTALL_LINK_MESSAGE)
72 $(VERBOSE)$(LN) -sf $(call choose_std_header,$(notdir $@)) $@
74 $(LIBSUPC_HI): %: $(INSTALL_INCDIR_X)
75 @$(INSTALL_LINK_MESSAGE)
76 $(VERBOSE)$(call install_header, libsupc++/$(notdir $@), $(patsubst $(INSTALL_INCDIR_X)/%,%,$@))
79 @$(INSTALL_LINK_MESSAGE) $(INSTALL_INCDIR_X)
80 $(VERBOSE)$(INSTALL) -d $(INSTALL_INCDIR_X)
82 all:: $(INSTALL_INCDIR_X) $(LIBSUPC_HI) $(STDCXX_CSTD_HEADERS_ABS)
83 @$(INSTALL_LINK_MESSAGE)
84 $(VERBOSE)$(call install_config_header, $(ALLOCATOR_H), c++allocator.h)
85 $(VERBOSE)$(call install_config_header, $(CLOCALE_H), c++locale.h)
86 $(call install_cpu_header, atomic_word.h)
87 $(call install_cpu_header, cpu_defines.h)
88 $(call install_cpu_header, cxxabi_tweaks.h)
89 $(VERBOSE)$(foreach H,$(CTYPE_HEADERS), $(call install_header_x, $(H), bits/$(notdir $(H))); )
90 $(VERBOSE)$(call install_config_header, $(TIME_MEMBERS_H), time_members.h)
91 $(VERBOSE)$(call install_config_header, $(MESSAGES_MEMBERS_H), messages_members.h)
92 $(VERBOSE)$(call install_config_header, $(BASIC_FILE_H), basic_file.h)
93 $(VERBOSE)$(call install_config_header, $(CSTDIO_H), c++io.h)
94 $(VERBOSE)$(call install_config_header, $(CMATH_TCC), cmath.tcc)