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