2007-08-22 13:47:22 +02:00
|
|
|
ifndef MAKE
|
2007-07-17 14:09:07 +02:00
|
|
|
MAKE:=make
|
2007-01-30 18:33:53 +01:00
|
|
|
endif
|
2007-07-17 14:09:07 +02:00
|
|
|
ifndef HOSTMAKE
|
|
|
|
HOSTMAKE=$(MAKE)
|
|
|
|
endif
|
2009-01-01 22:20:35 +01:00
|
|
|
HOSTMAKE :=$(shell which $(HOSTMAKE) || type -p $(HOSTMAKE) || echo make)
|
2007-07-17 14:09:07 +02:00
|
|
|
|
2012-06-16 11:37:17 +02:00
|
|
|
# If BR2_LEVEL is 0, scale the maximum concurrency with the number of
|
package-infra: limit the number of // jobs
The current code spawns as many jobs as up to twice the number of CPUs.
On small-class machines like laptops, with a limitted amount of memory,
but still a few CPUs (real or hyperthreads), the HDD becomes a bottleneck,
and it becomes almost impossible to do anythiong else while there is a
build in progress.
Limit the number of jobs to the number of CPUs plus one.
Even on fast machines with fast HDDs, this settings keeps the machine
fully busy (for those packages that can build in parallel, of course).
For example, building qemu or the linux kernel kept my hyperthreaded
hexa Core i7 with 18GiB of RAM, busy at 99% (I never ever managed to
get 100% even with more jobs, not even 200); while on my hyperthreaded
dual Core i5 with only 4GiB and a slow HDD, I still topped at 100% CPU,
while still able to do some work involving the HDD.
If the number of processors is not available, assume one.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Nathan Lynch <ntl@pobox.com>
Reviewed-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Nathan Lynch <ntl@pobox.com>
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
2013-05-10 05:56:01 +02:00
|
|
|
# CPUs. An additional job is used in order to keep processors busy
|
2012-06-16 11:37:17 +02:00
|
|
|
# while waiting on I/O.
|
package-infra: limit the number of // jobs
The current code spawns as many jobs as up to twice the number of CPUs.
On small-class machines like laptops, with a limitted amount of memory,
but still a few CPUs (real or hyperthreads), the HDD becomes a bottleneck,
and it becomes almost impossible to do anythiong else while there is a
build in progress.
Limit the number of jobs to the number of CPUs plus one.
Even on fast machines with fast HDDs, this settings keeps the machine
fully busy (for those packages that can build in parallel, of course).
For example, building qemu or the linux kernel kept my hyperthreaded
hexa Core i7 with 18GiB of RAM, busy at 99% (I never ever managed to
get 100% even with more jobs, not even 200); while on my hyperthreaded
dual Core i5 with only 4GiB and a slow HDD, I still topped at 100% CPU,
while still able to do some work involving the HDD.
If the number of processors is not available, assume one.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Nathan Lynch <ntl@pobox.com>
Reviewed-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Nathan Lynch <ntl@pobox.com>
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
2013-05-10 05:56:01 +02:00
|
|
|
# If the number of processors is not available, assume one.
|
2012-06-16 11:37:17 +02:00
|
|
|
ifeq ($(BR2_JLEVEL),0)
|
|
|
|
PARALLEL_JOBS:=$(shell echo \
|
package-infra: limit the number of // jobs
The current code spawns as many jobs as up to twice the number of CPUs.
On small-class machines like laptops, with a limitted amount of memory,
but still a few CPUs (real or hyperthreads), the HDD becomes a bottleneck,
and it becomes almost impossible to do anythiong else while there is a
build in progress.
Limit the number of jobs to the number of CPUs plus one.
Even on fast machines with fast HDDs, this settings keeps the machine
fully busy (for those packages that can build in parallel, of course).
For example, building qemu or the linux kernel kept my hyperthreaded
hexa Core i7 with 18GiB of RAM, busy at 99% (I never ever managed to
get 100% even with more jobs, not even 200); while on my hyperthreaded
dual Core i5 with only 4GiB and a slow HDD, I still topped at 100% CPU,
while still able to do some work involving the HDD.
If the number of processors is not available, assume one.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Nathan Lynch <ntl@pobox.com>
Reviewed-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Nathan Lynch <ntl@pobox.com>
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
2013-05-10 05:56:01 +02:00
|
|
|
$$((1 + `getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1`)))
|
2012-06-16 11:37:17 +02:00
|
|
|
else
|
2012-06-11 18:09:37 +02:00
|
|
|
PARALLEL_JOBS:=$(BR2_JLEVEL)
|
2012-06-16 11:37:17 +02:00
|
|
|
endif
|
2012-06-11 18:09:37 +02:00
|
|
|
|
2008-07-11 15:43:59 +02:00
|
|
|
MAKE1:=$(HOSTMAKE) -j1
|
2012-06-11 18:09:37 +02:00
|
|
|
MAKE:=$(HOSTMAKE) -j$(PARALLEL_JOBS)
|
2008-07-01 15:30:26 +02:00
|
|
|
|
2012-06-08 03:52:16 +02:00
|
|
|
# Compute GNU_TARGET_NAME
|
2013-07-20 14:52:14 +02:00
|
|
|
GNU_TARGET_NAME=$(ARCH)-buildroot-$(TARGET_OS)-$(LIBC)$(ABI)
|
|
|
|
|
|
|
|
# Blackfin FLAT needs uclinux
|
|
|
|
ifeq ($(BR2_bfin)$(BR2_BINFMT_FLAT),yy)
|
|
|
|
TARGET_OS=uclinux
|
|
|
|
else
|
|
|
|
TARGET_OS=linux
|
|
|
|
endif
|
2010-12-28 20:10:27 +01:00
|
|
|
|
2013-06-30 21:29:09 +02:00
|
|
|
ifeq ($(BR2_TOOLCHAIN_USES_UCLIBC),y)
|
2010-12-28 20:10:27 +01:00
|
|
|
LIBC=uclibc
|
|
|
|
else
|
|
|
|
LIBC=gnu
|
|
|
|
endif
|
|
|
|
|
|
|
|
# The ABI suffix is a bit special on ARM, as it needs to be
|
2013-07-14 00:27:31 +02:00
|
|
|
# -uclibcgnueabi for uClibc EABI, and -gnueabi for glibc EABI.
|
|
|
|
# This means that the LIBC and ABI aren't strictly orthogonal,
|
|
|
|
# which explains why we need the test on LIBC below.
|
|
|
|
ifeq ($(BR2_arm)$(BR2_armeb),y)
|
2010-12-28 20:10:27 +01:00
|
|
|
ifeq ($(LIBC),uclibc)
|
|
|
|
ABI=gnueabi
|
|
|
|
else
|
|
|
|
ABI=eabi
|
|
|
|
endif
|
2013-08-23 20:40:16 +02:00
|
|
|
|
|
|
|
ifeq ($(BR2_ARM_EABIHF),y)
|
|
|
|
ABI:=$(ABI)hf
|
arch: improve ARM floating point support and add support for EABIhf
This commit introduces the support for the EABIhf ABI, next to the
existing support we have for EABI and OABI (even though OABI support
is deprecated). EABIhf allows to improve performance of floating point
workload by using floating point registers to transfer floating point
arguments when calling functions, instead of using integer registers
to do, as is done in the 'softfp' floating point model of EABI.
In addition to this, this commit introduces a list of options for the
floating point support:
* Software floating point
* VFP
* VFPv3
* VFPv3-D16
* VFPv4
* VFPv4-D16
and it introduces some logic to make sure the options are only visible
when it makes sense, depending on the ARM core being selected. This is
however made complicated by the fact that certain VFP capabilities are
mandatory on some cores, but optional on some other cores. The kconfig
logic tries to achieve the following goals:
* Hide options that are definitely not possible.
* Use safe default values (i.e for Cortex-A5 and A7, the presence of
the VFPv4 unit is optional, so we default on software floating
point on these cores)..
* Show the available possibilities, even if some of them are not
necessarily working on a particular core (again, for the Cortex-A5
and A7 cores, there is no way of knowing whether the particular
variant used by the user has VFPv4 or not, so we select software
floating point by default, but still show VFP/VFPv3/VFPv4 options).
It is worth noting that this commit doesn't add support for all
possible -mfpu= values on ARM. We haven't added support for fpa, fpe2,
fpe3, maverick (those four are only used on very old ARM cores), for
vfpv3-fp16, vfpv3-d16-fp16, vfpv3xd, vfpv3xd-fp16, neon-fp16,
vfpv4-sp-d16. They can be added quite easily if needed thanks to the
new organization of the Config.in options.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
2013-07-16 10:03:14 +02:00
|
|
|
endif
|
2010-12-28 20:10:27 +01:00
|
|
|
endif
|
|
|
|
|
2012-01-05 20:31:43 +01:00
|
|
|
# For FSL PowerPC there's SPE
|
|
|
|
ifeq ($(BR2_powerpc_SPE),y)
|
|
|
|
ABI=spe
|
|
|
|
# MPC8540s are e500v1 with single precision FP
|
|
|
|
ifeq ($(BR2_powerpc_8540),y)
|
|
|
|
TARGET_ABI+=-mabi=spe -mfloat-gprs=single -Wa,-me500
|
|
|
|
endif
|
|
|
|
ifeq ($(BR2_powerpc_8548),y)
|
|
|
|
TARGET_ABI+=-mabi=spe -mfloat-gprs=double -Wa,-me500x2
|
|
|
|
endif
|
|
|
|
ifeq ($(BR2_powerpc_e500mc),y)
|
|
|
|
TARGET_ABI+=-mabi=spe -mfloat-gprs=double -Wa,-me500mc
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2012-12-05 20:36:36 +01:00
|
|
|
# Use longcalls option for Xtensa globally.
|
|
|
|
# The 'longcalls' option allows calls across a greater range of addresses,
|
|
|
|
# and is required for some packages. While this option can degrade both
|
|
|
|
# code size and performance, the linker can usually optimize away the
|
|
|
|
# overhead when a call ends up within a certain range.
|
|
|
|
ifeq ($(BR2_xtensa),y)
|
|
|
|
TARGET_ABI += -mlongcalls
|
|
|
|
endif
|
|
|
|
|
2012-07-15 03:12:05 +02:00
|
|
|
STAGING_SUBDIR = usr/$(GNU_TARGET_NAME)/sysroot
|
|
|
|
STAGING_DIR = $(HOST_DIR)/$(STAGING_SUBDIR)
|
2010-12-28 20:10:27 +01:00
|
|
|
|
2012-04-17 06:45:31 +02:00
|
|
|
TARGET_OPTIMIZATION:=$(call qstrip,$(BR2_TARGET_OPTIMIZATION))
|
|
|
|
|
2008-03-12 14:07:10 +01:00
|
|
|
ifeq ($(BR2_OPTIMIZE_0),y)
|
2009-02-01 17:10:47 +01:00
|
|
|
TARGET_OPTIMIZATION+=-O0
|
2008-03-12 14:07:10 +01:00
|
|
|
endif
|
|
|
|
ifeq ($(BR2_OPTIMIZE_1),y)
|
2009-02-01 17:10:47 +01:00
|
|
|
TARGET_OPTIMIZATION+=-O1
|
2008-03-12 14:07:10 +01:00
|
|
|
endif
|
|
|
|
ifeq ($(BR2_OPTIMIZE_2),y)
|
2009-02-01 17:10:47 +01:00
|
|
|
TARGET_OPTIMIZATION+=-O2
|
2008-03-12 14:07:10 +01:00
|
|
|
endif
|
|
|
|
ifeq ($(BR2_OPTIMIZE_3),y)
|
2009-02-01 17:10:47 +01:00
|
|
|
TARGET_OPTIMIZATION+=-O3
|
2008-03-12 14:07:10 +01:00
|
|
|
endif
|
|
|
|
ifeq ($(BR2_OPTIMIZE_S),y)
|
2009-02-01 17:10:47 +01:00
|
|
|
TARGET_OPTIMIZATION+=-Os
|
2008-03-12 14:07:10 +01:00
|
|
|
endif
|
|
|
|
ifeq ($(BR2_DEBUG_1),y)
|
|
|
|
TARGET_DEBUGGING=-g1
|
|
|
|
endif
|
|
|
|
ifeq ($(BR2_DEBUG_2),y)
|
|
|
|
TARGET_DEBUGGING=-g2
|
|
|
|
endif
|
|
|
|
ifeq ($(BR2_DEBUG_3),y)
|
|
|
|
TARGET_DEBUGGING=-g3
|
|
|
|
endif
|
|
|
|
|
2008-08-04 21:07:18 +02:00
|
|
|
ifeq ($(BR2_LARGEFILE),y)
|
2012-07-25 19:40:46 +02:00
|
|
|
TARGET_CPPFLAGS += -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
|
2008-08-04 21:07:18 +02:00
|
|
|
endif
|
|
|
|
|
2012-07-25 19:40:46 +02:00
|
|
|
TARGET_CFLAGS = $(TARGET_CPPFLAGS) $(TARGET_ABI) $(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING)
|
2012-10-11 09:01:10 +02:00
|
|
|
TARGET_CXXFLAGS = $(TARGET_CFLAGS)
|
|
|
|
TARGET_LDFLAGS = $(call qstrip,$(BR2_TARGET_LDFLAGS))
|
2007-06-20 13:26:36 +02:00
|
|
|
|
2013-05-03 02:39:38 +02:00
|
|
|
ifeq ($(BR2_BINFMT_FLAT),y)
|
2013-09-11 14:53:44 +02:00
|
|
|
TARGET_CFLAGS += $(if $($(PKG)_FLAT_STACKSIZE),-Wl$(comma)-elf2flt=-s$($(PKG)_FLAT_STACKSIZE),\
|
|
|
|
-Wl$(comma)-elf2flt)
|
|
|
|
TARGET_CXXFLAGS += $(if $($(PKG)_FLAT_STACKSIZE),-Wl$(comma)-elf2flt=-s$($(PKG)_FLAT_STACKSIZE),\
|
|
|
|
-Wl$(comma)-elf2flt)
|
|
|
|
TARGET_LDFLAGS += $(if $($(PKG)_FLAT_STACKSIZE),-elf2flt=-s$($(PKG)_FLAT_STACKSIZE),-elf2flt)
|
2013-05-03 02:39:38 +02:00
|
|
|
endif
|
|
|
|
|
2013-05-03 12:39:37 +02:00
|
|
|
ifeq ($(BR2_BINFMT_FLAT_SHARED),y)
|
|
|
|
TARGET_LDFLAGS += -mid-shared-library -mshared-library-id=0
|
|
|
|
TARGET_CFLAGS += -mid-shared-library -mshared-library-id=0
|
|
|
|
TARGET_CXXFLAGS += -mid-shared-library -mshared-library-id=0
|
|
|
|
endif
|
|
|
|
ifeq ($(BR2_BINFMT_FLAT_SEP_DATA),y)
|
|
|
|
TARGET_LDFLAGS += -msep-data
|
|
|
|
TARGET_CFLAGS += -msep-data
|
|
|
|
TARGET_CXXFLAGS += -msep-data
|
|
|
|
endif
|
|
|
|
|
2013-09-02 18:06:36 +02:00
|
|
|
ifeq ($(BR2_ENABLE_SSP),y)
|
2013-07-04 20:30:26 +02:00
|
|
|
TARGET_CFLAGS += -fstack-protector-all
|
|
|
|
TARGET_CXXFLAGS += -fstack-protector-all
|
|
|
|
endif
|
|
|
|
|
2011-01-25 16:06:43 +01:00
|
|
|
ifeq ($(BR2_TOOLCHAIN_BUILDROOT)$(BR2_TOOLCHAIN_CTNG),y)
|
2012-06-08 03:52:16 +02:00
|
|
|
TARGET_CROSS=$(HOST_DIR)/usr/bin/$(GNU_TARGET_NAME)-
|
2010-10-15 23:01:08 +02:00
|
|
|
else
|
2011-04-29 13:09:26 +02:00
|
|
|
TARGET_CROSS=$(HOST_DIR)/usr/bin/$(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_PREFIX))-
|
2007-02-06 19:19:38 +01:00
|
|
|
endif
|
2010-06-25 15:04:08 +02:00
|
|
|
|
2010-06-20 15:06:30 +02:00
|
|
|
# Quotes are needed for spaces et al in path components.
|
|
|
|
TARGET_PATH="$(HOST_DIR)/bin:$(HOST_DIR)/usr/bin:$(HOST_DIR)/usr/sbin/:$(PATH)"
|
|
|
|
|
2013-09-02 18:06:27 +02:00
|
|
|
# Define TARGET_xx variables for all common binutils/gcc
|
2010-06-25 15:04:08 +02:00
|
|
|
TARGET_AR = $(TARGET_CROSS)ar
|
|
|
|
TARGET_AS = $(TARGET_CROSS)as
|
2011-05-02 23:58:20 +02:00
|
|
|
TARGET_CC = $(TARGET_CROSS)gcc
|
|
|
|
TARGET_CPP = $(TARGET_CROSS)cpp
|
|
|
|
TARGET_CXX = $(TARGET_CROSS)g++
|
|
|
|
TARGET_FC = $(TARGET_CROSS)gfortran
|
|
|
|
TARGET_LD = $(TARGET_CROSS)ld
|
2010-06-25 15:04:08 +02:00
|
|
|
TARGET_NM = $(TARGET_CROSS)nm
|
|
|
|
TARGET_RANLIB = $(TARGET_CROSS)ranlib
|
2012-11-07 06:01:20 +01:00
|
|
|
TARGET_READELF = $(TARGET_CROSS)readelf
|
2010-06-25 15:04:08 +02:00
|
|
|
TARGET_OBJCOPY = $(TARGET_CROSS)objcopy
|
|
|
|
TARGET_OBJDUMP = $(TARGET_CROSS)objdump
|
|
|
|
|
2010-12-07 21:09:56 +01:00
|
|
|
TARGET_CC_NOCCACHE := $(TARGET_CC)
|
|
|
|
TARGET_CXX_NOCCACHE := $(TARGET_CXX)
|
|
|
|
|
|
|
|
ifeq ($(BR2_CCACHE),y)
|
|
|
|
TARGET_CC := $(CCACHE) $(TARGET_CC)
|
|
|
|
TARGET_CXX := $(CCACHE) $(TARGET_CXX)
|
|
|
|
endif
|
|
|
|
|
2007-07-31 20:06:50 +02:00
|
|
|
ifeq ($(BR2_STRIP_strip),y)
|
2012-11-20 08:18:11 +01:00
|
|
|
STRIP_STRIP_DEBUG:=--strip-debug
|
2007-08-21 03:53:57 +02:00
|
|
|
STRIP_STRIP_UNNEEDED:=--strip-unneeded
|
2007-08-22 14:35:41 +02:00
|
|
|
STRIP_STRIP_ALL:=--strip-all
|
2007-10-01 18:15:31 +02:00
|
|
|
TARGET_STRIP=$(TARGET_CROSS)strip
|
2010-11-30 16:19:59 +01:00
|
|
|
STRIPCMD=$(TARGET_CROSS)strip --remove-section=.comment --remove-section=.note
|
|
|
|
KSTRIPCMD=$(STRIPCMD) $(STRIP_STRIP_UNNEEDED)
|
2007-07-31 20:06:50 +02:00
|
|
|
endif
|
|
|
|
ifeq ($(BR2_STRIP_sstrip),y)
|
2012-11-20 08:18:11 +01:00
|
|
|
STRIP_STRIP_DEBUG:=
|
2007-08-21 03:53:57 +02:00
|
|
|
STRIP_STRIP_UNNEEDED:=
|
|
|
|
STRIP_STRIP_ALL:=
|
2012-06-08 03:52:16 +02:00
|
|
|
TARGET_STRIP=$(HOST_DIR)/usr/bin/$(GNU_TARGET_NAME)-sstrip
|
2007-10-01 18:15:31 +02:00
|
|
|
STRIPCMD=$(TARGET_STRIP)
|
2010-11-30 16:19:59 +01:00
|
|
|
KSTRIPCMD=$(TARGET_CROSS)strip --remove-section=.comment --remove-section=.note --strip-unneeded
|
2007-07-31 20:06:50 +02:00
|
|
|
endif
|
|
|
|
ifeq ($(BR2_STRIP_none),y)
|
2010-01-27 02:09:04 +01:00
|
|
|
TARGET_STRIP=true
|
2007-10-01 18:15:31 +02:00
|
|
|
STRIPCMD=$(TARGET_STRIP)
|
2010-11-30 16:19:59 +01:00
|
|
|
KSTRIPCMD=$(TARGET_STRIP)
|
2007-07-31 20:06:50 +02:00
|
|
|
endif
|
2009-08-26 09:52:51 +02:00
|
|
|
INSTALL:=$(shell which install || type -p install)
|
2009-01-01 22:20:35 +01:00
|
|
|
FLEX:=$(shell which flex || type -p flex)
|
|
|
|
BISON:=$(shell which bison || type -p bison)
|
2010-09-30 23:09:39 +02:00
|
|
|
SED:=$(shell which sed || type -p sed) -i -e
|
2004-10-09 03:06:03 +02:00
|
|
|
|
2012-07-25 19:40:46 +02:00
|
|
|
HOST_CPPFLAGS = -I$(HOST_DIR)/usr/include
|
2010-10-29 21:00:26 +02:00
|
|
|
HOST_CFLAGS ?= -O2
|
2012-07-25 19:40:46 +02:00
|
|
|
HOST_CFLAGS += $(HOST_CPPFLAGS)
|
|
|
|
HOST_CXXFLAGS += $(HOST_CFLAGS)
|
Solve the host tools relying on host libraries problem
We build host tools installed in $(HOST_DIR)/usr/bin, and some of them
rely on host libraries in $(HOST_DIR)/usr/lib. So when these host
tools are executed, they need to find the host libraries, which are
not installed in a default location.
In c1b6242fdcf2cff7ebf09fec4cc1be58963e8427 we tried to use
LD_LIBRARY_PATH when building target packages to solve this
problem. Unfortunately, LD_LIBRARY_PATH is not only used to find
libraries at run-time, but also at compile time. So it leads the build
of some packages, such as icu, to fail.
Therefore, in 0d1830b07db4ebfd14e77a258de6fb391e57e960, we reverted
the LD_LIBRARY_PATH idea.
The other option to solve this problem was to hardcode a RPATH value
in the host binaries that would reference the location of host
libraries. We added this -Wl,-rpath option to HOST_CFLAGS in
6b939d40f6a29a43277566adc9d4312d49cb3abf. Unfortunately, this caused
problems when building binutils, as reported in bug 1789 so this
change was reverted in e1a7d916e9eeaa215551740de40c055130d6c073.
Then, we tried to use -Wl,-rpath in HOST_LDFLAGS, but it was causing
problems with fakeroot not recognizing 'ld' as the GNU linker, since
the -Wl,-rpath cannot be understood by 'ld' directly, only by 'gcc'.
This commit is a new attempt at using HOST_LDFLAGS, but in this case
we modified the definition of HOST_LD to *not* contain
HOST_LDFLAGS. LDFLAGS are being set separatly. It solved the fakeroot
issue and was tested against nearly 300 packages of Buildroot.
For more details on this story, see
http://lists.busybox.net/pipermail/buildroot/2010-June/035580.html
http://lists.busybox.net/pipermail/buildroot/2010-June/035581.html
http://lists.busybox.net/pipermail/buildroot/2010-June/035586.html
http://lists.busybox.net/pipermail/buildroot/2010-June/035609.html
https://bugs.busybox.net/show_bug.cgi?id=1789
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2010-06-25 14:15:20 +02:00
|
|
|
HOST_LDFLAGS += -L$(HOST_DIR)/lib -L$(HOST_DIR)/usr/lib -Wl,-rpath,$(HOST_DIR)/usr/lib
|
2009-03-17 14:48:15 +01:00
|
|
|
HOST_PATH=$(HOST_DIR)/bin:$(HOST_DIR)/usr/bin:$(PATH)
|
2009-03-16 21:58:08 +01:00
|
|
|
|
2009-01-19 10:18:46 +01:00
|
|
|
# hostcc version as an integer - E.G. 4.3.2 => 432
|
2010-12-07 21:09:56 +01:00
|
|
|
HOSTCC_VERSION:=$(shell $(HOSTCC_NOCCACHE) --version | \
|
2009-01-19 10:18:46 +01:00
|
|
|
sed -n 's/^.* \([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)[ ]*.*$$/\1\2\3/p')
|
|
|
|
|
2004-10-09 03:06:03 +02:00
|
|
|
TARGET_CONFIGURE_OPTS=PATH=$(TARGET_PATH) \
|
2007-09-29 16:27:39 +02:00
|
|
|
AR="$(TARGET_AR)" \
|
|
|
|
AS="$(TARGET_AS)" \
|
2008-11-28 15:20:47 +01:00
|
|
|
LD="$(TARGET_LD)" \
|
2007-09-29 16:27:39 +02:00
|
|
|
NM="$(TARGET_NM)" \
|
2010-06-25 15:04:08 +02:00
|
|
|
CC="$(TARGET_CC)" \
|
|
|
|
GCC="$(TARGET_CC)" \
|
|
|
|
CPP="$(TARGET_CPP)" \
|
|
|
|
CXX="$(TARGET_CXX)" \
|
|
|
|
FC="$(TARGET_FC)" \
|
2007-09-29 16:27:39 +02:00
|
|
|
RANLIB="$(TARGET_RANLIB)" \
|
2012-11-07 06:01:20 +01:00
|
|
|
READELF="$(TARGET_READELF)" \
|
2007-09-29 16:27:39 +02:00
|
|
|
STRIP="$(TARGET_STRIP)" \
|
|
|
|
OBJCOPY="$(TARGET_OBJCOPY)" \
|
2010-11-25 18:38:31 +01:00
|
|
|
OBJDUMP="$(TARGET_OBJDUMP)" \
|
2007-06-20 13:26:36 +02:00
|
|
|
AR_FOR_BUILD="$(HOSTAR)" \
|
|
|
|
AS_FOR_BUILD="$(HOSTAS)" \
|
|
|
|
CC_FOR_BUILD="$(HOSTCC)" \
|
2007-09-28 21:49:13 +02:00
|
|
|
GCC_FOR_BUILD="$(HOSTCC)" \
|
2007-06-20 13:26:36 +02:00
|
|
|
CXX_FOR_BUILD="$(HOSTCXX)" \
|
2007-09-28 22:10:22 +02:00
|
|
|
FC_FOR_BUILD="$(HOSTFC)" \
|
2007-06-20 13:26:36 +02:00
|
|
|
LD_FOR_BUILD="$(HOSTLD)" \
|
2012-07-25 19:40:46 +02:00
|
|
|
CPPFLAGS_FOR_BUILD="$(HOST_CPPFLAGS)" \
|
2007-06-20 13:26:36 +02:00
|
|
|
CFLAGS_FOR_BUILD="$(HOST_CFLAGS)" \
|
2007-08-10 21:07:51 +02:00
|
|
|
CXXFLAGS_FOR_BUILD="$(HOST_CXXFLAGS)" \
|
2007-06-20 13:26:36 +02:00
|
|
|
LDFLAGS_FOR_BUILD="$(HOST_LDFLAGS)" \
|
2007-09-28 22:10:22 +02:00
|
|
|
FCFLAGS_FOR_BUILD="$(HOST_FCFLAGS)" \
|
2007-09-29 16:27:39 +02:00
|
|
|
DEFAULT_ASSEMBLER="$(TARGET_AS)" \
|
|
|
|
DEFAULT_LINKER="$(TARGET_LD)" \
|
2012-07-25 19:40:46 +02:00
|
|
|
CPPFLAGS="$(TARGET_CPPFLAGS)" \
|
2010-06-25 23:26:04 +02:00
|
|
|
CFLAGS="$(TARGET_CFLAGS)" \
|
|
|
|
CXXFLAGS="$(TARGET_CXXFLAGS)" \
|
|
|
|
LDFLAGS="$(TARGET_LDFLAGS)" \
|
|
|
|
FCFLAGS="$(TARGET_FCFLAGS)" \
|
2009-03-19 09:30:20 +01:00
|
|
|
PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \
|
2010-02-21 13:16:28 +01:00
|
|
|
PERLLIB="$(HOST_DIR)/usr/lib/perl" \
|
2007-08-10 21:07:51 +02:00
|
|
|
STAGING_DIR="$(STAGING_DIR)"
|
2007-06-20 13:26:36 +02:00
|
|
|
|
2010-02-20 18:20:38 +01:00
|
|
|
TARGET_MAKE_ENV=PATH=$(TARGET_PATH) \
|
2010-02-21 13:16:28 +01:00
|
|
|
PERLLIB="$(HOST_DIR)/usr/lib/perl"
|
2009-12-15 13:39:40 +01:00
|
|
|
|
2009-03-17 14:48:15 +01:00
|
|
|
HOST_CONFIGURE_OPTS=PATH=$(HOST_PATH) \
|
2007-09-28 21:49:13 +02:00
|
|
|
AR="$(HOSTAR)" \
|
|
|
|
AS="$(HOSTAS)" \
|
Solve the host tools relying on host libraries problem
We build host tools installed in $(HOST_DIR)/usr/bin, and some of them
rely on host libraries in $(HOST_DIR)/usr/lib. So when these host
tools are executed, they need to find the host libraries, which are
not installed in a default location.
In c1b6242fdcf2cff7ebf09fec4cc1be58963e8427 we tried to use
LD_LIBRARY_PATH when building target packages to solve this
problem. Unfortunately, LD_LIBRARY_PATH is not only used to find
libraries at run-time, but also at compile time. So it leads the build
of some packages, such as icu, to fail.
Therefore, in 0d1830b07db4ebfd14e77a258de6fb391e57e960, we reverted
the LD_LIBRARY_PATH idea.
The other option to solve this problem was to hardcode a RPATH value
in the host binaries that would reference the location of host
libraries. We added this -Wl,-rpath option to HOST_CFLAGS in
6b939d40f6a29a43277566adc9d4312d49cb3abf. Unfortunately, this caused
problems when building binutils, as reported in bug 1789 so this
change was reverted in e1a7d916e9eeaa215551740de40c055130d6c073.
Then, we tried to use -Wl,-rpath in HOST_LDFLAGS, but it was causing
problems with fakeroot not recognizing 'ld' as the GNU linker, since
the -Wl,-rpath cannot be understood by 'ld' directly, only by 'gcc'.
This commit is a new attempt at using HOST_LDFLAGS, but in this case
we modified the definition of HOST_LD to *not* contain
HOST_LDFLAGS. LDFLAGS are being set separatly. It solved the fakeroot
issue and was tested against nearly 300 packages of Buildroot.
For more details on this story, see
http://lists.busybox.net/pipermail/buildroot/2010-June/035580.html
http://lists.busybox.net/pipermail/buildroot/2010-June/035581.html
http://lists.busybox.net/pipermail/buildroot/2010-June/035586.html
http://lists.busybox.net/pipermail/buildroot/2010-June/035609.html
https://bugs.busybox.net/show_bug.cgi?id=1789
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2010-06-25 14:15:20 +02:00
|
|
|
LD="$(HOSTLD)" \
|
2007-09-28 21:49:13 +02:00
|
|
|
NM="$(HOSTNM)" \
|
2010-06-25 14:25:42 +02:00
|
|
|
CC="$(HOSTCC)" \
|
|
|
|
GCC="$(HOSTCC)" \
|
|
|
|
CXX="$(HOSTCXX)" \
|
|
|
|
CPP="$(HOSTCPP)" \
|
2012-07-25 19:40:46 +02:00
|
|
|
CPPFLAGS="$(HOST_CPPFLAGS)" \
|
2010-06-25 14:25:42 +02:00
|
|
|
CFLAGS="$(HOST_CFLAGS)" \
|
|
|
|
CXXFLAGS="$(HOST_CXXFLAGS)" \
|
Solve the host tools relying on host libraries problem
We build host tools installed in $(HOST_DIR)/usr/bin, and some of them
rely on host libraries in $(HOST_DIR)/usr/lib. So when these host
tools are executed, they need to find the host libraries, which are
not installed in a default location.
In c1b6242fdcf2cff7ebf09fec4cc1be58963e8427 we tried to use
LD_LIBRARY_PATH when building target packages to solve this
problem. Unfortunately, LD_LIBRARY_PATH is not only used to find
libraries at run-time, but also at compile time. So it leads the build
of some packages, such as icu, to fail.
Therefore, in 0d1830b07db4ebfd14e77a258de6fb391e57e960, we reverted
the LD_LIBRARY_PATH idea.
The other option to solve this problem was to hardcode a RPATH value
in the host binaries that would reference the location of host
libraries. We added this -Wl,-rpath option to HOST_CFLAGS in
6b939d40f6a29a43277566adc9d4312d49cb3abf. Unfortunately, this caused
problems when building binutils, as reported in bug 1789 so this
change was reverted in e1a7d916e9eeaa215551740de40c055130d6c073.
Then, we tried to use -Wl,-rpath in HOST_LDFLAGS, but it was causing
problems with fakeroot not recognizing 'ld' as the GNU linker, since
the -Wl,-rpath cannot be understood by 'ld' directly, only by 'gcc'.
This commit is a new attempt at using HOST_LDFLAGS, but in this case
we modified the definition of HOST_LD to *not* contain
HOST_LDFLAGS. LDFLAGS are being set separatly. It solved the fakeroot
issue and was tested against nearly 300 packages of Buildroot.
For more details on this story, see
http://lists.busybox.net/pipermail/buildroot/2010-June/035580.html
http://lists.busybox.net/pipermail/buildroot/2010-June/035581.html
http://lists.busybox.net/pipermail/buildroot/2010-June/035586.html
http://lists.busybox.net/pipermail/buildroot/2010-June/035609.html
https://bugs.busybox.net/show_bug.cgi?id=1789
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2010-06-25 14:15:20 +02:00
|
|
|
LDFLAGS="$(HOST_LDFLAGS)" \
|
2010-05-01 14:10:28 +02:00
|
|
|
PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 \
|
|
|
|
PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 \
|
2009-03-19 09:30:20 +01:00
|
|
|
PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \
|
2011-01-30 00:33:00 +01:00
|
|
|
PKG_CONFIG_SYSROOT_DIR="/" \
|
2011-03-27 21:20:04 +02:00
|
|
|
PKG_CONFIG_LIBDIR="$(HOST_DIR)/usr/lib/pkgconfig:$(HOST_DIR)/usr/share/pkgconfig" \
|
2010-05-01 14:10:28 +02:00
|
|
|
PERLLIB="$(HOST_DIR)/usr/lib/perl" \
|
|
|
|
LD_LIBRARY_PATH="$(HOST_DIR)/usr/lib:$(LD_LIBRARY_PATH)"
|
2009-08-25 14:03:33 +02:00
|
|
|
|
|
|
|
HOST_MAKE_ENV=PATH=$(HOST_PATH) \
|
2010-02-20 18:20:38 +01:00
|
|
|
LD_LIBRARY_PATH="$(HOST_DIR)/usr/lib:$(LD_LIBRARY_PATH)" \
|
2009-08-25 14:03:33 +02:00
|
|
|
PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \
|
2012-04-04 14:50:19 +02:00
|
|
|
PKG_CONFIG_SYSROOT_DIR="/" \
|
2010-02-21 13:16:28 +01:00
|
|
|
PKG_CONFIG_LIBDIR="$(HOST_DIR)/usr/lib/pkgconfig" \
|
|
|
|
PERLLIB="$(HOST_DIR)/usr/lib/perl"
|
2007-06-20 13:26:36 +02:00
|
|
|
|
2009-03-17 14:48:15 +01:00
|
|
|
|
2013-06-07 12:13:46 +02:00
|
|
|
################################################################################
|
2007-06-27 11:48:23 +02:00
|
|
|
# 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_powerpc)$(BR2_ENDIAN),yBIG)
|
|
|
|
BR2_AC_CV_TRAP_CHECK=ac_cv_lbl_unaligned_fail=no
|
|
|
|
endif
|
|
|
|
|
2007-06-27 14:01:27 +02:00
|
|
|
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
|
|
|
|
|
2007-06-27 11:48:23 +02:00
|
|
|
TARGET_CONFIGURE_ARGS= \
|
|
|
|
$(BR2_AC_CV_TRAP_CHECK) \
|
2007-06-27 14:01:27 +02:00
|
|
|
ac_cv_func_mmap_fixed_mapped=yes \
|
|
|
|
ac_cv_func_memcmp_working=yes \
|
2008-11-28 15:20:47 +01:00
|
|
|
ac_cv_have_decl_malloc=yes \
|
|
|
|
gl_cv_func_malloc_0_nonnull=yes \
|
|
|
|
ac_cv_func_malloc_0_nonnull=yes \
|
|
|
|
ac_cv_func_calloc_0_nonnull=yes \
|
|
|
|
ac_cv_func_realloc_0_nonnull=yes \
|
2011-05-03 15:23:40 +02:00
|
|
|
lt_cv_sys_lib_search_path_spec="" \
|
2007-06-27 14:01:27 +02:00
|
|
|
$(BR2_AC_CV_C_BIGENDIAN)
|
2004-10-09 03:06:03 +02:00
|
|
|
|
2013-06-07 12:13:46 +02:00
|
|
|
################################################################################
|
2007-06-27 11:48:23 +02:00
|
|
|
|
2006-10-17 18:57:02 +02:00
|
|
|
ifeq ($(BR2_ENABLE_LOCALE),y)
|
2004-10-09 03:06:03 +02:00
|
|
|
DISABLE_NLS:=
|
|
|
|
else
|
|
|
|
DISABLE_NLS:=--disable-nls
|
|
|
|
endif
|
|
|
|
|
2006-12-21 14:51:53 +01:00
|
|
|
ifneq ($(BR2_LARGEFILE),y)
|
|
|
|
DISABLE_LARGEFILE= --disable-largefile
|
|
|
|
endif
|
|
|
|
|
2009-01-17 11:11:12 +01:00
|
|
|
ifneq ($(BR2_HAVE_DOCUMENTATION),y)
|
2012-12-12 05:07:22 +01:00
|
|
|
# The configure option varies, but since unknown options are ignored
|
|
|
|
# we can pass all of them.
|
|
|
|
DISABLE_DOCUMENTATION = \
|
|
|
|
--disable-gtk-doc \
|
|
|
|
--disable-doc \
|
|
|
|
--disable-docs \
|
|
|
|
--disable-documentation \
|
|
|
|
--with-xmlto=no \
|
|
|
|
--with-fop=no
|
2009-01-17 11:11:12 +01:00
|
|
|
endif
|
|
|
|
|
2012-04-24 22:32:55 +02:00
|
|
|
ifeq ($(BR2_INET_IPV6),y)
|
|
|
|
DISABLE_IPV6= --enable-ipv6
|
|
|
|
else
|
2007-06-26 18:34:45 +02:00
|
|
|
DISABLE_IPV6= --disable-ipv6
|
|
|
|
endif
|
|
|
|
|
2010-12-13 17:27:41 +01:00
|
|
|
ifneq ($(BR2_INSTALL_LIBSTDCPP),y)
|
2009-05-04 21:19:59 +02:00
|
|
|
TARGET_CONFIGURE_OPTS+=CXX=false
|
2006-12-21 14:51:53 +01:00
|
|
|
endif
|
2004-10-09 03:06:03 +02:00
|
|
|
|
2008-03-11 19:15:30 +01:00
|
|
|
ifeq ($(BR2_ENABLE_DEBUG),y)
|
|
|
|
ENABLE_DEBUG:=--enable-debug
|
|
|
|
else
|
|
|
|
ENABLE_DEBUG:=
|
|
|
|
endif
|
2007-06-20 13:26:36 +02:00
|
|
|
|
package/autotools: add --{enable,disable}-{shared,static} automatically
For target packages, depending on BR2_PREFER_STATIC_LIB, add the
correct combination of --{enable,disable}-{shared,static} flags to
./configure calls.
* When BR2_PREFER_STATIC_LIB is enabled, we pass --enable-static
--disable-shared.
* When BR2_PREFER_STATIC_LIB is disabled, we pass --enable-static
--enable-shared. We enable static libraries since they can still be
useful to statically link applications against some libraries
(sometimes it is useful for size reasons). Static libraries are
anyway only installed in the STAGING_DIR, so it doesn't increase in
any way the size of the TARGET_DIR.
For host packages, always pass --enable-shared and --disable-static.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
2011-05-30 23:57:02 +02:00
|
|
|
ifeq ($(BR2_PREFER_STATIC_LIB),y)
|
|
|
|
SHARED_STATIC_LIBS_OPTS=--enable-static --disable-shared
|
2012-11-05 07:55:26 +01:00
|
|
|
TARGET_LDFLAGS += --static
|
package/autotools: add --{enable,disable}-{shared,static} automatically
For target packages, depending on BR2_PREFER_STATIC_LIB, add the
correct combination of --{enable,disable}-{shared,static} flags to
./configure calls.
* When BR2_PREFER_STATIC_LIB is enabled, we pass --enable-static
--disable-shared.
* When BR2_PREFER_STATIC_LIB is disabled, we pass --enable-static
--enable-shared. We enable static libraries since they can still be
useful to statically link applications against some libraries
(sometimes it is useful for size reasons). Static libraries are
anyway only installed in the STAGING_DIR, so it doesn't increase in
any way the size of the TARGET_DIR.
For host packages, always pass --enable-shared and --disable-static.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
2011-05-30 23:57:02 +02:00
|
|
|
else
|
|
|
|
SHARED_STATIC_LIBS_OPTS=--enable-static --enable-shared
|
|
|
|
endif
|
|
|
|
|
2012-04-17 16:45:19 +02:00
|
|
|
include package/pkg-utils.mk
|
|
|
|
include package/pkg-download.mk
|
2012-07-06 00:06:46 +02:00
|
|
|
include package/pkg-autotools.mk
|
|
|
|
include package/pkg-cmake.mk
|
|
|
|
include package/pkg-generic.mk
|