259 lines
7.3 KiB
Makefile
259 lines
7.3 KiB
Makefile
ifndef MAKE
|
|
MAKE:=make
|
|
endif
|
|
ifndef HOSTMAKE
|
|
HOSTMAKE=$(MAKE)
|
|
endif
|
|
HOSTMAKE :=$(shell $(CONFIG_SHELL) -c "which $(HOSTMAKE)" || type -p $(HOSTMAKE) || echo make)
|
|
|
|
MAKE1:=$(HOSTMAKE) MAKE="$(firstword $(HOSTMAKE)) -j1"
|
|
MAKE:=$(HOSTMAKE) -j$(BR2_JLEVEL)
|
|
|
|
|
|
ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
|
|
TARGET_CFLAGS=$(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING) \
|
|
-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/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
|
|
|
|
CC_TARGET_TUNE_:=$(strip $(subst ",,$(BR2_GCC_TARGET_TUNE)))
|
|
#"))
|
|
CC_TARGET_ARCH_:=$(strip $(subst ",,$(BR2_GCC_TARGET_ARCH)))
|
|
#"))
|
|
CC_TARGET_ABI_:=$(strip $(subst ",,$(BR2_GCC_TARGET_ABI)))
|
|
#"))
|
|
ifneq ($(CC_TARGET_TUNE_),)
|
|
TARGET_CFLAGS+=-mtune=$(CC_TARGET_TUNE_)
|
|
endif
|
|
ifneq ($(CC_TARGET_ARCH_),)
|
|
TARGET_CFLAGS+=-march=$(CC_TARGET_ARCH_)
|
|
endif
|
|
ifneq ($(CC_TARGET_ABI_),)
|
|
TARGET_CFLAGS+=-mabi=$(CC_TARGET_ABI_)
|
|
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
|
|
|
|
ifeq ($(BR2_SOFT_FLOAT),y)
|
|
TARGET_CFLAGS+=-msoft-float
|
|
endif
|
|
|
|
ifeq ($(BR2_sparc_v9b),y)
|
|
TARGET_CFLAGS+=-mvis
|
|
endif
|
|
ifeq ($(BR2_sparc64_v9b),y)
|
|
TARGET_CFLAGS+=-mvis
|
|
endif
|
|
|
|
TARGET_CXXFLAGS=$(TARGET_CFLAGS)
|
|
|
|
# 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_CXXFLAGS=$(TARGET_CFLAGS)
|
|
TARGET_LDFLAGS=-L$(STAGING_DIR)/lib -L$(STAGING_DIR)/usr/lib
|
|
endif
|
|
#########################################################################
|
|
|
|
|
|
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="$(TOOL_BUILD_DIR)/bin:$(STAGING_DIR)/bin:$(STAGING_DIR)/usr/bin:$(PATH)"
|
|
IMAGE:=$(BINARIES_DIR)/rootfs.$(ARCH)$(ARCH_FPU_SUFFIX)-$(DATE)
|
|
GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux
|
|
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)))
|
|
#"))
|
|
TOOLCHAIN_EXTERNAL_PATH:=$(strip $(subst ",, $(BR2_TOOLCHAIN_EXTERNAL_PATH)))
|
|
#"))
|
|
TOOL_BUILD_DIR=$(BASE_DIR)/$(TOPDIR_PREFIX)toolchain_build_$(TOOLCHAIN_EXTERNAL_PREFIX)
|
|
TARGET_PATH="$(STAGING_DIR)/bin:$(TOOL_BUILD_DIR)/bin:$(TOOLCHAIN_EXTERNAL_PATH)/bin:$(PATH)"
|
|
IMAGE:=$(BINARIES_DIR)/rootfs.$(TOOLCHAIN_EXTERNAL_PREFIX)-$(DATE)
|
|
|
|
REAL_GNU_TARGET_NAME=$(TOOLCHAIN_EXTERNAL_PREFIX)
|
|
GNU_TARGET_NAME=$(TOOLCHAIN_EXTERNAL_PREFIX)
|
|
KERNEL_CROSS=$(TOOLCHAIN_EXTERNAL_PATH)/bin/$(TOOLCHAIN_EXTERNAL_PREFIX)-
|
|
TARGET_CROSS=$(TOOLCHAIN_EXTERNAL_PATH)/bin/$(TOOLCHAIN_EXTERNAL_PREFIX)-
|
|
endif
|
|
TARGET_CC=$(TARGET_CROSS)gcc
|
|
TARGET_CXX=$(TARGET_CROSS)g++
|
|
TARGET_AR=$(TARGET_CROSS)ar
|
|
TARGET_RANLIB=$(TARGET_CROSS)ranlib
|
|
TARGET_LDCONFIG=$(TARGET_CROSS)ldconfig
|
|
INSTALL=/usr/bin/install
|
|
ifeq ($(BR2_STRIP_strip),y)
|
|
STRIP_DISCARD_ALL:=--discard-all
|
|
STRIP_STRIP_UNNEEDED:=--strip-unneeded
|
|
STRIP_STRIP_ALL:=--strip-all
|
|
REMOVE_SECTION_COMMENT:=--remove-section=.comment
|
|
REMOVE_SECTION_NOTE:=--remove-section=.note
|
|
STRIP=$(TARGET_CROSS)strip $(REMOVE_SECTION_COMMENT) $(REMOVE_SECTION_NOTE)
|
|
endif
|
|
ifeq ($(BR2_STRIP_sstrip),y)
|
|
STRIP=$(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-sstrip
|
|
STRIP_DISCARD_ALL:=
|
|
STRIP_STRIP_UNNEEDED:=
|
|
STRIP_STRIP_ALL:=
|
|
REMOVE_SECTION_COMMENT:=
|
|
REMOVE_SECTION_NOTE:=
|
|
endif
|
|
ifeq ($(BR2_STRIP_none),y)
|
|
STRIP=true -Not_stripping
|
|
endif
|
|
|
|
HOST_ARCH:=$(shell $(HOSTCC) -dumpmachine | sed -e s'/-.*//' \
|
|
-e 's/sparc.*/sparc/' \
|
|
-e 's/arm.*/arm/g' \
|
|
-e 's/m68k.*/m68k/' \
|
|
-e 's/ppc/powerpc/g' \
|
|
-e 's/v850.*/v850/g' \
|
|
-e 's/sh[234]/sh/' \
|
|
-e 's/mips-.*/mips/' \
|
|
-e 's/mipsel-.*/mipsel/' \
|
|
-e 's/cris.*/cris/' \
|
|
-e 's/i[3-9]86/i386/' \
|
|
)
|
|
GNU_HOST_NAME:=$(HOST_ARCH)-$(subst ",,$(BR2_GNU_BUILD_SUFFIX))
|
|
#")
|
|
TARGET_CONFIGURE_OPTS=PATH=$(TARGET_PATH) \
|
|
AR=$(TARGET_CROSS)ar \
|
|
AS=$(TARGET_CROSS)as \
|
|
LD="$(TARGET_CROSS)ld $(TARGET_LDFLAGS)" \
|
|
NM=$(TARGET_CROSS)nm \
|
|
CC="$(TARGET_CROSS)gcc $(TARGET_CFLAGS)" \
|
|
GCC="$(TARGET_CROSS)gcc $(TARGET_CFLAGS)" \
|
|
CXX="$(TARGET_CROSS)g++ $(TARGET_CFLAGS)" \
|
|
CPP="$(TARGET_CROSS)cpp $(TARGET_CFLAGS)" \
|
|
RANLIB=$(TARGET_CROSS)ranlib \
|
|
STRIP=$(TARGET_CROSS)strip \
|
|
OBJCOPY=$(TARGET_CROSS)objcopy \
|
|
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)" \
|
|
CXXFLAGS_FOR_BUILD="$(HOST_CXXFLAGS)" \
|
|
LDFLAGS_FOR_BUILD="$(HOST_LDFLAGS)" \
|
|
PKG_CONFIG_SYSROOT="$(STAGING_DIR)" \
|
|
PKG_CONFIG="$(STAGING_DIR)/usr/bin/pkg-config" \
|
|
PKG_CONFIG_PATH="$(STAGING_DIR)/usr/lib/pkgconfig:$(PKG_CONFIG_PATH)" \
|
|
PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 \
|
|
PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 \
|
|
STAGING_DIR="$(STAGING_DIR)"
|
|
|
|
HOST_CONFIGURE_OPTS=PATH=$(TARGET_PATH) \
|
|
AR_FOR_BUILD="$(HOSTAR)" \
|
|
AS_FOR_BUILD="$(HOSTAS)" \
|
|
CC_FOR_BUILD="$(HOSTCC)" \
|
|
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="$(HOSTAR)" \
|
|
AS="$(HOSTAS)" \
|
|
CC="$(HOSTCC) $(HOST_CFLAGS)" \
|
|
GCC="$(HOSTCC) $(HOST_CFLAGS)" \
|
|
CXX="$(HOSTCXX)" \
|
|
LD="$(HOSTLD) $(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
|
|
|
|
#######################################################################
|
|
# settings we need to pass to configure
|
|
|
|
# does unaligned access trap?
|
|
BR2_AC_CV_TRAP_CHECK=ac_cv_lbl_unaligned_fail=yes
|
|
ifeq ($(BR2_i386),y)
|
|
BR2_AC_CV_TRAP_CHECK=ac_cv_lbl_unaligned_fail=no
|
|
endif
|
|
ifeq ($(BR2_x86_64),y)
|
|
BR2_AC_CV_TRAP_CHECK=ac_cv_lbl_unaligned_fail=no
|
|
endif
|
|
ifeq ($(BR2_m68k),y)
|
|
BR2_AC_CV_TRAP_CHECK=ac_cv_lbl_unaligned_fail=no
|
|
endif
|
|
ifeq ($(BR2_s390),y)
|
|
BR2_AC_CV_TRAP_CHECK=ac_cv_lbl_unaligned_fail=no
|
|
endif
|
|
ifeq ($(BR2_powerpc)$(BR2_ENDIAN),yBIG)
|
|
BR2_AC_CV_TRAP_CHECK=ac_cv_lbl_unaligned_fail=no
|
|
endif
|
|
|
|
ifeq ($(BR2_ENDIAN),"BIG")
|
|
BR2_AC_CV_C_BIGENDIAN=ac_cv_c_bigendian=yes
|
|
else
|
|
BR2_AC_CV_C_BIGENDIAN=ac_cv_c_bigendian=no
|
|
endif
|
|
|
|
TARGET_CONFIGURE_ARGS= \
|
|
$(BR2_AC_CV_TRAP_CHECK) \
|
|
ac_cv_func_mmap_fixed_mapped=yes \
|
|
ac_cv_func_memcmp_working=yes \
|
|
$(BR2_AC_CV_C_BIGENDIAN)
|
|
|
|
#######################################################################
|
|
|
|
ifeq ($(BR2_ENABLE_LOCALE),y)
|
|
DISABLE_NLS:=
|
|
else
|
|
DISABLE_NLS:=--disable-nls
|
|
endif
|
|
|
|
ifneq ($(BR2_LARGEFILE),y)
|
|
DISABLE_LARGEFILE= --disable-largefile
|
|
endif
|
|
|
|
ifneq ($(BR2_INET_IPV6),y)
|
|
DISABLE_IPV6= --disable-ipv6
|
|
endif
|
|
|
|
ifneq ($(BR2_GCC_CROSS_CXX),y)
|
|
TARGET_CONFIGURE_OPTS+=CXX=""
|
|
endif
|
|
|
|
|
|
|
|
# X Windowing system
|
|
|
|
XSERVER:=
|
|
ifeq ($(strip $(BR2_PACKAGE_TINYX)),y)
|
|
XSERVER+=tinyx
|
|
endif
|
|
ifeq ($(strip $(BR2_PACKAGE_XORG)),y)
|
|
XSERVER+=xorg
|
|
endif
|
|
ifeq ($(strip $(BR2_PACKAGE_XORG7)),y)
|
|
XSERVER+=xserver_xorg-server
|
|
endif
|
|
ifeq ($(strip $(BR2_PACKAGE_XGGI)),y)
|
|
XSERVER+=xggi
|
|
endif
|
|
|
|
X11_PREFIX:=$(strip $(subst ",, $(BR2_X11_PREFIX)))
|
|
#"))
|
|
|
|
include package/Makefile.autotools.in
|
|
|