X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/392f107e4342b247cb605bc96c9fc722de52e2f4..b40bc2899b2e399c07e4b0b1dda0f9cfcb9c8b5a:/rules.mk?ds=inline diff --git a/rules.mk b/rules.mk index 34716da57..0cb72ac6b 100644 --- a/rules.mk +++ b/rules.mk @@ -1,5 +1,5 @@ # -# Copyright (C) 2006-2009 OpenWrt.org +# Copyright (C) 2006-2010 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -44,6 +44,23 @@ else FPIC:=-fpic endif +ARCH_SUFFIX:= +ifneq ($(findstring -mips32r2,$(TARGET_OPTIMIZATION)),) + ARCH_SUFFIX:=_r2 +endif +ifneq ($(findstring -march=armv4,$(TARGET_OPTIMIZATION)),) + ARCH_SUFFIX:=_v4 +endif +ifneq ($(findstring -march=armv4t,$(TARGET_OPTIMIZATION)),) + ARCH_SUFFIX:=_v4t +endif +ifneq ($(findstring -march=armv5t,$(TARGET_OPTIMIZATION)),) + ARCH_SUFFIX:=_v5t +endif +ifneq ($(findstring -march=armv5te,$(TARGET_OPTIMIZATION)),) + ARCH_SUFFIX:=_v5te +endif + DL_DIR:=$(if $(call qstrip,$(CONFIG_DOWNLOAD_FOLDER)),$(call qstrip,$(CONFIG_DOWNLOAD_FOLDER)),$(TOPDIR)/dl) BIN_DIR:=$(TOPDIR)/bin/$(BOARD) INCLUDE_DIR:=$(TOPDIR)/include @@ -57,11 +74,12 @@ ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),) LIBCV:=$(call qstrip,$(CONFIG_LIBC_VERSION)) REAL_GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-openwrt-linux$(if $(TARGET_SUFFIX),-$(TARGET_SUFFIX)) GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-openwrt-linux - BUILD_DIR:=$(BUILD_DIR_BASE)/target-$(ARCH)_$(LIBC)-$(LIBCV)$(if $(BUILD_SUFFIX),_$(BUILD_SUFFIX)) - STAGING_DIR:=$(TOPDIR)/staging_dir/target-$(ARCH)_$(LIBC)-$(LIBCV) - BUILD_DIR_TOOLCHAIN:=$(BUILD_DIR_BASE)/toolchain-$(ARCH)_gcc-$(GCCV)_$(LIBC)-$(LIBCV) - TOOLCHAIN_DIR:=$(TOPDIR)/staging_dir/toolchain-$(ARCH)_gcc-$(GCCV)_$(LIBC)-$(LIBCV) - PACKAGE_DIR:=$(BIN_DIR)/packages/$(BOARD)_$(LIBC)-$(LIBCV) + DIR_SUFFIX:=_$(LIBC)-$(LIBCV)$(if $(CONFIG_EABI_SUPPORT),_eabi) + 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) + BUILD_DIR_TOOLCHAIN:=$(BUILD_DIR_BASE)/toolchain-$(ARCH)$(ARCH_SUFFIX)_gcc-$(GCCV)$(DIR_SUFFIX) + TOOLCHAIN_DIR:=$(TOPDIR)/staging_dir/toolchain-$(ARCH)$(ARCH_SUFFIX)_gcc-$(GCCV)$(DIR_SUFFIX) + PACKAGE_DIR:=$(BIN_DIR)/packages else ifeq ($(CONFIG_NATIVE_TOOLCHAIN),) GNU_TARGET_NAME=$(call qstrip,$(CONFIG_TARGET_NAME)) @@ -73,21 +91,20 @@ else STAGING_DIR:=$(TOPDIR)/staging_dir/target-$(GNU_TARGET_NAME) BUILD_DIR_TOOLCHAIN:=$(BUILD_DIR_BASE)/toolchain-$(GNU_TARGET_NAME) TOOLCHAIN_DIR:=$(TOPDIR)/staging_dir/toolchain-$(GNU_TARGET_NAME) - PACKAGE_DIR:=$(BIN_DIR)/packages/$(BOARD)_$(GNU_TARGET_NAME) + PACKAGE_DIR:=$(BIN_DIR)/packages endif STAMP_DIR:=$(BUILD_DIR)/stamp STAMP_DIR_HOST=$(BUILD_DIR_HOST)/stamp TARGET_ROOTFS_DIR?=$(if $(call qstrip,$(CONFIG_TARGET_ROOTFS_DIR)),$(call qstrip,$(CONFIG_TARGET_ROOTFS_DIR)),$(BUILD_DIR)) TARGET_DIR:=$(TARGET_ROOTFS_DIR)/root-$(BOARD) STAGING_DIR_ROOT:=$(STAGING_DIR)/root-$(BOARD) -DEBUG_DIR:=$(BUILD_DIR)/debug-$(BOARD) BUILD_LOG_DIR:=$(TOPDIR)/logs TARGET_PATH:=$(STAGING_DIR_HOST)/bin:$(PATH) TARGET_CFLAGS:=$(TARGET_OPTIMIZATION)$(if $(CONFIG_DEBUG), -g3) TARGET_CPPFLAGS:=-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include TARGET_LDFLAGS:=-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib -LIBGCC_S=$(if $(wildcard $(TOOLCHAIN_DIR)/lib/libgcc_s.so),-L$(TOOLCHAIN_DIR)/lib -lgcc_s,$(wildcard $(TOOLCHAIN_DIR)/lib/gcc/*/*/libgcc.a)) +LIBGCC_S=$(if $(wildcard $(TOOLCHAIN_DIR)/lib/libgcc_s.so),-L$(TOOLCHAIN_DIR)/lib -lgcc_s,$(wildcard $(TOOLCHAIN_DIR)/usr/lib/gcc/*/*/libgcc.a)) ifndef DUMP ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),) @@ -142,6 +159,7 @@ TARGET_CXX:=$(if $(CONFIG_INSTALL_LIBSTDCPP),$(TARGET_CROSS)g++,no) PATCH:=$(SCRIPT_DIR)/patch-kernel.sh SED:=$(STAGING_DIR_HOST)/bin/sed -i -e CP:=cp -fpR +LN:=ln -sf INSTALL_BIN:=install -m0755 INSTALL_DIR:=install -d -m0755 @@ -154,7 +172,7 @@ ifneq ($(CONFIG_CCACHE),) TARGET_CC:= ccache $(TARGET_CC) endif -TARGET_CONFIGURE_OPTS:= \ +TARGET_CONFIGURE_OPTS = \ AR=$(TARGET_CROSS)ar \ AS="$(TARGET_CC) -c $(TARGET_CFLAGS)" \ LD=$(TARGET_CROSS)ld \ @@ -174,7 +192,7 @@ ifneq ($(CONFIG_NO_STRIP),) STRIP:=: else ifneq ($(CONFIG_USE_STRIP),) - STRIP:=$(TARGET_CROSS)strip + STRIP:=$(TARGET_CROSS)strip $(call qstrip,$(CONFIG_STRIP_ARGS)) else ifneq ($(CONFIG_USE_SSTRIP),) STRIP:=$(STAGING_DIR_HOST)/bin/sstrip @@ -220,6 +238,10 @@ $(call shvar,$(1))=$$(call $(1)) export $(call shvar,$(1)) endef +define include_mk +$(eval -include $(if $(DUMP),,$(STAGING_DIR)/mk/$(strip $(1)))) +endef + # file extension ext=$(word $(words $(subst ., ,$(1))),$(subst ., ,$(1)))