Root/toolchain/gcc/final/Makefile

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

Archive Download this file



interactive