BINUTILS_VERSION:=$(TARGET_TOOLCHAIN_BINUTILS_VERSION) BINUTILS_SOURCE:=binutils-$(BINUTILS_VERSION).tar.bz2 BINUTILS_SITE:=@KERNEL/linux/devel/binutils BINUTILS_DIR:=$(TARGET_TOOLCHAIN_DIR)/binutils-$(BINUTILS_VERSION) BINUTILS_MAKE_DIR:=$(TOOLCHAIN_DIR)/make/target/binutils BINUTILS_DIR1:=$(BINUTILS_DIR)-build BINUTILS_MD5_2.21.52.0.2 := 680e4cdfecfa14f5590b994150aa5c7e BINUTILS_MD5 := $(BINUTILS_MD5_$(BINUTILS_VERSION)) BINUTILS_EXTRA_MAKE_OPTIONS := MAKEINFO=true ifeq ($(strip $(FREETZ_STATIC_TOOLCHAIN)),y) BINUTILS_EXTRA_MAKE_OPTIONS += LDFLAGS="-all-static" endif binutils-source: $(DL_DIR)/$(BINUTILS_SOURCE) ifneq ($(strip $(DL_DIR)/$(BINUTILS_SOURCE)), $(strip $(DL_DIR)/$(BINUTILS_KERNEL_SOURCE))) $(DL_DIR)/$(BINUTILS_SOURCE): | $(DL_DIR) $(DL_TOOL) $(DL_DIR) $(BINUTILS_SOURCE) $(BINUTILS_SITE) $(BINUTILS_MD5) endif binutils-unpacked: $(BINUTILS_DIR)/.unpacked $(BINUTILS_DIR)/.unpacked: $(DL_DIR)/$(BINUTILS_SOURCE) | $(TARGET_TOOLCHAIN_DIR) $(RM) -r $(BINUTILS_DIR) tar -C $(TARGET_TOOLCHAIN_DIR) $(VERBOSE) -xjf $(DL_DIR)/$(BINUTILS_SOURCE) set -e; \ for i in $(BINUTILS_MAKE_DIR)/$(BINUTILS_VERSION)/*.patch; do \ $(PATCH_TOOL) $(BINUTILS_DIR) $$i; \ done # fool zlib test in all configure scripts so it doesn't find zlib and thus no zlib gets linked in sed -i -r -e 's,(zlibVersion)([ \t]*[(][)]),\1WeDontWantZlib\2,g' $$(find $(BINUTILS_DIR) -name "configure" -type f) touch $@ $(BINUTILS_DIR1)/.configured: $(BINUTILS_DIR)/.unpacked mkdir -p $(BINUTILS_DIR1) (cd $(BINUTILS_DIR1); $(RM) config.cache; \ CC="$(TOOLCHAIN_HOSTCC)" \ CFLAGS="$(TOOLCHAIN_HOST_CFLAGS)" \ $(BINUTILS_DIR)/configure \ --prefix=$(TARGET_TOOLCHAIN_PREFIX) \ --with-sysroot=$(TARGET_TOOLCHAIN_SYSROOT) \ --build=$(GNU_HOST_NAME) \ --host=$(GNU_HOST_NAME) \ --target=$(REAL_GNU_TARGET_NAME) \ --disable-multilib \ --disable-libssp \ $(DISABLE_NLS) \ --disable-werror \ $(QUIET) \ ); touch $@ $(BINUTILS_DIR1)/.compiled: $(BINUTILS_DIR1)/.configured $(MAKE) $(BINUTILS_EXTRA_MAKE_OPTIONS) -C $(BINUTILS_DIR1) configure-host $(MAKE) $(BINUTILS_EXTRA_MAKE_OPTIONS) -C $(BINUTILS_DIR1) all touch $@ $(TARGET_TOOLCHAIN_STAGING_DIR)/usr/$(REAL_GNU_TARGET_NAME)/bin/ld: $(BINUTILS_DIR1)/.compiled $(MAKE1) $(BINUTILS_EXTRA_MAKE_OPTIONS) -C $(BINUTILS_DIR1) install $(RM) $(TARGET_TOOLCHAIN_STAGING_DIR)/usr/$(REAL_GNU_TARGET_NAME)/bin/ld.bfd $(TARGET_TOOLCHAIN_STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-ld.bfd $(call STRIP_TOOLCHAIN_BINARIES,$(TARGET_TOOLCHAIN_STAGING_DIR)/usr,$(BINUTILS_BINARIES_BIN),$(REAL_GNU_TARGET_NAME),$(HOST_STRIP)) $(call REMOVE_DOC_NLS_DIRS,$(TARGET_TOOLCHAIN_STAGING_DIR)) $(call CREATE_TARGET_NAME_SYMLINKS,$(TARGET_TOOLCHAIN_STAGING_DIR)/usr,$(BINUTILS_BINARIES_BIN),$(REAL_GNU_TARGET_NAME),$(GNU_TARGET_NAME)) binutils-uninstall: $(RM) $(call TOOLCHAIN_BINARIES_LIST,$(TARGET_TOOLCHAIN_STAGING_DIR)/usr,$(BINUTILS_BINARIES_BIN),$(REAL_GNU_TARGET_NAME)) $(RM) $(call TOOLCHAIN_BINARIES_LIST,$(TARGET_TOOLCHAIN_STAGING_DIR)/usr,$(BINUTILS_BINARIES_BIN),$(GNU_TARGET_NAME)) $(RM) -r $(TARGET_TOOLCHAIN_STAGING_DIR)/usr/lib/{libiberty*,ldscripts} binutils-clean: binutils-uninstall $(RM) -r $(BINUTILS_DIR1) binutils-dirclean: binutils-clean binutils_target-dirclean $(RM) -r $(BINUTILS_DIR) binutils: uclibc-configured binutils-dependencies $(TARGET_TOOLCHAIN_STAGING_DIR)/usr/$(REAL_GNU_TARGET_NAME)/bin/ld .PHONY: binutils binutils-dependencies ############################################################# # # build binutils for use on the target system # ############################################################# BINUTILS_DIR2:=$(BINUTILS_DIR)-target $(BINUTILS_DIR2)/.configured: $(BINUTILS_DIR)/.unpacked mkdir -p $(BINUTILS_DIR2) (cd $(BINUTILS_DIR2); $(RM) config.cache; \ CFLAGS_FOR_BUILD="-g -O2 $(HOST_CFLAGS)" \ $(TARGET_CONFIGURE_ENV) \ $(BINUTILS_DIR)/configure \ --prefix=/usr \ --with-sysroot=/ \ --exec-prefix=/usr \ --build=$(GNU_HOST_NAME) \ --host=$(REAL_GNU_TARGET_NAME) \ --target=$(REAL_GNU_TARGET_NAME) \ --disable-multilib \ --without-zlib \ $(DISABLE_NLS) \ --disable-werror \ ) touch $@ $(BINUTILS_DIR2)/.compiled: $(BINUTILS_DIR2)/.configured $(MAKE_ENV) $(MAKE) $(BINUTILS_EXTRA_MAKE_OPTIONS) -C $(BINUTILS_DIR2) all touch $@ $(TARGET_UTILS_DIR)/usr/bin/ld: $(BINUTILS_DIR2)/.compiled $(MAKE_ENV) $(MAKE1) $(BINUTILS_EXTRA_MAKE_OPTIONS) -C $(BINUTILS_DIR2) \ tooldir=/usr \ build_tooldir=/usr \ DESTDIR=$(TARGET_UTILS_DIR) install $(RM) $(TARGET_UTILS_DIR)/usr/bin/ld.bfd $(call STRIP_TOOLCHAIN_BINARIES,$(TARGET_UTILS_DIR)/usr,$(BINUTILS_BINARIES_BIN),$(REAL_GNU_TARGET_NAME),$(TARGET_STRIP)) $(call REMOVE_DOC_NLS_DIRS,$(TARGET_UTILS_DIR)) binutils_target: $(TARGET_UTILS_DIR)/usr/bin/ld binutils_target-uninstall: $(RM) $(call TOOLCHAIN_BINARIES_LIST,$(TARGET_UTILS_DIR)/usr,$(BINUTILS_BINARIES_BIN),$(REAL_GNU_TARGET_NAME)) binutils_target-clean: binutils_target-uninstall $(RM) -r $(BINUTILS_DIR2) binutils_target-dirclean: binutils_target-clean