[toolchain] introduce option to enable setjump()/longjump() based C++ exceptions...
[openwrt/svn-archive/archive.git] / toolchain / gcc / final / Makefile
1 GCC_VARIANT:=final
2
3 include ../common.mk
4
5 GCC_CONFIGURE += \
6 --enable-languages=$(TARGET_LANGUAGES) \
7 --enable-shared \
8 --enable-threads \
9 --with-slibdir=$(TOOLCHAIN_DIR)/lib
10
11 ifneq ($(CONFIG_GCC_VERSION_4_5),)
12 GCC_CONFIGURE += \
13 --enable-lto \
14 --with-libelf=$(TOPDIR)/staging_dir/host
15 endif
16
17 ifneq ($(CONFIG_TLS_SUPPORT),)
18 GCC_CONFIGURE += \
19 --enable-tls
20 else
21 GCC_CONFIGURE += \
22 --disable-tls
23 endif
24
25 ifneq ($(CONFIG_SJLJ_EXCEPTIONS),)
26 GCC_CONFIGURE += \
27 --enable-sjlj-exceptions
28 endif
29
30 define Host/Configure
31 mkdir -p $(GCC_BUILD_DIR) $(TOOLCHAIN_DIR)/$(REAL_GNU_TARGET_NAME)
32 # Important! Required for limits.h to be fixed.
33 rm -rf $(TOOLCHAIN_DIR)/$(REAL_GNU_TARGET_NAME)/sys-include
34 ln -sf ../include $(TOOLCHAIN_DIR)/$(REAL_GNU_TARGET_NAME)/sys-include
35 rm -rf $(TOOLCHAIN_DIR)/$(REAL_GNU_TARGET_NAME)/lib
36 ln -sf ../lib $(TOOLCHAIN_DIR)/$(REAL_GNU_TARGET_NAME)/lib
37 $(if $(CONFIG_mips64)$(CONFIG_mips64el)$(CONFIG_x86_64),ln -sf ../lib64 $(TOOLCHAIN_DIR)/$(REAL_GNU_TARGET_NAME)/lib64)
38 (cd $(GCC_BUILD_DIR) && rm -f config.cache; \
39 $(GCC_CONFIGURE) \
40 );
41 endef
42
43 define Host/Compile
44 $(GCC_MAKE) -C $(GCC_BUILD_DIR) all
45 endef
46
47 define SetupExtraArch
48 for app in $(TOOLCHAIN_DIR)/bin/$(OPTIMIZE_FOR_CPU)*-{gcc,gcc-*,g++}; do \
49 [ -e $$$$app ] || continue; \
50 old_base=$$$$(basename $$$$app); \
51 new_base=$(call qstrip,$(CONFIG_EXTRA_TARGET_ARCH_NAME))-$$$${old_base##$(OPTIMIZE_FOR_CPU)-}; \
52 sed -e "s/@CC_BASE@/$$$$old_base/" \
53 -e 's/@EXTRA_ARCH_OPTS@/$(call qstrip,$(CONFIG_EXTRA_TARGET_ARCH_OPTS))/' \
54 ../files/alternate-arch-cc.in > \
55 $(TOOLCHAIN_DIR)/bin/$$$$new_base; \
56 chmod a+x $(TOOLCHAIN_DIR)/bin/$$$$new_base; \
57 done
58 endef
59
60 define Host/Install
61 $(_SINGLE)$(GCC_MAKE) -C $(GCC_BUILD_DIR) install
62 # Set up the symlinks to enable lying about target name.
63 set -e; \
64 (cd $(TOOLCHAIN_DIR); \
65 ln -sf $(REAL_GNU_TARGET_NAME) $(GNU_TARGET_NAME); \
66 cd bin; \
67 for app in $(REAL_GNU_TARGET_NAME)-* ; do \
68 ln -sf $$$${app} \
69 $(GNU_TARGET_NAME)$$$${app##$(REAL_GNU_TARGET_NAME)}; \
70 done; \
71 );
72 $(if $(CONFIG_EXTRA_TARGET_ARCH),$(call SetupExtraArch))
73 endef
74
75 $(eval $(call HostBuild))
76