summaryrefslogtreecommitdiff
path: root/package/Makefile.in
blob: 78731e24f467c27a701faa70f94d055dff16a626 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
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)

# Strip off the annoying quoting
ARCH:=$(strip $(subst ",, $(BR2_ARCH)))
#"))
WGET:=$(strip $(subst ",, $(BR2_WGET))) $(SPIDER)
#"))
SVN:=$(strip $(subst ",, $(BR2_SVN)))
#"))
ZCAT:=$(strip $(subst ",, $(BR2_ZCAT)))
#"))
BZCAT:=$(strip $(subst ",, $(BR2_BZCAT)))
#"))
TAR_OPTIONS=$(subst ",, $(BR2_TAR_OPTIONS)) -xf
#")


ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
TARGET_CFLAGS=$(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING) \
	-I$(STAGING_DIR)/usr/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

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


# 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_LDFLAGS=-L$(STAGING_DIR)/lib -L$(STAGING_DIR)/usr/lib
endif
#########################################################################


BASE_DIR:=$(shell pwd)

TOPDIR_PREFIX:=$(strip $(subst ",, $(BR2_TOPDIR_PREFIX)))_
#"))
TOPDIR_SUFFIX:=_$(strip $(subst ",, $(BR2_TOPDIR_SUFFIX)))
#"))
ifeq ($(TOPDIR_PREFIX),_)
TOPDIR_PREFIX:=
endif
ifeq ($(TOPDIR_SUFFIX),_)
TOPDIR_SUFFIX:=
endif

DL_DIR=$(strip $(subst ",, $(BR2_DL_DIR)))
#"))
ifeq ($(DL_DIR),)
DL_DIR:=$(BASE_DIR)/dl
endif
#PATCH_DIR=$(BASE_DIR)/sources/patches

# All non-configurable packages should be built in BUILD_DIR
BUILD_DIR:=$(BASE_DIR)/$(TOPDIR_PREFIX)build_$(ARCH)$(ARCH_FPU_SUFFIX)$(TOPDIR_SUFFIX)

# All configurable packages (like Busybox,Linux etc) should be built in PROJECT_BUILD_DIR
PROJECT_BUILD_DIR:=$(BASE_DIR)/$(TOPDIR_PREFIX)project_build_$(ARCH)$(ARCH_FPU_SUFFIX)$(TOPDIR_SUFFIX)/$(PROJECT)
BINARIES_DIR:=$(BASE_DIR)/binaries/$(PROJECT)
TARGET_DIR:=$(PROJECT_BUILD_DIR)/root


GNU_TARGET_SUFFIX:=-$(strip $(subst ",, $(BR2_GNU_TARGET_SUFFIX)))
#"))

STAGING_DIR:=$(strip $(subst ",, $(BR2_STAGING_DIR)))
#"))
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)
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)
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_RANLIB=$(TARGET_CROSS)ranlib
STRIP=$(TARGET_CROSS)strip --remove-section=.comment --remove-section=.note
INSTALL=/usr/bin/install


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)" \
		LDFLAGS_FOR_BUILD="$(HOST_LDFLAGS)" \
		PKG_CONFIG_SYSROOT="$(STAGING_DIR)" \
		PKG_CONFIG="$(STAGING_DIR)/usr/bin/pkg-config"

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_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

ifeq ($(BR2_INSTALL_LIBSTDCPP),)
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_XGGI)),y)
XSERVER+=xggi
endif