X-Git-Url: http://git.openwrt.org/?a=blobdiff_plain;f=rules.mk;h=6455fde3f147108044bcf081ba374dd62267940a;hb=53e0f10246bbfdbfed941a8d44181f202a1f961f;hp=34c86ca49cab3049438b365ea2f915c290e9f562;hpb=44cd20b8023f6f2fca50c32772229590b179756d;p=openwrt%2Fstaging%2Fchunkeey.git diff --git a/rules.mk b/rules.mk index 34c86ca49c..6455fde3f1 100644 --- a/rules.mk +++ b/rules.mk @@ -60,7 +60,7 @@ ifneq ($(filter -march=armv%,$(TARGET_OPTIMIZATION)),) ARCH_SUFFIX:=_$(patsubst -march=arm%,%,$(filter -march=armv%,$(TARGET_OPTIMIZATION))) GCC_ARCH:=$(patsubst -march=%,%,$(filter -march=armv%,$(TARGET_OPTIMIZATION))) endif -ifneq ($(findstring -mips32r2,$(TARGET_OPTIMIZATION)),) +ifneq ($(filter -mips%r2,$(TARGET_OPTIMIZATION)),) ARCH_SUFFIX:=_r2 endif ifdef CONFIG_HAS_SPE_FPU @@ -81,6 +81,7 @@ ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),) REAL_GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-openwrt-linux$(if $(TARGET_SUFFIX),-$(TARGET_SUFFIX)) GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-openwrt-linux DIR_SUFFIX:=_$(LIBC)-$(LIBCV)$(if $(CONFIG_arm),_eabi) + BIN_DIR:=$(BIN_DIR)$(if $(CONFIG_USE_UCLIBC),,-$(LIBC)) BUILD_DIR:=$(BUILD_DIR_BASE)/target-$(ARCH)$(ARCH_SUFFIX)$(DIR_SUFFIX)$(if $(BUILD_SUFFIX),_$(BUILD_SUFFIX)) STAGING_DIR:=$(TOPDIR)/staging_dir/target-$(ARCH)$(ARCH_SUFFIX)$(DIR_SUFFIX)$(if $(BUILD_SUFFIX),_$(BUILD_SUFFIX)) BUILD_DIR_TOOLCHAIN:=$(BUILD_DIR_BASE)/toolchain-$(ARCH)$(ARCH_SUFFIX)_gcc-$(GCCV)$(DIR_SUFFIX) @@ -115,9 +116,9 @@ TARGET_LDFLAGS:=-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib ifneq ($(CONFIG_EXTERNAL_TOOLCHAIN),) LIBGCC_S_PATH=$(realpath $(wildcard $(call qstrip,$(CONFIG_LIBGCC_ROOT_DIR))/$(call qstrip,$(CONFIG_LIBGCC_FILE_SPEC)))) LIBGCC_S=$(if $(LIBGCC_S_PATH),-L$(dir $(LIBGCC_S_PATH)) -lgcc_s) -LIBGCC_A=$(realpath $(wildcard $(dir $(LIBGCC_S_PATH))/gcc/*/*/libgcc.a)) +LIBGCC_A=$(realpath $(lastword $(wildcard $(dir $(LIBGCC_S_PATH))/gcc/*/*/libgcc.a))) else -LIBGCC_A=$(wildcard $(TOOLCHAIN_DIR)/lib/gcc/*/*/libgcc.a) +LIBGCC_A=$(lastword $(wildcard $(TOOLCHAIN_DIR)/lib/gcc/*/*/libgcc.a)) LIBGCC_S=$(if $(wildcard $(TOOLCHAIN_DIR)/lib/libgcc_s.so),-L$(TOOLCHAIN_DIR)/lib -lgcc_s,$(LIBGCC_A)) endif LIBRPC=-lrpc @@ -286,6 +287,24 @@ define locked -c '$(subst ','\'',$(1))' endef +# Recursively copy paths into another directory, purge dangling +# symlinks before. +# $(1) => File glob expression +# $(2) => Destination directory +define file_copy + for src_dir in $(sort $(foreach d,$(wildcard $(1)),$(dir $(d)))); do \ + ( cd $$src_dir; find -type f -or -type d ) | \ + ( cd $(2); while :; do \ + read FILE; \ + [ -z "$$FILE" ] && break; \ + [ -L "$$FILE" ] || continue; \ + echo "Removing symlink $(2)/$$FILE"; \ + rm -f "$$FILE"; \ + done; ); \ + done; \ + $(CP) $(1) $(2) +endef + # file extension ext=$(word $(words $(subst ., ,$(1))),$(subst ., ,$(1)))