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_defines.h exception new typeinfo cxxabi.h cxxabi-forced.h
13 ALLOCATOR_H := config/allocator/new_allocator_base.h
14 CLOCALE_H := config/locale/generic/c_locale.h
15 ATOMIC_WORD_H := atomic_word.h
16 CPU_DEFINES_H := cpu_defines.h
17 TIME_MEMBERS_H := config/locale/generic/time_members.h
18 MESSAGES_MEMBERS_H := config/locale/generic/messages_members.h
19 BASIC_FILE_H := config/io/basic_file_stdio.h
20 CSTDIO_H := config/io/c_io_stdio.h
21 CMATH_TCC := include/c_std/cmath.tcc
23 CTYPE_HEADERS := config/os/generic/*
26 include $(L4DIR)/mk/include.mk
27 include $(STDCXX_PKG_DIR)/contrib.inc
29 ifeq ("$(STDCXX_0x)", "y")
30 LIBSUPC_H += initializer_list exception_ptr.h nested_exception.h
33 STDCXX_CSTD_HEADERS := \
34 cassert cctype cerrno cfloat ciso646 climits clocale cmath csetjmp csignal \
35 cstdarg cstddef cstdio cstdlib cstring ctime cwchar cwctype cstdint
38 STDCXX_CSTD_HEADERS += $(patsubst std_%.h,%,$(notdir $(wildcard $(INCSRC_DIR)/std/*)))
40 STDCXX_STD_DIRS := std c_std c_global tr1
43 INSTALL_INCDIR_X = $(INSTALLDIR_LOCAL)/$(INSTALL_INC_PREFIX)
44 SRCDIR_X = $(STDCXX_CONTRIB_DIR)
47 install_header = $(LN) -sf $(SRCDIR_X)/$(strip $(1)) $(INSTALL_INCDIR_X)/$(strip $(2))
49 install_config_header = $(VERBOSE)$(call install_header, $(1), bits/$(strip $(2)))
51 cpu_header = $(word 1,$(wildcard $(SRCDIR_X)/$(CPU_H_arch)/$(strip $(1)) $(SRCDIR_X)/$(CPU_H_generic)/$(strip $(1))))
53 install_cpu_header = $(VERBOSE)$(if $(call cpu_header,$(1)),$(LN) -sf $(call cpu_header,$(1)) $(INSTALL_INCDIR_X)/bits/$(strip $(1)))
55 LIBSUPC_HI = $(addprefix $(INSTALL_INCDIR_X)/, $(LIBSUPC_H))
56 STDCXX_CSTD_HEADERS_ABS = $(addprefix $(INSTALL_INCDIR_X)/, $(STDCXX_CSTD_HEADERS))
59 std_header_list = $(strip $(1)) std_$(strip $(1)).h
61 choose_std_header = $(word 1, $(wildcard $(foreach DIR,$(STDCXX_STD_DIRS),$(addprefix $(INCSRC_DIR)/$(DIR)/, $(call std_header_list, $(1))))))
63 $(STDCXX_CSTD_HEADERS_ABS): %: $(INSTALL_INCDIR_X)
64 @$(INSTALL_LINK_MESSAGE)
65 $(VERBOSE)$(LN) -sf $(call choose_std_header,$(notdir $@)) $@
67 $(LIBSUPC_HI): %: $(INSTALL_INCDIR_X)
68 @$(INSTALL_LINK_MESSAGE)
69 $(VERBOSE)$(call install_header, libsupc++/$(notdir $@), $(notdir $@))
72 @$(INSTALL_LINK_MESSAGE) $(INSTALL_INCDIR_X)
73 $(VERBOSE)$(INSTALL) -d $(INSTALL_INCDIR_X)
75 all:: $(INSTALL_INCDIR_X) $(LIBSUPC_HI) $(STDCXX_CSTD_HEADERS_ABS)
76 @$(INSTALL_LINK_MESSAGE)
77 $(call install_config_header, $(ALLOCATOR_H), c++allocator.h)
78 $(call install_config_header, $(CLOCALE_H), c++locale.h)
79 $(call install_cpu_header, atomic_word.h)
80 $(call install_cpu_header, cpu_defines.h)
81 $(call install_cpu_header, cxxabi_tweaks.h)
82 $(call install_config_header, $(CTYPE_HEADERS), .)
83 $(call install_config_header, $(TIME_MEMBERS_H), time_members.h)
84 $(call install_config_header, $(MESSAGES_MEMBERS_H), messages_members.h)
85 $(call install_config_header, $(BASIC_FILE_H), basic_file.h)
86 $(call install_config_header, $(CSTDIO_H), c++io.h)
87 $(call install_config_header, $(CMATH_TCC), cmath.tcc)