summaryrefslogtreecommitdiffstats
path: root/package/Makefile.in
diff options
context:
space:
mode:
Diffstat (limited to 'package/Makefile.in')
-rw-r--r--package/Makefile.in81
1 files changed, 73 insertions, 8 deletions
diff --git a/package/Makefile.in b/package/Makefile.in
index 733ff16ac..b619105bf 100644
--- a/package/Makefile.in
+++ b/package/Makefile.in
@@ -20,15 +20,52 @@ TAR_OPTIONS=$(subst ",, $(BR2_TAR_OPTIONS)) -xf
ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
-TARGET_CFLAGS=$(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING)
+TARGET_CFLAGS=$(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING) \
+ -I$(STAGING_DIR)/usr/include
+TARGET_LDFLAGS=-L$(STAGING_DIR)/lib -L$(STAGING_DIR)/usr/lib
+
+ifeq ($(BR2_TOOLCHAIN_SYSROOT),y)
+TARGET_CFLAGS+= $(BR2_SYSROOT) $(BR2_ISYSROOT)
+#TARGET_LDFLAGS=-Wl,$(BR2_SYSROOT)
+endif
+
+ifneq ($(BR2_PREFER_STATIC_LIB),y)
+ifeq ($(BR2_x86_64),y)
+TARGET_CFLAGS+=-fPIC -DPIC
+endif # PIC for dynamic objects on x86_64
+endif
+# else it's an external toolchain
else
TARGET_CFLAGS=$(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING) -I$(STAGING_DIR)/include -I$(STAGING_DIR)/usr/include -I$(TOOLCHAIN_EXTERNAL_PATH)/$(TOOLCHAIN_EXTERNAL_PREFIX)/include
TARGET_LDFLAGS=-L$(STAGING_DIR)/lib -L$(STAGING_DIR)/usr/lib
endif
+
+ifndef HOSTAR
+HOSTAR:=ar
+endif
+ifndef HOSTAS
+HOSTAS:=as
+endif
+ifndef HOSTCC
HOSTCC:=gcc
+endif
+ifndef HOSTCXX
HOSTCXX:=g++
+endif
+ifndef HOSTLD
+HOSTLD:=ld
+endif
+HOSTAR:=$(shell which $(HOSTAR) || type -p $(HOSTAR) || echo ar)
+HOSTAS:=$(shell which $(HOSTAS) || type -p $(HOSTAS) || echo as)
+HOSTCC:=$(shell which $(HOSTCC) || type -p $(HOSTCC) || echo gcc)
+HOSTCXX:=$(shell which $(HOSTCXX) || type -p $(HOSTCXX) || echo g++)
+HOSTLD:=$(shell which $(HOSTLD) || type -p $(HOSTLD) || echo ld)
+ifndef CFLAGS_FOR_BUILD
+CFLAGS_FOR_BUILD:="-g -O2"
+endif
-BASE_DIR:=${shell pwd}
+
+BASE_DIR:=$(shell pwd)
TOPDIR_PREFIX:=$(strip $(subst ",, $(BR2_TOPDIR_PREFIX)))_
#"))
@@ -59,12 +96,12 @@ ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
TOOL_BUILD_DIR=$(BASE_DIR)/$(TOPDIR_PREFIX)toolchain_build_$(ARCH)$(ARCH_FPU_SUFFIX)$(TOPDIR_SUFFIX)
# Quotes are needed for spaces et al in path components.
-TARGET_PATH="$(STAGING_DIR)/bin:$(TOOL_BUILD_DIR)/bin:$(STAGING_DIR)/usr/bin:$(PATH)"
+TARGET_PATH="$(TOOL_BUILD_DIR)/bin:$(STAGING_DIR)/bin:$(STAGING_DIR)/usr/bin:$(PATH)"
IMAGE:=$(BASE_DIR)/rootfs.$(ARCH)$(ARCH_FPU_SUFFIX)
-REAL_GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)$(GNU_TARGET_SUFFIX)
GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux
-KERNEL_CROSS=$(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)$(GNU_TARGET_SUFFIX)-
-TARGET_CROSS=$(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)$(GNU_TARGET_SUFFIX)-
+REAL_GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)$(GNU_TARGET_SUFFIX)
+TARGET_CROSS=$(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-
+KERNEL_CROSS=$(TARGET_CROSS)
else
TOOLCHAIN_EXTERNAL_PREFIX:=$(strip $(subst ",, $(BR2_TOOLCHAIN_EXTERNAL_PREFIX)))
#"))
@@ -111,9 +148,36 @@ TARGET_CONFIGURE_OPTS=PATH=$(TARGET_PATH) \
RANLIB=$(TARGET_CROSS)ranlib \
STRIP=$(TARGET_CROSS)strip \
OBJCOPY=$(TARGET_CROSS)objcopy \
+ CFLAGS="$(TARGET_CFLAGS)" \
+ LDFLAGS="$(TARGET_LDFLAGS)" \
+ AR_FOR_BUILD="$(HOSTAR)" \
+ AS_FOR_BUILD="$(HOSTAS)" \
+ CC_FOR_BUILD="$(HOSTCC)" \
+ CXX_FOR_BUILD="$(HOSTCXX)" \
+ LD_FOR_BUILD="$(HOSTLD)" \
+ CFLAGS_FOR_BUILD="$(HOST_CFLAGS)" \
+ LDFLAGS_FOR_BUILD="$(HOST_LDFLAGS)" \
+ PKG_CONFIG_SYSROOT="$(STAGING_DIR)" \
+ PKG_CONFIG="$(STAGING_DIR)/usr/bin/pkg-config"
+
+HOST_CONFIGURE_OPTS=PATH=$(TARGET_PATH) \
+ AR_FOR_BUILD="$(HOSTAR)" \
+ AS_FOR_BUILD="$(HOSTAS)" \
CC_FOR_BUILD="$(HOSTCC)" \
- PKG_CONFIG_SYSROOT=$(STAGING_DIR) \
- PKG_CONFIG=$(STAGING_DIR)/usr/bin/pkg-config
+ GCC_FOR_BUILD="$(HOSTCC)" \
+ CXX_FOR_BUILD="$(HOSTCXX)" \
+ LD_FOR_BUILD="$(HOSTLD)" \
+ CFLAGS_FOR_BUILD="$(HOST_CFLAGS)" \
+ CXXFLAGS_FOR_BUILD="$(HOST_CXXFLAGS)" \
+ LDFLAGS_FOR_BUILD="$(HOST_LDFLAGS)" \
+ AR_FOR_TARGET=$(TARGET_CROSS)ar \
+ AS_FOR_TARGET=$(TARGET_CROSS)as \
+ LD_FOR_TARGET=$(TARGET_CROSS)ld \
+ NM_FOR_TARGET=$(TARGET_CROSS)nm \
+ RANLIB_FOR_TARGET=$(TARGET_CROSS)ranlib \
+ STRIP_FOR_TARGET=$(TARGET_CROSS)strip \
+ OBJCOPY_FOR_TARGET=$(TARGET_CROSS)objcopy
+
ifeq ($(BR2_ENABLE_LOCALE),y)
@@ -130,6 +194,7 @@ ifeq ($(BR2_INSTALL_LIBSTDCPP),)
TARGET_CONFIGURE_OPTS+=CXX=""
endif
+
# X Windowing system
XSERVER:=