more preseeding
[buildroot.git] / package / Makefile.in
blobe7d63b82669763d309591024e6bd3ab4e5dbfb0b
1 ifndef MAKE
2 MAKE:=make
3 endif
4 ifndef HOSTMAKE
5 HOSTMAKE=$(MAKE)
6 endif
7 HOSTMAKE :=$(shell $(CONFIG_SHELL) -c "which $(HOSTMAKE)" || type -p $(HOSTMAKE) || echo make)
9 MAKE1:=$(HOSTMAKE) MAKE="$(firstword $(HOSTMAKE)) -j1"
10 MAKE:=$(HOSTMAKE) -j$(BR2_JLEVEL)
13 #########################################################################
14 ifeq ($(BR2_TOOLCHAIN_SOURCE),y)
15 TARGET_CFLAGS=
16 TARGET_LDFLAGS=
17 # flags that are inherent part of the tool
18 TARGET_CC_FLAGS=
19 TARGET_LD_FLAGS=
21 ifeq ($(BR2_TOOLCHAIN_SYSROOT),y)
22 TARGET_CC_FLAGS+= $(BR2_SYSROOT) $(BR2_ISYSROOT) -I=/usr/include
23 TARGET_LD_FLAGS+= $(BR2_SYSROOT)
24 else
25 # for old gcc's, as fallback
26 TARGET_CC_FLAGS+= -I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include
27 endif
28 ifeq ($(BR2_ENABLE_MULTILIB),y)
29 TARGET_LD_FLAGS+= -L$(STAGING_DIR)/lib64 -L$(STAGING_DIR)/usr/lib64
30 endif
31 TARGET_LD_FLAGS+= -L$(STAGING_DIR)/lib -L$(STAGING_DIR)/usr/lib
32 TARGET_CFLAGS += $(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING)
34 ifeq ($(BR2_bfin),y)
35 CC_TARGET_CPU_SUB_:=$(strip $(subst ",,$(BR2_bfin_sirevision)))
36 #"))
37 CC_TARGET_CPU_SUB_:=$(if $(CC_TARGET_CPU_SUB_),-$(CC_TARGET_CPU_SUB_))
38 endif
40 CC_TARGET_CPU_:=$(strip $(subst ",,$(BR2_GCC_TARGET_CPU)))
41 #"))
42 CC_TARGET_TUNE_:=$(strip $(subst ",,$(BR2_GCC_TARGET_TUNE)))
43 #"))
44 CC_TARGET_ARCH_:=$(strip $(subst ",,$(BR2_GCC_TARGET_ARCH)))
45 #"))
46 CC_TARGET_ABI_:=$(strip $(subst ",,$(BR2_GCC_TARGET_ABI)))
47 #"))
48 ifneq ($(CC_TARGET_CPU_),)
49 TARGET_CFLAGS+=-mcpu=$(CC_TARGET_CPU_)$(CC_TARGET_CPU_SUB_)
50 endif
51 ifneq ($(CC_TARGET_TUNE_),)
52 TARGET_CFLAGS+=-mtune=$(CC_TARGET_TUNE_)
53 endif
54 ifneq ($(CC_TARGET_ARCH_),)
55 TARGET_CFLAGS+=-march=$(CC_TARGET_ARCH_)
56 endif
57 ifneq ($(CC_TARGET_ABI_),)
58 TARGET_CFLAGS+=-mabi=$(CC_TARGET_ABI_)
59 endif
61 ifneq ($(BR2_PREFER_STATIC_LIB),y)
62 ifeq ($(BR2_x86_64),y)
63 TARGET_CFLAGS+=-fPIC -DPIC
64 endif # PIC for dynamic objects on x86_64
65 endif
67 ifeq ($(BR2_SOFT_FLOAT),y)
68 TARGET_CFLAGS+=-msoft-float
69 endif
71 ifeq ($(BR2_THUMB_BINARIES),y)
72 TARGET_CFLAGS+=-mthumb
73 endif
75 # enable VIS for v9a and v9b
76 ifeq ($(findstring y,$(BR2_sparc_v9a)$(BR2_sparc64_v9a)$(BR2_sparc_v9b)$(BR2_sparc64_v9b)),y)
77 TARGET_CFLAGS+=-mvis
78 endif
80 ifeq ($(findstring yy,$(BR2_mips)$(BR2_MIPS_ABI64)),yy)
81 TARGET_CFLAGS+=-fno-pic -mno-abicalls
82 endif
84 TARGET_CXXFLAGS=$(TARGET_CFLAGS)
85 TARGET_FFLAGS=$(TARGET_CFLAGS)
86 TARGET_FCFLAGS=$(TARGET_CFLAGS)
87 TARGET_F77FLAGS=$(TARGET_CFLAGS)
88 TARGET_FC_FLAGS=$(TARGET_CC_FLAGS)
90 # else it's an external toolchain
91 #########################################################################
92 else
93 TARGET_CC_FLAGS=-I$(STAGING_DIR)/include -I$(STAGING_DIR)/usr/include -I$(TOOLCHAIN_EXTERNAL_PATH)/$(TOOLCHAIN_EXTERNAL_PREFIX)/include
94 TARGET_CFLAGS=$(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING)
95 TARGET_CXXFLAGS=$(TARGET_CFLAGS)
96 TARGET_LD_FLAGS=-L$(STAGING_DIR)/lib -L$(STAGING_DIR)/usr/lib
97 endif
98 #########################################################################
100 ifeq ($(BR2_ENABLE_SSP),y)
101 TARGET_CFLAGS+=-fstack-protector -fstack-protector-all -Wstack-protector
102 endif
104 ifeq ($(BR2_TOOLCHAIN_SOURCE),y)
105 TOOL_BUILD_DIR=$(BASE_DIR)/$(TOPDIR_PREFIX)toolchain_build_$(ARCH)$(ARCH_FPU_SUFFIX)$(TOPDIR_SUFFIX)
107 # Quotes are needed for spaces et al in path components.
108 TARGET_PATH="$(TOOL_BUILD_DIR)/bin:$(STAGING_DIR)/bin:$(STAGING_DIR)/usr/bin:$(PATH)"
109 IMAGE:=$(BINARIES_DIR)/rootfs.$(ARCH)$(ARCH_FPU_SUFFIX)
110 GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux
111 REAL_GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)$(GNU_TARGET_SUFFIX)
112 TARGET_CROSS=$(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-
113 KERNEL_CROSS=$(TARGET_CROSS)
114 else
115 TOOLCHAIN_EXTERNAL_PREFIX:=$(strip $(subst ",, $(BR2_TOOLCHAIN_EXTERNAL_PREFIX)))
116 #"))
117 TOOLCHAIN_EXTERNAL_PATH:=$(strip $(subst ",, $(BR2_TOOLCHAIN_EXTERNAL_PATH)))
118 #"))
119 TOOL_BUILD_DIR=$(BASE_DIR)/$(TOPDIR_PREFIX)toolchain_build_$(TOOLCHAIN_EXTERNAL_PREFIX)
120 TARGET_PATH="$(STAGING_DIR)/bin:$(TOOL_BUILD_DIR)/bin:$(TOOLCHAIN_EXTERNAL_PATH)/bin:$(PATH)"
121 IMAGE:=$(BINARIES_DIR)/rootfs.$(TOOLCHAIN_EXTERNAL_PREFIX)-$(DATE)
123 REAL_GNU_TARGET_NAME=$(TOOLCHAIN_EXTERNAL_PREFIX)
124 GNU_TARGET_NAME=$(TOOLCHAIN_EXTERNAL_PREFIX)
125 KERNEL_CROSS=$(TOOLCHAIN_EXTERNAL_PATH)/bin/$(TOOLCHAIN_EXTERNAL_PREFIX)-
126 TARGET_CROSS=$(TOOLCHAIN_EXTERNAL_PATH)/bin/$(TOOLCHAIN_EXTERNAL_PREFIX)-
127 endif
128 TARGET_AR=$(TARGET_CROSS)ar
129 TARGET_AS=$(TARGET_CROSS)as
130 TARGET_CC=$(TARGET_CROSS)gcc
131 TARGET_CPP=$(TARGET_CROSS)cpp
132 TARGET_CXX=$(TARGET_CROSS)g++
133 ifeq ($(BR2_GCC_VERSION_3_4_6),y)
134 TARGET_FC=$(TARGET_CROSS)g77
135 else
136 TARGET_FC=$(TARGET_CROSS)gfortran
137 endif
138 TARGET_LD=$(TARGET_CROSS)ld
139 TARGET_NM=$(TARGET_CROSS)nm
140 TARGET_RANLIB=$(TARGET_CROSS)ranlib
141 TARGET_OBJCOPY=$(TARGET_CROSS)objcopy
142 TARGET_OBJDUMP=$(TARGET_CROSS)objdump
143 TARGET_LDCONFIG=$(TARGET_CROSS)ldconfig
144 ifeq ($(BR2_STRIP_strip),y)
145 STRIP_DISCARD_ALL:=--discard-all
146 STRIP_STRIP_UNNEEDED:=--strip-unneeded
147 STRIP_STRIP_ALL:=--strip-all
148 REMOVE_SECTION_COMMENT:=--remove-section=.comment
149 REMOVE_SECTION_NOTE:=--remove-section=.note
150 TARGET_STRIP=$(TARGET_CROSS)strip
151 STRIPCMD=$(TARGET_CROSS)strip $(REMOVE_SECTION_COMMENT) $(REMOVE_SECTION_NOTE)
152 endif
153 ifeq ($(BR2_STRIP_sstrip),y)
154 STRIP_DISCARD_ALL:=
155 STRIP_STRIP_UNNEEDED:=
156 STRIP_STRIP_ALL:=
157 REMOVE_SECTION_COMMENT:=
158 REMOVE_SECTION_NOTE:=
159 TARGET_STRIP=$(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-sstrip
160 STRIPCMD=$(TARGET_STRIP)
161 endif
162 ifeq ($(BR2_STRIP_none),y)
163 TARGET_STRIP=true -Not_stripping
164 STRIPCMD=$(TARGET_STRIP)
165 endif
166 INSTALL=/usr/bin/install
167 FLEX:=$(shell $(CONFIG_SHELL) -c 'which flex || type -p flex')
168 BISON:=$(shell $(CONFIG_SHELL) -c 'which bison || type -p bison')
170 HOST_ARCH:=$(shell $(HOSTCC) -dumpmachine | sed -e s'/-.*//' \
171 -e 's/sparc.*/sparc/' \
172 -e 's/arm.*/arm/g' \
173 -e 's/m68k.*/m68k/' \
174 -e 's/ppc/powerpc/g' \
175 -e 's/v850.*/v850/g' \
176 -e 's/sh[234]/sh/' \
177 -e 's/mips-.*/mips/' \
178 -e 's/mipsel-.*/mipsel/' \
179 -e 's/cris.*/cris/' \
180 -e 's/i[3-9]86/i386/' \
182 GNU_HOST_NAME:=$(HOST_ARCH)-$(subst ",,$(BR2_GNU_BUILD_SUFFIX))
185 AUTO_CONFIGURE_TARGET=\
186 $(TARGET_CONFIGURE_OPTS) \
187 $(TARGET_CONFIGURE_ARGS) \
188 $(TARGET_CONFIGURE_ENV) \
189 $(if $(THIS_SRCDIR),$(THIS_SRCDIR)/,./)configure \
190 --cache-file="$(PROJECT_BUILD_DIR)/tgt-config.cache" \
191 --target=$(REAL_GNU_TARGET_NAME) \
192 --host=$(REAL_GNU_TARGET_NAME) \
193 --build=$(GNU_HOST_NAME)
195 TARGET_CONFIGURE_OPTS=\
196 PATH=$(TARGET_PATH) \
197 AR="$(TARGET_AR)" \
198 AS="$(TARGET_AS)" \
199 LD="$(TARGET_LD)$(if $(TARGET_LD_FLAGS), $(TARGET_LD_FLAGS))" \
200 NM="$(TARGET_NM)" \
201 CC="$(TARGET_CC)$(if $(TARGET_CC_FLAGS), $(TARGET_CC_FLAGS))" \
202 GCC="$(TARGET_CC)$(if $(TARGET_CC_FLAGS), $(TARGET_CC_FLAGS))" \
203 CPP="$(TARGET_CPP)$(if $(TARGET_CC_FLAGS), $(TARGET_CC_FLAGS))" \
204 CXX="$(if $(BR2_GCC_CROSS_CXX),$(TARGET_CXX)$(if $(TARGET_CXXFLAGS), $(TARGET_CXXFLAGS)))" \
205 FC="$(TARGET_FC)$(if $(TARGET_FC_FLAGS), $(TARGET_FC_FLAGS))" \
206 RANLIB="$(TARGET_RANLIB)" \
207 STRIP="$(TARGET_STRIP)" \
208 OBJCOPY="$(TARGET_OBJCOPY)" \
209 AR_FOR_BUILD="$(HOSTAR)" \
210 AS_FOR_BUILD="$(HOSTAS)" \
211 CC_FOR_BUILD="$(HOSTCC)" \
212 GCC_FOR_BUILD="$(HOSTCC)" \
213 CXX_FOR_BUILD="$(HOSTCXX)" \
214 FC_FOR_BUILD="$(HOSTFC)" \
215 LD_FOR_BUILD="$(HOSTLD)" \
216 CFLAGS_FOR_BUILD="$(HOST_CFLAGS)" \
217 CXXFLAGS_FOR_BUILD="$(HOST_CXXFLAGS)" \
218 LDFLAGS_FOR_BUILD="$(HOST_LDFLAGS)" \
219 FCFLAGS_FOR_BUILD="$(HOST_FCFLAGS)" \
220 AR_FOR_TARGET="$(TARGET_AR)" \
221 AS_FOR_TARGET="$(TARGET_AS)" \
222 CC_FOR_TARGET="$(TARGET_CC)" \
223 LD_FOR_TARGET="$(TARGET_LD)" \
224 NM_FOR_TARGET="$(TARGET_NM)" \
225 CXX_FOR_TARGET="$(if $(BR2_GCC_CROSS_CXX),$(TARGET_CXX))" \
226 DEFAULT_ASSEMBLER="$(TARGET_AS)" \
227 DEFAULT_LINKER="$(TARGET_LD)" \
228 LIBTOOL="$(TOOL_BUILD_DIR)/bin/$(LIBTOOL_BINARY)" \
229 LIBTOOLIZE="$(TOOL_BUILD_DIR)/bin/$(LIBTOOL_BINARY)ize" \
230 PKG_CONFIG_SYSROOT="$(STAGING_DIR)" \
231 PKG_CONFIG="$(STAGING_DIR)/usr/bin/pkg-config" \
232 PKG_CONFIG_PATH="$(STAGING_DIR)/usr/lib/pkgconfig:$(PKG_CONFIG_PATH)" \
233 PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 \
234 PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 \
235 STAGING_DIR="$(STAGING_DIR)"
237 TARGET_CONFIGURE_ENV:=\
238 CFLAGS="$(TARGET_CFLAGS)" \
239 LDFLAGS="$(TARGET_LDFLAGS)" \
240 CXXFLAGS="$(if $(BR2_GCC_CROSS_CXX),$(TARGET_CXXFLAGS))" \
241 FFLAGS="$(TARGET_FFLAGS)" \
242 FCFLAGS="$(TARGET_FCFLAGS)" \
243 F77FLAGS="$(TARGET_F77FLAGS)" \
245 HOST_CONFIGURE_OPTS=\
246 PATH=$(TARGET_PATH) \
247 AR="$(HOSTAR)" \
248 AS="$(HOSTAS)" \
249 LD="$(HOSTLD)$(if $(HOST_LDFLAGS), $(HOST_LDFLAGS))" \
250 NM="$(HOSTNM)" \
251 CC="$(HOSTCC)$(if $(HOST_CFLAGS), $(HOST_CFLAGS))" \
252 GCC="$(HOSTCC)$(if $(HOST_CFLAGS), $(HOST_CFLAGS))" \
253 CXX="$(HOSTCXX)$(if $(HOST_CXXFLAGS), $(HOST_CXXFLAGS))" \
254 CPP="$(HOSTCPP)$(if $(HOST_CFLAGS), $(HOST_CFLAGS))" \
255 AR_FOR_BUILD="$(HOSTAR)" \
256 AS_FOR_BUILD="$(HOSTAS)" \
257 CC_FOR_BUILD="$(HOSTCC)" \
258 GCC_FOR_BUILD="$(HOSTCC)" \
259 CPP_FOR_BUILD="$(HOSTCPP)" \
260 CXX_FOR_BUILD="$(HOSTCXX)" \
261 LD_FOR_BUILD="$(HOSTLD)" \
262 FC_FOR_BUILD="$(HOSTFC)" \
263 CFLAGS_FOR_BUILD="$(HOST_CFLAGS)" \
264 CXXFLAGS_FOR_BUILD="$(HOST_CXXFLAGS)" \
265 LDFLAGS_FOR_BUILD="$(HOST_LDFLAGS)" \
266 FCFLAGS_FOR_BUILD="$(HOST_FCFLAGS)" \
267 AR_FOR_TARGET="$(TARGET_AR)" \
268 AS_FOR_TARGET="$(TARGET_AS)" \
269 CC_FOR_TARGET="$(TARGET_CC)" \
270 CPP_FOR_TARGET="$(TARGET_CPP)" \
271 LD_FOR_TARGET="$(TARGET_LD)" \
272 NM_FOR_TARGET="$(TARGET_NM)" \
273 CXX_FOR_TARGET="$(if $(BR2_GCC_CROSS_CXX),$(TARGET_CXX))" \
274 RANLIB_FOR_TARGET="$(TARGET_RANLIB)" \
275 STRIP_FOR_TARGET="$(TARGET_STRIP)" \
276 OBJCOPY_FOR_TARGET="$(TARGET_OBJCOPY)" \
277 OBJDUMP_FOR_TARGET="$(TARGET_OBJDUMP)" \
278 DEFAULT_ASSEMBLER="$(TARGET_AS)" \
279 DEFAULT_LINKER="$(TARGET_LD)" \
280 ORIGINAL_AS_FOR_TARGET="$(TARGET_AS)" \
281 ORIGINAL_LD_FOR_TARGET="$(TARGET_LD)" \
282 ORIGINAL_NM_FOR_TARGET="$(TARGET_NM)" \
283 ORIGINAL_OBJDUMP_FOR_TARGET="$(TARGET_OBJDUMP)"
285 #######################################################################
286 # settings we need to pass to configure
288 # does unaligned access trap?
289 BR2_AC_CV_TRAP_CHECK=ac_cv_lbl_unaligned_fail=yes
290 ifeq ($(BR2_i386),y)
291 BR2_AC_CV_TRAP_CHECK=ac_cv_lbl_unaligned_fail=no
292 endif
293 ifeq ($(BR2_x86_64),y)
294 BR2_AC_CV_TRAP_CHECK=ac_cv_lbl_unaligned_fail=no
295 endif
296 ifeq ($(BR2_m68k),y)
297 BR2_AC_CV_TRAP_CHECK=ac_cv_lbl_unaligned_fail=no
298 endif
299 ifeq ($(BR2_s390),y)
300 BR2_AC_CV_TRAP_CHECK=ac_cv_lbl_unaligned_fail=no
301 endif
302 ifeq ($(BR2_powerpc)$(BR2_ENDIAN),yBIG)
303 BR2_AC_CV_TRAP_CHECK=ac_cv_lbl_unaligned_fail=no
304 endif
306 ifeq ($(BR2_ENDIAN),"BIG")
307 BR2_AC_CV_C_BIGENDIAN=ac_cv_c_bigendian=yes
308 else
309 BR2_AC_CV_C_BIGENDIAN=ac_cv_c_bigendian=no
310 endif
312 # uClibc's config symbols reside in BR2__UCLIBC_${uclibc_config_sym}=${val}
313 # Does malloc return live pointer for malloc(0) ?
314 ifeq ($(BR2__UCLIBC_MALLOC_GLIBC_COMPAT),y)
315 BR2_AC_CV_FUNC_MALLOC_0_NONNULL=ac_cv_func_malloc_0_nonnull=yes \
316 gl_cv_func_malloc_0_nonnull=yes \
317 ac_cv_func_realloc_0_nonnull=yes
318 else
319 BR2_AC_CV_FUNC_MALLOC_0_NONNULL=ac_cv_func_malloc_0_nonnull=no \
320 gl_cv_func_malloc_0_nonnull=no \
321 ac_cv_func_realloc_0_nonnull=no
322 endif
323 ifeq ($(BR2__UCLIBC_UCLIBC_HAS_SYS_ERRLIST),y)
324 BR2_AC_CV_HAVE_DECL_ERRLIST=ac_cv_have_decl_sys_errlist=yes
325 else
326 BR2_AC_CV_HAVE_DECL_ERRLIST=ac_cv_have_decl_sys_errlist=no
327 endif
328 ifeq ($(BR2__UCLIBC_UCLIBC_HAS_SYS_SIGLIST),y)
329 BR2_AC_CV_HAVE_DECL_SIGLIST=ac_cv_have_decl_sys_siglist=yes
330 else
331 BR2_AC_CV_HAVE_DECL_SIGLIST=ac_cv_have_decl_sys_siglist=no
332 endif
333 ifeq ($(BR_LARGEFILE),y)
334 BR2_AC_CV_TYPE_STAT64=ac_cv_type_stat64=yes
335 else
336 BR2_AC_CV_TYPE_STAT64=ac_cv_type_stat64=no
337 endif
339 ifeq ($(findstring y,$(BR2__UCLIBC_UCLIBC_SUSV3_LEGACY)$(BR2__UCLIBC_UCLIBC_SUSV3_LEGACY_MACROS)),y)
340 BR2_AC_CV_SUSV3_LEGACY=
341 endif
343 TARGET_CONFIGURE_ARGS= \
344 $(BR2_AC_CV_TRAP_CHECK) \
345 ac_cv_func_mmap_fixed_mapped=yes \
346 ac_cv_func_memcmp_working=yes \
347 $(BR2_AC_CV_FUNC_MALLOC_0_NONNULL) \
348 $(BR2_AC_CV_HAVE_DECL_ERRLIST) \
349 $(BR2_AC_CV_HAVE_DECL_SIGLIST) \
350 $(BR2_AC_CV_TYPE_STAT64) \
351 ac_cv_type_mode_t=yes \
352 ac_cv_prog_LEX="$(FLEX)" \
353 ac_cv_prog_YACC="$(BISON) $($(PKG)_BISON_FLAGS)" \
354 $(BR2_AC_CV_C_BIGENDIAN) \
355 $(BR2_AC_CV_SUSV3_LEGACY)
357 #######################################################################
359 #ifneq ($(BR2_GCC_CROSS_CXX),y)
360 #TARGET_CONFIGURE_OPTS+=CXX=""
361 #endif
365 # X Windowing system
367 XSERVER:=
368 ifeq ($(BR2_PACKAGE_TINYX),y)
369 XSERVER+=tinyx
370 endif
371 ifeq ($(BR2_PACKAGE_XORG),y)
372 XSERVER+=xorg
373 endif
374 ifeq ($(BR2_PACKAGE_XORG7),y)
375 XSERVER+=xserver_xorg-server
376 endif
377 ifeq ($(BR2_PACKAGE_XGGI),y)
378 XSERVER+=xggi
379 endif
381 X11_PREFIX:=$(strip $(subst ",, $(BR2_X11_PREFIX)))
382 #"))
384 include package/Makefile.autotools.in