a0c5a7a48d236312b538be4b601b9c8f4e80c582
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / Makefile.in
1 ifndef MAKE
2 MAKE := make
3 endif
4 ifndef HOSTMAKE
5 HOSTMAKE = $(MAKE)
6 endif
7 HOSTMAKE := $(shell which $(HOSTMAKE) || type -p $(HOSTMAKE) || echo make)
8
9 # If BR2_JLEVEL is 0, scale the maximum concurrency with the number of
10 # CPUs. An additional job is used in order to keep processors busy
11 # while waiting on I/O.
12 # If the number of processors is not available, assume one.
13 ifeq ($(BR2_JLEVEL),0)
14 PARALLEL_JOBS := $(shell echo \
15         $$((1 + `getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1`)))
16 else
17 PARALLEL_JOBS := $(BR2_JLEVEL)
18 endif
19
20 MAKE1 := $(HOSTMAKE) -j1
21 MAKE := $(HOSTMAKE) $(if $(PARALLEL_JOBS),-j$(PARALLEL_JOBS))
22
23 ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
24 TARGET_VENDOR = $(call qstrip,$(BR2_TOOLCHAIN_BUILDROOT_VENDOR))
25 else
26 TARGET_VENDOR = buildroot
27 endif
28
29 # Sanity checks
30 ifeq ($(TARGET_VENDOR),)
31 $(error BR2_TOOLCHAIN_BUILDROOT_VENDOR is not allowed to be empty)
32 endif
33 ifeq ($(TARGET_VENDOR),unknown)
34 $(error BR2_TOOLCHAIN_BUILDROOT_VENDOR cannot be 'unknown'. \
35         It might be confused with the native toolchain)
36 endif
37
38 # Compute GNU_TARGET_NAME
39 GNU_TARGET_NAME = $(ARCH)-$(TARGET_VENDOR)-$(TARGET_OS)-$(LIBC)$(ABI)
40
41 # FLAT binary format needs uclinux
42 ifeq ($(BR2_BINFMT_FLAT),y)
43 TARGET_OS = uclinux
44 else
45 TARGET_OS = linux
46 endif
47
48 ifeq ($(BR2_TOOLCHAIN_USES_UCLIBC),y)
49 LIBC = uclibc
50 else ifeq ($(BR2_TOOLCHAIN_USES_MUSL),y)
51 LIBC = musl
52 else
53 LIBC = gnu
54 endif
55
56 # The ABI suffix is a bit special on ARM, as it needs to be
57 # -uclibcgnueabi for uClibc EABI, and -gnueabi for glibc EABI.
58 # This means that the LIBC and ABI aren't strictly orthogonal,
59 # which explains why we need the test on LIBC below.
60 ifeq ($(BR2_arm)$(BR2_armeb),y)
61 ifeq ($(LIBC),uclibc)
62 ABI = gnueabi
63 else
64 ABI = eabi
65 endif
66
67 ifeq ($(BR2_ARM_EABIHF),y)
68 ABI := $(ABI)hf
69 endif
70 endif
71
72 # For FSL PowerPC there's SPE
73 ifeq ($(BR2_powerpc_SPE),y)
74 ABI = spe
75 # MPC8540s are e500v1 with single precision FP
76 ifeq ($(BR2_powerpc_8540),y)
77 TARGET_ABI += -mabi=spe -mfloat-gprs=single -Wa,-me500
78 endif
79 ifeq ($(BR2_powerpc_8548),y)
80 TARGET_ABI += -mabi=spe -mfloat-gprs=double -Wa,-me500x2
81 endif
82 ifeq ($(BR2_powerpc_e500mc),y)
83 TARGET_ABI += -mabi=spe -mfloat-gprs=double -Wa,-me500mc
84 endif
85 endif
86
87 # Use longcalls option for Xtensa globally.
88 # The 'longcalls' option allows calls across a greater range of addresses,
89 # and is required for some packages. While this option can degrade both
90 # code size and performance, the linker can usually optimize away the
91 # overhead when a call ends up within a certain range.
92 #
93 # Use text-section-literals for Xtensa globally.
94 # Collecting literals into separate section can be advantageous if that
95 # section is placed into DTCM at link time. This is applicable for code
96 # running on bare metal, but makes no sense under linux, where userspace
97 # is isolated from the physical memory details. OTOH placing literals into
98 # separate section breaks build of huge source files, because l32r
99 # instruction can only access literals in 256 KBytes range.
100 #
101 ifeq ($(BR2_xtensa),y)
102 TARGET_ABI += -mlongcalls -mtext-section-literals
103 endif
104
105 ifeq ($(BR2_arc)$(BR2_ARC_ATOMIC_EXT),yy)
106 TARGET_ABI += -matomic
107 endif
108
109 STAGING_SUBDIR = usr/$(GNU_TARGET_NAME)/sysroot
110 STAGING_DIR    = $(HOST_DIR)/$(STAGING_SUBDIR)
111
112 TARGET_OPTIMIZATION := $(call qstrip,$(BR2_TARGET_OPTIMIZATION))
113
114 ifeq ($(BR2_OPTIMIZE_0),y)
115 TARGET_OPTIMIZATION += -O0
116 endif
117 ifeq ($(BR2_OPTIMIZE_1),y)
118 TARGET_OPTIMIZATION += -O1
119 endif
120 ifeq ($(BR2_OPTIMIZE_2),y)
121 TARGET_OPTIMIZATION += -O2
122 endif
123 ifeq ($(BR2_OPTIMIZE_3),y)
124 TARGET_OPTIMIZATION += -O3
125 endif
126 ifeq ($(BR2_OPTIMIZE_S),y)
127 TARGET_OPTIMIZATION += -Os
128 endif
129 ifeq ($(BR2_DEBUG_1),y)
130 TARGET_DEBUGGING = -g1
131 endif
132 ifeq ($(BR2_DEBUG_2),y)
133 TARGET_DEBUGGING = -g2
134 endif
135 ifeq ($(BR2_DEBUG_3),y)
136 TARGET_DEBUGGING = -g3
137 endif
138
139 TARGET_CPPFLAGS += -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
140 TARGET_CFLAGS = $(TARGET_CPPFLAGS) $(TARGET_ABI) $(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING)
141 TARGET_CXXFLAGS = $(TARGET_CFLAGS)
142 TARGET_LDFLAGS = $(call qstrip,$(BR2_TARGET_LDFLAGS))
143
144 ifeq ($(BR2_BINFMT_FLAT),y)
145 TARGET_CFLAGS += $(if $($(PKG)_FLAT_STACKSIZE),-Wl$(comma)-elf2flt=-s$($(PKG)_FLAT_STACKSIZE),\
146         -Wl$(comma)-elf2flt)
147 TARGET_CXXFLAGS += $(if $($(PKG)_FLAT_STACKSIZE),-Wl$(comma)-elf2flt=-s$($(PKG)_FLAT_STACKSIZE),\
148         -Wl$(comma)-elf2flt)
149 TARGET_LDFLAGS += $(if $($(PKG)_FLAT_STACKSIZE),-elf2flt=-s$($(PKG)_FLAT_STACKSIZE),-elf2flt)
150 endif
151
152 ifeq ($(BR2_BINFMT_FLAT_SHARED),y)
153 TARGET_LDFLAGS += -mid-shared-library -mshared-library-id=0
154 TARGET_CFLAGS += -mid-shared-library -mshared-library-id=0
155 TARGET_CXXFLAGS += -mid-shared-library -mshared-library-id=0
156 endif
157 ifeq ($(BR2_BINFMT_FLAT_SEP_DATA),y)
158 TARGET_LDFLAGS += -msep-data
159 TARGET_CFLAGS += -msep-data
160 TARGET_CXXFLAGS += -msep-data
161 endif
162
163 ifeq ($(BR2_ENABLE_SSP),y)
164 TARGET_CFLAGS += -fstack-protector-all
165 TARGET_CXXFLAGS += -fstack-protector-all
166 endif
167
168 ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
169 TARGET_CROSS = $(HOST_DIR)/usr/bin/$(GNU_TARGET_NAME)-
170 else
171 TARGET_CROSS = $(HOST_DIR)/usr/bin/$(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_PREFIX))-
172 endif
173
174 # Define TARGET_xx variables for all common binutils/gcc
175 TARGET_AR       = $(TARGET_CROSS)ar
176 TARGET_AS       = $(TARGET_CROSS)as
177 TARGET_CC       = $(TARGET_CROSS)gcc
178 TARGET_CPP      = $(TARGET_CROSS)cpp
179 TARGET_CXX      = $(TARGET_CROSS)g++
180 TARGET_FC       = $(TARGET_CROSS)gfortran
181 TARGET_LD       = $(TARGET_CROSS)ld
182 TARGET_NM       = $(TARGET_CROSS)nm
183 TARGET_RANLIB   = $(TARGET_CROSS)ranlib
184 TARGET_READELF  = $(TARGET_CROSS)readelf
185 TARGET_OBJCOPY  = $(TARGET_CROSS)objcopy
186 TARGET_OBJDUMP  = $(TARGET_CROSS)objdump
187
188 TARGET_CC_NOCCACHE  := $(TARGET_CC)
189 TARGET_CXX_NOCCACHE := $(TARGET_CXX)
190
191 ifeq ($(BR2_CCACHE),y)
192 TARGET_CC  := $(CCACHE) $(TARGET_CC)
193 TARGET_CXX := $(CCACHE) $(TARGET_CXX)
194 endif
195
196 ifeq ($(BR2_STRIP_strip),y)
197 STRIP_STRIP_DEBUG := --strip-debug
198 STRIP_STRIP_UNNEEDED := --strip-unneeded
199 STRIP_STRIP_ALL := --strip-all
200 TARGET_STRIP = $(TARGET_CROSS)strip
201 STRIPCMD = $(TARGET_CROSS)strip --remove-section=.comment --remove-section=.note
202 KSTRIPCMD = $(STRIPCMD) $(STRIP_STRIP_UNNEEDED)
203 endif
204 ifeq ($(BR2_STRIP_sstrip),y)
205 STRIP_STRIP_DEBUG :=
206 STRIP_STRIP_UNNEEDED :=
207 STRIP_STRIP_ALL :=
208 TARGET_STRIP = $(HOST_DIR)/usr/bin/$(GNU_TARGET_NAME)-sstrip
209 STRIPCMD = $(TARGET_STRIP)
210 KSTRIPCMD = $(TARGET_CROSS)strip --remove-section=.comment --remove-section=.note --strip-unneeded
211 endif
212 ifeq ($(BR2_STRIP_none),y)
213 TARGET_STRIP = true
214 STRIPCMD = $(TARGET_STRIP)
215 KSTRIPCMD = $(TARGET_STRIP)
216 endif
217 INSTALL := $(shell which install || type -p install)
218 FLEX := $(shell which flex || type -p flex)
219 BISON := $(shell which bison || type -p bison)
220 SED := $(shell which sed || type -p sed) -i -e
221 UNZIP := $(shell which unzip || type -p unzip) -q
222
223 APPLY_PATCHES = support/scripts/apply-patches.sh $(if $(QUIET),-s)
224
225 HOST_CPPFLAGS  = -I$(HOST_DIR)/usr/include
226 HOST_CFLAGS   ?= -O2
227 HOST_CFLAGS   += $(HOST_CPPFLAGS)
228 HOST_CXXFLAGS += $(HOST_CFLAGS)
229 HOST_LDFLAGS  += -L$(HOST_DIR)/lib -L$(HOST_DIR)/usr/lib -Wl,-rpath,$(HOST_DIR)/usr/lib
230
231 # hostcc version as an integer - E.G. 4.3.2 => 432
232 HOSTCC_VERSION := $(shell $(HOSTCC_NOCCACHE) --version | \
233         sed -n 's/^.* \([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)[ ]*.*$$/\1\2\3/p')
234
235 # host-intltool should be executed with the system perl, so we save
236 # the path to the system perl, before a host-perl built by Buildroot
237 # might get installed into $(HOST_DIR)/usr/bin and therefore appears
238 # in our PATH. This system perl will be used as INTLTOOL_PERL.
239 export PERL=$(shell which perl)
240
241 # host-intltool needs libxml-parser-perl, which Buildroot installs in
242 # $(HOST_DIR)/usr/lib/perl, so we must make sure that the system perl
243 # finds this perl module by exporting the proper value for PERL5LIB.
244 export PERL5LIB=$(HOST_DIR)/usr/lib/perl
245
246 TARGET_CONFIGURE_OPTS = \
247         PATH=$(BR_PATH) \
248         AR="$(TARGET_AR)" \
249         AS="$(TARGET_AS)" \
250         LD="$(TARGET_LD)" \
251         NM="$(TARGET_NM)" \
252         CC="$(TARGET_CC)" \
253         GCC="$(TARGET_CC)" \
254         CPP="$(TARGET_CPP)" \
255         CXX="$(TARGET_CXX)" \
256         FC="$(TARGET_FC)" \
257         RANLIB="$(TARGET_RANLIB)" \
258         READELF="$(TARGET_READELF)" \
259         STRIP="$(TARGET_STRIP)" \
260         OBJCOPY="$(TARGET_OBJCOPY)" \
261         OBJDUMP="$(TARGET_OBJDUMP)" \
262         AR_FOR_BUILD="$(HOSTAR)" \
263         AS_FOR_BUILD="$(HOSTAS)" \
264         CC_FOR_BUILD="$(HOSTCC)" \
265         GCC_FOR_BUILD="$(HOSTCC)" \
266         CXX_FOR_BUILD="$(HOSTCXX)" \
267         LD_FOR_BUILD="$(HOSTLD)" \
268         CPPFLAGS_FOR_BUILD="$(HOST_CPPFLAGS)" \
269         CFLAGS_FOR_BUILD="$(HOST_CFLAGS)" \
270         CXXFLAGS_FOR_BUILD="$(HOST_CXXFLAGS)" \
271         LDFLAGS_FOR_BUILD="$(HOST_LDFLAGS)" \
272         FCFLAGS_FOR_BUILD="$(HOST_FCFLAGS)" \
273         DEFAULT_ASSEMBLER="$(TARGET_AS)" \
274         DEFAULT_LINKER="$(TARGET_LD)" \
275         CPPFLAGS="$(TARGET_CPPFLAGS)" \
276         CFLAGS="$(TARGET_CFLAGS)" \
277         CXXFLAGS="$(TARGET_CXXFLAGS)" \
278         LDFLAGS="$(TARGET_LDFLAGS)" \
279         FCFLAGS="$(TARGET_FCFLAGS)" \
280         PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \
281         STAGING_DIR="$(STAGING_DIR)" \
282         INTLTOOL_PERL=$(PERL)
283
284 TARGET_MAKE_ENV = PATH=$(BR_PATH)
285
286
287 HOST_CONFIGURE_OPTS = \
288         PATH=$(BR_PATH) \
289         AR="$(HOSTAR)" \
290         AS="$(HOSTAS)" \
291         LD="$(HOSTLD)" \
292         NM="$(HOSTNM)" \
293         CC="$(HOSTCC)" \
294         GCC="$(HOSTCC)" \
295         CXX="$(HOSTCXX)" \
296         CPP="$(HOSTCPP)" \
297         OBJCOPY="$(HOSTOBJCOPY)" \
298         RANLIB="$(HOSTRANLIB)" \
299         CPPFLAGS="$(HOST_CPPFLAGS)" \
300         CFLAGS="$(HOST_CFLAGS)" \
301         CXXFLAGS="$(HOST_CXXFLAGS)" \
302         LDFLAGS="$(HOST_LDFLAGS)" \
303         PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 \
304         PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 \
305         PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \
306         PKG_CONFIG_SYSROOT_DIR="/" \
307         PKG_CONFIG_LIBDIR="$(HOST_DIR)/usr/lib/pkgconfig:$(HOST_DIR)/usr/share/pkgconfig" \
308         LD_LIBRARY_PATH="$(HOST_DIR)/usr/lib$(if $(LD_LIBRARY_PATH),:$(LD_LIBRARY_PATH))" \
309         INTLTOOL_PERL=$(PERL)
310
311 HOST_MAKE_ENV = \
312         PATH=$(BR_PATH) \
313         LD_LIBRARY_PATH="$(HOST_DIR)/usr/lib$(if $(LD_LIBRARY_PATH),:$(LD_LIBRARY_PATH))" \
314         PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \
315         PKG_CONFIG_SYSROOT_DIR="/" \
316         PKG_CONFIG_LIBDIR="$(HOST_DIR)/usr/lib/pkgconfig"
317
318 # This is extra environment we can not export ourselves (eg. because some
319 # packages use that variable internally, eg. uboot), so we have to
320 # explicitly pass it to user-supplied external hooks (eg. post-build,
321 # post-images)
322 EXTRA_ENV = \
323         PATH=$(BR_PATH) \
324         BR2_DL_DIR=$(BR2_DL_DIR) \
325         BUILD_DIR=$(BUILD_DIR) \
326         BR2_EXTERNAL=$(BR2_EXTERNAL)
327
328 ################################################################################
329 # settings we need to pass to configure
330
331 # does unaligned access trap?
332 BR2_AC_CV_TRAP_CHECK = ac_cv_lbl_unaligned_fail=yes
333 ifeq ($(BR2_i386),y)
334 BR2_AC_CV_TRAP_CHECK = ac_cv_lbl_unaligned_fail=no
335 endif
336 ifeq ($(BR2_x86_64),y)
337 BR2_AC_CV_TRAP_CHECK = ac_cv_lbl_unaligned_fail=no
338 endif
339 ifeq ($(BR2_m68k),y)
340 BR2_AC_CV_TRAP_CHECK = ac_cv_lbl_unaligned_fail=no
341 endif
342 ifeq ($(BR2_powerpc)$(BR2_powerpc64)$(BR2_powerpc64le),y)
343 BR2_AC_CV_TRAP_CHECK = ac_cv_lbl_unaligned_fail=no
344 endif
345
346 ifeq ($(BR2_ENDIAN),"BIG")
347 BR2_AC_CV_C_BIGENDIAN = ac_cv_c_bigendian=yes
348 else
349 BR2_AC_CV_C_BIGENDIAN = ac_cv_c_bigendian=no
350 endif
351
352 TARGET_CONFIGURE_ARGS = \
353         $(BR2_AC_CV_TRAP_CHECK) \
354         ac_cv_func_mmap_fixed_mapped=yes \
355         ac_cv_func_memcmp_working=yes \
356         ac_cv_have_decl_malloc=yes \
357         gl_cv_func_malloc_0_nonnull=yes \
358         ac_cv_func_malloc_0_nonnull=yes \
359         ac_cv_func_calloc_0_nonnull=yes \
360         ac_cv_func_realloc_0_nonnull=yes \
361         lt_cv_sys_lib_search_path_spec="" \
362         $(BR2_AC_CV_C_BIGENDIAN)
363
364 ################################################################################
365
366 ifeq ($(BR2_ENABLE_LOCALE),y)
367 DISABLE_NLS :=
368 else
369 DISABLE_NLS :=--disable-nls
370 endif
371
372 ifneq ($(BR2_INSTALL_LIBSTDCPP),y)
373 TARGET_CONFIGURE_OPTS += CXX=false
374 endif
375
376 ifeq ($(BR2_ENABLE_DEBUG),y)
377 ENABLE_DEBUG := --enable-debug
378 else
379 ENABLE_DEBUG := --disable-debug
380 endif
381
382 ifeq ($(BR2_STATIC_LIBS),y)
383 SHARED_STATIC_LIBS_OPTS = --enable-static --disable-shared
384 TARGET_CFLAGS += -static
385 TARGET_CXXFLAGS += -static
386 TARGET_LDFLAGS += -static
387 else ifeq ($(BR2_SHARED_LIBS),y)
388 SHARED_STATIC_LIBS_OPTS = --disable-static --enable-shared
389 else ifeq ($(BR2_SHARED_STATIC_LIBS),y)
390 SHARED_STATIC_LIBS_OPTS = --enable-static --enable-shared
391 endif
392
393 ifeq ($(BR2_COMPILER_PARANOID_UNSAFE_PATH),y)
394 export BR_COMPILER_PARANOID_UNSAFE_PATH=enabled
395 endif
396
397 include package/pkg-download.mk
398 include package/pkg-autotools.mk
399 include package/pkg-cmake.mk
400 include package/pkg-luarocks.mk
401 include package/pkg-perl.mk
402 include package/pkg-python.mk
403 include package/pkg-virtual.mk
404 include package/pkg-generic.mk
405 include package/pkg-kconfig.mk
406 include package/pkg-rebar.mk