xref: /OK3568_Linux_fs/buildroot/package/Makefile.in (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyunifndef MAKE
2*4882a593SmuzhiyunMAKE := make
3*4882a593Smuzhiyunendif
4*4882a593Smuzhiyunifndef HOSTMAKE
5*4882a593SmuzhiyunHOSTMAKE = $(MAKE)
6*4882a593Smuzhiyunendif
7*4882a593SmuzhiyunHOSTMAKE := $(shell which $(HOSTMAKE) || type -p $(HOSTMAKE) || echo make)
8*4882a593Smuzhiyun
9*4882a593Smuzhiyun# If BR2_JLEVEL is 0, scale the maximum concurrency with the number of
10*4882a593Smuzhiyun# CPUs. An additional job is used in order to keep processors busy
11*4882a593Smuzhiyun# while waiting on I/O.
12*4882a593Smuzhiyun# If the number of processors is not available, assume one.
13*4882a593Smuzhiyunifeq ($(BR2_JLEVEL),0)
14*4882a593SmuzhiyunPARALLEL_JOBS := $(shell echo \
15*4882a593Smuzhiyun	$$((1 + `getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1`)))
16*4882a593Smuzhiyunelse
17*4882a593SmuzhiyunPARALLEL_JOBS := $(BR2_JLEVEL)
18*4882a593Smuzhiyunendif
19*4882a593Smuzhiyun
20*4882a593SmuzhiyunMAKE1 := $(HOSTMAKE) -j1
21*4882a593Smuzhiyunoverride MAKE = $(HOSTMAKE) \
22*4882a593Smuzhiyun	$(if $(findstring j,$(filter-out --%,$(MAKEFLAGS))),,-j$(PARALLEL_JOBS))
23*4882a593Smuzhiyun
24*4882a593Smuzhiyunifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
25*4882a593SmuzhiyunTARGET_VENDOR = $(call qstrip,$(BR2_TOOLCHAIN_BUILDROOT_VENDOR))
26*4882a593Smuzhiyunelse
27*4882a593SmuzhiyunTARGET_VENDOR = buildroot
28*4882a593Smuzhiyunendif
29*4882a593Smuzhiyun
30*4882a593Smuzhiyun# Sanity checks
31*4882a593Smuzhiyunifeq ($(TARGET_VENDOR),)
32*4882a593Smuzhiyun$(error BR2_TOOLCHAIN_BUILDROOT_VENDOR is not allowed to be empty)
33*4882a593Smuzhiyunendif
34*4882a593Smuzhiyunifeq ($(TARGET_VENDOR),unknown)
35*4882a593Smuzhiyun$(error BR2_TOOLCHAIN_BUILDROOT_VENDOR cannot be 'unknown'. \
36*4882a593Smuzhiyun	It might be confused with the native toolchain)
37*4882a593Smuzhiyunendif
38*4882a593Smuzhiyun
39*4882a593Smuzhiyun# Compute GNU_TARGET_NAME
40*4882a593SmuzhiyunGNU_TARGET_NAME = $(ARCH)-$(TARGET_VENDOR)-$(TARGET_OS)-$(LIBC)$(ABI)
41*4882a593Smuzhiyun
42*4882a593Smuzhiyun# FLAT binary format needs uclinux, except RISC-V 64-bits which needs
43*4882a593Smuzhiyun# the regular linux name.
44*4882a593Smuzhiyunifeq ($(BR2_BINFMT_FLAT):$(BR2_RISCV_64),y:)
45*4882a593SmuzhiyunTARGET_OS = uclinux
46*4882a593Smuzhiyunelse
47*4882a593SmuzhiyunTARGET_OS = linux
48*4882a593Smuzhiyunendif
49*4882a593Smuzhiyun
50*4882a593Smuzhiyunifeq ($(BR2_TOOLCHAIN_USES_UCLIBC),y)
51*4882a593SmuzhiyunLIBC = uclibc
52*4882a593Smuzhiyunelse ifeq ($(BR2_TOOLCHAIN_USES_MUSL),y)
53*4882a593SmuzhiyunLIBC = musl
54*4882a593Smuzhiyunelse
55*4882a593SmuzhiyunLIBC = gnu
56*4882a593Smuzhiyunendif
57*4882a593Smuzhiyun
58*4882a593Smuzhiyun# The ABI suffix is a bit special on ARM, as it needs to be
59*4882a593Smuzhiyun# -uclibcgnueabi for uClibc EABI, and -gnueabi for glibc EABI.
60*4882a593Smuzhiyun# This means that the LIBC and ABI aren't strictly orthogonal,
61*4882a593Smuzhiyun# which explains why we need the test on LIBC below.
62*4882a593Smuzhiyunifeq ($(BR2_arm)$(BR2_armeb),y)
63*4882a593Smuzhiyunifeq ($(LIBC),uclibc)
64*4882a593SmuzhiyunABI = gnueabi
65*4882a593Smuzhiyunelse
66*4882a593SmuzhiyunABI = eabi
67*4882a593Smuzhiyunendif
68*4882a593Smuzhiyun
69*4882a593Smuzhiyunifeq ($(BR2_ARM_EABIHF),y)
70*4882a593SmuzhiyunABI := $(ABI)hf
71*4882a593Smuzhiyunendif
72*4882a593Smuzhiyunendif
73*4882a593Smuzhiyun
74*4882a593Smuzhiyun# For C-SKY abiv1 & abiv2
75*4882a593Smuzhiyunifeq ($(BR2_csky),y)
76*4882a593Smuzhiyunifeq ($(BR2_ck610),y)
77*4882a593SmuzhiyunABI = abiv1
78*4882a593Smuzhiyunelse
79*4882a593SmuzhiyunABI = abiv2
80*4882a593Smuzhiyunendif
81*4882a593Smuzhiyunendif
82*4882a593Smuzhiyun
83*4882a593Smuzhiyun# For FSL PowerPC there's SPE
84*4882a593Smuzhiyunifeq ($(BR2_powerpc_SPE),y)
85*4882a593SmuzhiyunABI = spe
86*4882a593Smuzhiyun# MPC8540s are e500v1 with single precision FP
87*4882a593Smuzhiyunifeq ($(BR2_powerpc_8540),y)
88*4882a593SmuzhiyunTARGET_ABI += -mabi=spe -mfloat-gprs=single -Wa,-me500
89*4882a593Smuzhiyunendif
90*4882a593Smuzhiyunifeq ($(BR2_powerpc_8548),y)
91*4882a593SmuzhiyunTARGET_ABI += -mabi=spe -mfloat-gprs=double -Wa,-me500x2
92*4882a593Smuzhiyunendif
93*4882a593Smuzhiyunifeq ($(BR2_powerpc_e500mc),y)
94*4882a593SmuzhiyunTARGET_ABI += -mabi=spe -mfloat-gprs=double -Wa,-me500mc
95*4882a593Smuzhiyunendif
96*4882a593Smuzhiyunendif
97*4882a593Smuzhiyun
98*4882a593Smuzhiyun# Use longcalls option for Xtensa globally.
99*4882a593Smuzhiyun# The 'longcalls' option allows calls across a greater range of addresses,
100*4882a593Smuzhiyun# and is required for some packages. While this option can degrade both
101*4882a593Smuzhiyun# code size and performance, the linker can usually optimize away the
102*4882a593Smuzhiyun# overhead when a call ends up within a certain range.
103*4882a593Smuzhiyun#
104*4882a593Smuzhiyun# Use auto-litpools for Xtensa globally.
105*4882a593Smuzhiyun# Collecting literals into separate section can be advantageous if that
106*4882a593Smuzhiyun# section is placed into DTCM at link time. This is applicable for code
107*4882a593Smuzhiyun# running on bare metal, but makes no sense under linux, where userspace
108*4882a593Smuzhiyun# is isolated from the physical memory details. OTOH placing literals into
109*4882a593Smuzhiyun# separate section breaks build of huge source files, because l32r
110*4882a593Smuzhiyun# instruction can only access literals in 256 KBytes range.
111*4882a593Smuzhiyun#
112*4882a593Smuzhiyunifeq ($(BR2_xtensa),y)
113*4882a593SmuzhiyunTARGET_ABI += -mlongcalls -mauto-litpools
114*4882a593Smuzhiyunendif
115*4882a593Smuzhiyun
116*4882a593SmuzhiyunSTAGING_SUBDIR = $(GNU_TARGET_NAME)/sysroot
117*4882a593SmuzhiyunSTAGING_DIR    = $(HOST_DIR)/$(STAGING_SUBDIR)
118*4882a593Smuzhiyun
119*4882a593Smuzhiyunifeq ($(BR2_OPTIMIZE_0),y)
120*4882a593SmuzhiyunTARGET_OPTIMIZATION = -O0
121*4882a593Smuzhiyunendif
122*4882a593Smuzhiyunifeq ($(BR2_OPTIMIZE_1),y)
123*4882a593SmuzhiyunTARGET_OPTIMIZATION = -O1
124*4882a593Smuzhiyunendif
125*4882a593Smuzhiyunifeq ($(BR2_OPTIMIZE_2),y)
126*4882a593SmuzhiyunTARGET_OPTIMIZATION = -O2
127*4882a593Smuzhiyunendif
128*4882a593Smuzhiyunifeq ($(BR2_OPTIMIZE_3),y)
129*4882a593SmuzhiyunTARGET_OPTIMIZATION = -O3
130*4882a593Smuzhiyunendif
131*4882a593Smuzhiyunifeq ($(BR2_OPTIMIZE_G),y)
132*4882a593SmuzhiyunTARGET_OPTIMIZATION = -Og
133*4882a593Smuzhiyunendif
134*4882a593Smuzhiyunifeq ($(BR2_OPTIMIZE_S),y)
135*4882a593SmuzhiyunTARGET_OPTIMIZATION = -Os
136*4882a593Smuzhiyunendif
137*4882a593Smuzhiyunifeq ($(BR2_OPTIMIZE_FAST),y)
138*4882a593SmuzhiyunTARGET_OPTIMIZATION = -Ofast
139*4882a593Smuzhiyunendif
140*4882a593Smuzhiyunifeq ($(BR2_ENABLE_DEBUG),)
141*4882a593SmuzhiyunTARGET_DEBUGGING = -g0
142*4882a593Smuzhiyunendif
143*4882a593Smuzhiyunifeq ($(BR2_DEBUG_1),y)
144*4882a593SmuzhiyunTARGET_DEBUGGING = -g1
145*4882a593Smuzhiyunendif
146*4882a593Smuzhiyunifeq ($(BR2_DEBUG_2),y)
147*4882a593SmuzhiyunTARGET_DEBUGGING = -g2
148*4882a593Smuzhiyunendif
149*4882a593Smuzhiyunifeq ($(BR2_DEBUG_3),y)
150*4882a593SmuzhiyunTARGET_DEBUGGING = -g3
151*4882a593Smuzhiyunendif
152*4882a593Smuzhiyun
153*4882a593SmuzhiyunTARGET_LDFLAGS = $(call qstrip,$(BR2_TARGET_LDFLAGS))
154*4882a593Smuzhiyun
155*4882a593Smuzhiyun# By design, _FORTIFY_SOURCE requires gcc optimization to be enabled.
156*4882a593Smuzhiyun# Therefore, we need to pass _FORTIFY_SOURCE and the optimization level
157*4882a593Smuzhiyun# through the same mechanism, i.e currently through CFLAGS. Passing
158*4882a593Smuzhiyun# _FORTIFY_SOURCE through the wrapper and the optimization level
159*4882a593Smuzhiyun# through CFLAGS would not work, because CFLAGS are sometimes
160*4882a593Smuzhiyun# ignored/overridden by packages, but the flags passed by the wrapper
161*4882a593Smuzhiyun# are enforced: this would cause _FORTIFY_SOURCE to be used without any
162*4882a593Smuzhiyun# optimization level, leading to a build / configure failure. So we keep
163*4882a593Smuzhiyun# passing _FORTIFY_SOURCE and the optimization level both through CFLAGS.
164*4882a593Smuzhiyunifeq ($(BR2_FORTIFY_SOURCE_1),y)
165*4882a593SmuzhiyunTARGET_HARDENED += -D_FORTIFY_SOURCE=1
166*4882a593Smuzhiyunelse ifeq ($(BR2_FORTIFY_SOURCE_2),y)
167*4882a593SmuzhiyunTARGET_HARDENED += -D_FORTIFY_SOURCE=2
168*4882a593Smuzhiyunendif
169*4882a593Smuzhiyun
170*4882a593SmuzhiyunTARGET_CPPFLAGS += -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
171*4882a593SmuzhiyunTARGET_CFLAGS = $(TARGET_CPPFLAGS) $(TARGET_ABI) $(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING) $(TARGET_HARDENED)
172*4882a593SmuzhiyunTARGET_CXXFLAGS = $(TARGET_CPPFLAGS) $(TARGET_ABI) $(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING) $(TARGET_HARDENED)
173*4882a593SmuzhiyunTARGET_FCFLAGS = $(TARGET_ABI) $(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING)
174*4882a593Smuzhiyun
175*4882a593Smuzhiyun# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79509
176*4882a593Smuzhiyunifeq ($(BR2_m68k_cf),y)
177*4882a593SmuzhiyunTARGET_CFLAGS += -fno-dwarf2-cfi-asm
178*4882a593SmuzhiyunTARGET_CXXFLAGS += -fno-dwarf2-cfi-asm
179*4882a593Smuzhiyunendif
180*4882a593Smuzhiyun
181*4882a593Smuzhiyunifeq ($(BR2_BINFMT_FLAT),y)
182*4882a593Smuzhiyunifeq ($(BR2_RISCV_64),y)
183*4882a593SmuzhiyunTARGET_CFLAGS += -fPIC
184*4882a593Smuzhiyunendif
185*4882a593Smuzhiyunifeq ($(BR2_BINFMT_FLAT_ONE),y)
186*4882a593SmuzhiyunELF2FLT_FLAGS = $(if $($(PKG)_FLAT_STACKSIZE),\
187*4882a593Smuzhiyun	-Wl$(comma)-elf2flt="-r -s$($(PKG)_FLAT_STACKSIZE)",\
188*4882a593Smuzhiyun        -Wl$(comma)-elf2flt=-r)
189*4882a593Smuzhiyunelse
190*4882a593SmuzhiyunELF2FLT_FLAGS = $(if $($(PKG)_FLAT_STACKSIZE),\
191*4882a593Smuzhiyun	-Wl$(comma)-elf2flt=-s$($(PKG)_FLAT_STACKSIZE),\
192*4882a593Smuzhiyun	-Wl$(comma)-elf2flt)
193*4882a593Smuzhiyunendif
194*4882a593SmuzhiyunTARGET_CFLAGS += $(ELF2FLT_FLAGS)
195*4882a593SmuzhiyunTARGET_CXXFLAGS += $(ELF2FLT_FLAGS)
196*4882a593SmuzhiyunTARGET_FCFLAGS += $(ELF2FLT_FLAGS)
197*4882a593SmuzhiyunTARGET_LDFLAGS += $(ELF2FLT_FLAGS)
198*4882a593Smuzhiyunendif
199*4882a593Smuzhiyun
200*4882a593Smuzhiyunifeq ($(BR2_BINFMT_FLAT_SHARED),y)
201*4882a593SmuzhiyunTARGET_LDFLAGS += -mid-shared-library -mshared-library-id=0
202*4882a593SmuzhiyunTARGET_CFLAGS += -mid-shared-library -mshared-library-id=0
203*4882a593SmuzhiyunTARGET_FCFLAGS += -mid-shared-library -mshared-library-id=0
204*4882a593SmuzhiyunTARGET_CXXFLAGS += -mid-shared-library -mshared-library-id=0
205*4882a593Smuzhiyunendif
206*4882a593Smuzhiyun
207*4882a593Smuzhiyunifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
208*4882a593SmuzhiyunTARGET_CROSS = $(HOST_DIR)/bin/$(GNU_TARGET_NAME)-
209*4882a593Smuzhiyunelse
210*4882a593SmuzhiyunTARGET_CROSS = $(HOST_DIR)/bin/$(TOOLCHAIN_EXTERNAL_PREFIX)-
211*4882a593Smuzhiyunendif
212*4882a593Smuzhiyun
213*4882a593Smuzhiyun# Define TARGET_xx variables for all common binutils/gcc
214*4882a593SmuzhiyunTARGET_AR       = $(TARGET_CROSS)ar
215*4882a593SmuzhiyunTARGET_AS       = $(TARGET_CROSS)as
216*4882a593SmuzhiyunTARGET_CC       = $(TARGET_CROSS)gcc
217*4882a593SmuzhiyunTARGET_CPP      = $(TARGET_CROSS)cpp
218*4882a593SmuzhiyunTARGET_CXX      = $(TARGET_CROSS)g++
219*4882a593SmuzhiyunTARGET_FC       = $(TARGET_CROSS)gfortran
220*4882a593SmuzhiyunTARGET_LD       = $(TARGET_CROSS)ld
221*4882a593SmuzhiyunTARGET_NM       = $(TARGET_CROSS)nm
222*4882a593SmuzhiyunTARGET_RANLIB   = $(TARGET_CROSS)ranlib
223*4882a593SmuzhiyunTARGET_READELF  = $(TARGET_CROSS)readelf
224*4882a593SmuzhiyunTARGET_OBJCOPY  = $(TARGET_CROSS)objcopy
225*4882a593SmuzhiyunTARGET_OBJDUMP  = $(TARGET_CROSS)objdump
226*4882a593Smuzhiyun
227*4882a593Smuzhiyunifeq ($(BR2_STRIP_strip),y)
228*4882a593SmuzhiyunSTRIP_STRIP_DEBUG := --strip-debug
229*4882a593SmuzhiyunTARGET_STRIP = $(TARGET_CROSS)strip
230*4882a593SmuzhiyunSTRIPCMD = $(TARGET_CROSS)strip --remove-section=.comment --remove-section=.note
231*4882a593Smuzhiyunelse
232*4882a593SmuzhiyunTARGET_STRIP = /bin/true
233*4882a593SmuzhiyunSTRIPCMD = $(TARGET_STRIP)
234*4882a593Smuzhiyunendif
235*4882a593SmuzhiyunINSTALL := $(shell which install || type -p install)
236*4882a593SmuzhiyunUNZIP := $(shell which unzip || type -p unzip) -q
237*4882a593Smuzhiyun
238*4882a593SmuzhiyunAPPLY_PATCHES = PATH=$(HOST_DIR)/bin:$$PATH support/scripts/apply-patches.sh $(if $(QUIET),-s)
239*4882a593Smuzhiyun
240*4882a593SmuzhiyunHOST_CPPFLAGS  = -I$(HOST_DIR)/include
241*4882a593SmuzhiyunHOST_CFLAGS   ?= -O2
242*4882a593SmuzhiyunHOST_CFLAGS   += $(HOST_CPPFLAGS)
243*4882a593SmuzhiyunHOST_CXXFLAGS += $(HOST_CFLAGS)
244*4882a593SmuzhiyunHOST_LDFLAGS  += -L$(HOST_DIR)/lib -Wl,-rpath,$(HOST_DIR)/lib
245*4882a593Smuzhiyun
246*4882a593Smuzhiyun# host-intltool should be executed with the system perl, so we save
247*4882a593Smuzhiyun# the path to the system perl, before a host-perl built by Buildroot
248*4882a593Smuzhiyun# might get installed into $(HOST_DIR)/bin and therefore appears
249*4882a593Smuzhiyun# in our PATH. This system perl will be used as INTLTOOL_PERL.
250*4882a593Smuzhiyunexport PERL=$(shell which perl)
251*4882a593Smuzhiyun
252*4882a593Smuzhiyun# host-intltool needs libxml-parser-perl, which Buildroot installs in
253*4882a593Smuzhiyun# $(HOST_DIR)/lib/perl, so we must make sure that the system perl
254*4882a593Smuzhiyun# finds this perl module by exporting the proper value for PERL5LIB.
255*4882a593Smuzhiyunexport PERL5LIB=$(HOST_DIR)/lib/perl
256*4882a593Smuzhiyun
257*4882a593SmuzhiyunTARGET_MAKE_ENV = PATH=$(BR_PATH)
258*4882a593Smuzhiyun
259*4882a593SmuzhiyunTARGET_CONFIGURE_OPTS = \
260*4882a593Smuzhiyun	$(TARGET_MAKE_ENV) \
261*4882a593Smuzhiyun	AR="$(TARGET_AR)" \
262*4882a593Smuzhiyun	AS="$(TARGET_AS)" \
263*4882a593Smuzhiyun	LD="$(TARGET_LD)" \
264*4882a593Smuzhiyun	NM="$(TARGET_NM)" \
265*4882a593Smuzhiyun	CC="$(TARGET_CC)" \
266*4882a593Smuzhiyun	GCC="$(TARGET_CC)" \
267*4882a593Smuzhiyun	CPP="$(TARGET_CPP)" \
268*4882a593Smuzhiyun	CXX="$(TARGET_CXX)" \
269*4882a593Smuzhiyun	FC="$(TARGET_FC)" \
270*4882a593Smuzhiyun	F77="$(TARGET_FC)" \
271*4882a593Smuzhiyun	RANLIB="$(TARGET_RANLIB)" \
272*4882a593Smuzhiyun	READELF="$(TARGET_READELF)" \
273*4882a593Smuzhiyun	STRIP="$(TARGET_STRIP)" \
274*4882a593Smuzhiyun	OBJCOPY="$(TARGET_OBJCOPY)" \
275*4882a593Smuzhiyun	OBJDUMP="$(TARGET_OBJDUMP)" \
276*4882a593Smuzhiyun	AR_FOR_BUILD="$(HOSTAR)" \
277*4882a593Smuzhiyun	AS_FOR_BUILD="$(HOSTAS)" \
278*4882a593Smuzhiyun	CC_FOR_BUILD="$(HOSTCC)" \
279*4882a593Smuzhiyun	GCC_FOR_BUILD="$(HOSTCC)" \
280*4882a593Smuzhiyun	CXX_FOR_BUILD="$(HOSTCXX)" \
281*4882a593Smuzhiyun	LD_FOR_BUILD="$(HOSTLD)" \
282*4882a593Smuzhiyun	CPPFLAGS_FOR_BUILD="$(HOST_CPPFLAGS)" \
283*4882a593Smuzhiyun	CFLAGS_FOR_BUILD="$(HOST_CFLAGS)" \
284*4882a593Smuzhiyun	CXXFLAGS_FOR_BUILD="$(HOST_CXXFLAGS)" \
285*4882a593Smuzhiyun	LDFLAGS_FOR_BUILD="$(HOST_LDFLAGS)" \
286*4882a593Smuzhiyun	FCFLAGS_FOR_BUILD="$(HOST_FCFLAGS)" \
287*4882a593Smuzhiyun	DEFAULT_ASSEMBLER="$(TARGET_AS)" \
288*4882a593Smuzhiyun	DEFAULT_LINKER="$(TARGET_LD)" \
289*4882a593Smuzhiyun	CPPFLAGS="$(TARGET_CPPFLAGS)" \
290*4882a593Smuzhiyun	CFLAGS="$(TARGET_CFLAGS)" \
291*4882a593Smuzhiyun	CXXFLAGS="$(TARGET_CXXFLAGS)" \
292*4882a593Smuzhiyun	LDFLAGS="$(TARGET_LDFLAGS)" \
293*4882a593Smuzhiyun	FCFLAGS="$(TARGET_FCFLAGS)" \
294*4882a593Smuzhiyun	FFLAGS="$(TARGET_FCFLAGS)" \
295*4882a593Smuzhiyun	PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \
296*4882a593Smuzhiyun	STAGING_DIR="$(STAGING_DIR)" \
297*4882a593Smuzhiyun	INTLTOOL_PERL=$(PERL)
298*4882a593Smuzhiyun
299*4882a593Smuzhiyun
300*4882a593SmuzhiyunHOST_MAKE_ENV = \
301*4882a593Smuzhiyun	PATH=$(BR_PATH) \
302*4882a593Smuzhiyun	PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \
303*4882a593Smuzhiyun	PKG_CONFIG_SYSROOT_DIR="/" \
304*4882a593Smuzhiyun	PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 \
305*4882a593Smuzhiyun	PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 \
306*4882a593Smuzhiyun	PKG_CONFIG_LIBDIR="$(HOST_DIR)/lib/pkgconfig:$(HOST_DIR)/share/pkgconfig"
307*4882a593Smuzhiyun
308*4882a593SmuzhiyunHOST_CONFIGURE_OPTS = \
309*4882a593Smuzhiyun	$(HOST_MAKE_ENV) \
310*4882a593Smuzhiyun	AR="$(HOSTAR)" \
311*4882a593Smuzhiyun	AS="$(HOSTAS)" \
312*4882a593Smuzhiyun	LD="$(HOSTLD)" \
313*4882a593Smuzhiyun	NM="$(HOSTNM)" \
314*4882a593Smuzhiyun	CC="$(HOSTCC)" \
315*4882a593Smuzhiyun	GCC="$(HOSTCC)" \
316*4882a593Smuzhiyun	CXX="$(HOSTCXX)" \
317*4882a593Smuzhiyun	CPP="$(HOSTCPP)" \
318*4882a593Smuzhiyun	OBJCOPY="$(HOSTOBJCOPY)" \
319*4882a593Smuzhiyun	RANLIB="$(HOSTRANLIB)" \
320*4882a593Smuzhiyun	CPPFLAGS="$(HOST_CPPFLAGS)" \
321*4882a593Smuzhiyun	CFLAGS="$(HOST_CFLAGS)" \
322*4882a593Smuzhiyun	CXXFLAGS="$(HOST_CXXFLAGS)" \
323*4882a593Smuzhiyun	LDFLAGS="$(HOST_LDFLAGS)" \
324*4882a593Smuzhiyun	INTLTOOL_PERL=$(PERL)
325*4882a593Smuzhiyun
326*4882a593Smuzhiyun# This is extra environment we can not export ourselves (eg. because some
327*4882a593Smuzhiyun# packages use that variable internally, eg. uboot), so we have to
328*4882a593Smuzhiyun# explicitly pass it to user-supplied external hooks (eg. post-build,
329*4882a593Smuzhiyun# post-images)
330*4882a593SmuzhiyunEXTRA_ENV = \
331*4882a593Smuzhiyun	PATH=$(BR_PATH) \
332*4882a593Smuzhiyun	BR2_DL_DIR=$(BR2_DL_DIR) \
333*4882a593Smuzhiyun	BUILD_DIR=$(BUILD_DIR) \
334*4882a593Smuzhiyun	CONFIG_DIR=$(CONFIG_DIR) \
335*4882a593Smuzhiyun	O=$(CANONICAL_O)
336*4882a593Smuzhiyun
337*4882a593Smuzhiyun################################################################################
338*4882a593Smuzhiyun# settings we need to pass to configure
339*4882a593Smuzhiyun
340*4882a593Smuzhiyun# does unaligned access trap?
341*4882a593SmuzhiyunBR2_AC_CV_TRAP_CHECK = ac_cv_lbl_unaligned_fail=yes
342*4882a593Smuzhiyunifeq ($(BR2_i386),y)
343*4882a593SmuzhiyunBR2_AC_CV_TRAP_CHECK = ac_cv_lbl_unaligned_fail=no
344*4882a593Smuzhiyunendif
345*4882a593Smuzhiyunifeq ($(BR2_x86_64),y)
346*4882a593SmuzhiyunBR2_AC_CV_TRAP_CHECK = ac_cv_lbl_unaligned_fail=no
347*4882a593Smuzhiyunendif
348*4882a593Smuzhiyunifeq ($(BR2_m68k),y)
349*4882a593SmuzhiyunBR2_AC_CV_TRAP_CHECK = ac_cv_lbl_unaligned_fail=no
350*4882a593Smuzhiyunendif
351*4882a593Smuzhiyunifeq ($(BR2_powerpc)$(BR2_powerpc64)$(BR2_powerpc64le),y)
352*4882a593SmuzhiyunBR2_AC_CV_TRAP_CHECK = ac_cv_lbl_unaligned_fail=no
353*4882a593Smuzhiyunendif
354*4882a593Smuzhiyun
355*4882a593Smuzhiyunifeq ($(BR2_ENDIAN),"BIG")
356*4882a593SmuzhiyunBR2_AC_CV_C_BIGENDIAN = ac_cv_c_bigendian=yes
357*4882a593Smuzhiyunelse
358*4882a593SmuzhiyunBR2_AC_CV_C_BIGENDIAN = ac_cv_c_bigendian=no
359*4882a593Smuzhiyunendif
360*4882a593Smuzhiyun
361*4882a593Smuzhiyun# AM_GNU_GETTEXT misdetects musl gettext support.
362*4882a593Smuzhiyun# musl currently implements api level 1 and 2 (basic + ngettext)
363*4882a593Smuzhiyun# http://www.openwall.com/lists/musl/2015/04/16/3
364*4882a593Smuzhiyun#
365*4882a593Smuzhiyun# These autoconf variables should only be pre-seeded when the minimal
366*4882a593Smuzhiyun# gettext implementation of musl is used. When the full blown
367*4882a593Smuzhiyun# implementation provided by gettext libintl is used, auto-detection
368*4882a593Smuzhiyun# works fine, and pre-seeding those values is actually wrong.
369*4882a593Smuzhiyunifeq ($(BR2_TOOLCHAIN_USES_MUSL):$(BR2_PACKAGE_GETTEXT_PROVIDES_LIBINTL),y:)
370*4882a593SmuzhiyunBR2_GT_CV_FUNC_GNUGETTEXT_LIBC = \
371*4882a593Smuzhiyun	gt_cv_func_gnugettext1_libc=yes \
372*4882a593Smuzhiyun	gt_cv_func_gnugettext2_libc=yes
373*4882a593Smuzhiyunendif
374*4882a593Smuzhiyun
375*4882a593SmuzhiyunTARGET_CONFIGURE_ARGS = \
376*4882a593Smuzhiyun	$(BR2_AC_CV_TRAP_CHECK) \
377*4882a593Smuzhiyun	ac_cv_func_mmap_fixed_mapped=yes \
378*4882a593Smuzhiyun	ac_cv_func_memcmp_working=yes \
379*4882a593Smuzhiyun	ac_cv_have_decl_malloc=yes \
380*4882a593Smuzhiyun	gl_cv_func_malloc_0_nonnull=yes \
381*4882a593Smuzhiyun	ac_cv_func_malloc_0_nonnull=yes \
382*4882a593Smuzhiyun	ac_cv_func_calloc_0_nonnull=yes \
383*4882a593Smuzhiyun	ac_cv_func_realloc_0_nonnull=yes \
384*4882a593Smuzhiyun	lt_cv_sys_lib_search_path_spec="" \
385*4882a593Smuzhiyun	$(BR2_AC_CV_C_BIGENDIAN) \
386*4882a593Smuzhiyun	$(BR2_GT_CV_FUNC_GNUGETTEXT_LIBC)
387*4882a593Smuzhiyun
388*4882a593Smuzhiyun################################################################################
389*4882a593Smuzhiyun
390*4882a593Smuzhiyunifeq ($(BR2_SYSTEM_ENABLE_NLS),y)
391*4882a593SmuzhiyunNLS_OPTS = --enable-nls
392*4882a593SmuzhiyunTARGET_NLS_DEPENDENCIES = host-gettext
393*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_GETTEXT_PROVIDES_LIBINTL),y)
394*4882a593SmuzhiyunTARGET_NLS_DEPENDENCIES += gettext
395*4882a593SmuzhiyunTARGET_NLS_LIBS += -lintl
396*4882a593Smuzhiyunendif
397*4882a593Smuzhiyunelse
398*4882a593SmuzhiyunNLS_OPTS = --disable-nls
399*4882a593Smuzhiyunendif
400*4882a593Smuzhiyun
401*4882a593Smuzhiyun# We need anything that is invalid. Traditionally, we'd have used 'false' (and
402*4882a593Smuzhiyun# we did so in the past). However, that breaks libtool for packages that have
403*4882a593Smuzhiyun# optional C++ support (e.g. gnutls), because libtool will *require* a *valid*
404*4882a593Smuzhiyun# C++ preprocessor as long as CXX is not 'no'.
405*4882a593Smuzhiyun# Now, whether we use 'no' or 'false' for CXX as the same side effect: it is an
406*4882a593Smuzhiyun# invalid C++ compiler, and thus will cause detection of C++ to fail (which is
407*4882a593Smuzhiyun# expected and what we want), while at the same time taming libtool into
408*4882a593Smuzhiyun# silence.
409*4882a593Smuzhiyunifneq ($(BR2_INSTALL_LIBSTDCPP),y)
410*4882a593SmuzhiyunTARGET_CONFIGURE_OPTS += CXX=no
411*4882a593Smuzhiyunendif
412*4882a593Smuzhiyun
413*4882a593Smuzhiyunifeq ($(BR2_STATIC_LIBS),y)
414*4882a593SmuzhiyunSHARED_STATIC_LIBS_OPTS = --enable-static --disable-shared
415*4882a593SmuzhiyunTARGET_CFLAGS += -static
416*4882a593SmuzhiyunTARGET_CXXFLAGS += -static
417*4882a593SmuzhiyunTARGET_FCFLAGS += -static
418*4882a593SmuzhiyunTARGET_LDFLAGS += -static
419*4882a593Smuzhiyunelse ifeq ($(BR2_SHARED_LIBS),y)
420*4882a593SmuzhiyunSHARED_STATIC_LIBS_OPTS = --disable-static --enable-shared
421*4882a593Smuzhiyunelse ifeq ($(BR2_SHARED_STATIC_LIBS),y)
422*4882a593SmuzhiyunSHARED_STATIC_LIBS_OPTS = --enable-static --enable-shared
423*4882a593Smuzhiyunendif
424*4882a593Smuzhiyun
425*4882a593Smuzhiyunifeq ($(BR2_COMPILER_PARANOID_UNSAFE_PATH),y)
426*4882a593Smuzhiyunexport BR_COMPILER_PARANOID_UNSAFE_PATH=enabled
427*4882a593Smuzhiyunendif
428*4882a593Smuzhiyun
429*4882a593Smuzhiyuninclude package/pkg-download.mk
430*4882a593Smuzhiyuninclude package/pkg-autotools.mk
431*4882a593Smuzhiyuninclude package/pkg-cmake.mk
432*4882a593Smuzhiyuninclude package/pkg-luarocks.mk
433*4882a593Smuzhiyuninclude package/pkg-perl.mk
434*4882a593Smuzhiyuninclude package/pkg-python.mk
435*4882a593Smuzhiyuninclude package/pkg-virtual.mk
436*4882a593Smuzhiyuninclude package/pkg-generic.mk
437*4882a593Smuzhiyuninclude package/pkg-kconfig.mk
438*4882a593Smuzhiyuninclude package/pkg-rebar.mk
439*4882a593Smuzhiyuninclude package/pkg-kernel-module.mk
440*4882a593Smuzhiyuninclude package/pkg-waf.mk
441*4882a593Smuzhiyuninclude package/pkg-golang.mk
442*4882a593Smuzhiyuninclude package/pkg-meson.mk
443*4882a593Smuzhiyuninclude package/pkg-qmake.mk
444