2 include $(TOPDIR)/.config
9 ifeq ("$(origin V)", "command line")
17 ifneq ($(KBUILD_VERBOSE),0)
28 MAKEFLAGS=-j$(CONFIG_JLEVEL) V=$(V) $(EXTRA_MAKEFLAGS)
29 # Strip off the annoying quoting
30 ARCH:=$(strip $(subst ",, $(CONFIG_ARCH)))
31 WGET:=$(strip $(subst ",, $(CONFIG_WGET)))
32 GCC_VERSION:=$(strip $(subst ",, $(CONFIG_GCC_VERSION)))
33 GCC_USE_SJLJ_EXCEPTIONS:=$(strip $(subst ",, $(CONFIG_GCC_USE_SJLJ_EXCEPTIONS)))
34 TARGET_OPTIMIZATION:=$(strip $(subst ",, $(CONFIG_TARGET_OPTIMIZATION)))
35 #"))"))"))"))")) # for vim's broken syntax highlighting :)
38 ifeq ($(CONFIG_SOFT_FLOAT),y)
39 # gcc 3.4.x soft float configuration is different than previous versions.
40 ifeq ($(findstring 3.4.,$(GCC_VERSION)),3.4.)
41 SOFT_FLOAT_CONFIG_OPTION:=--with-float=soft
43 SOFT_FLOAT_CONFIG_OPTION:=--without-float
45 TARGET_SOFT_FLOAT:=-msoft-float
46 ARCH_FPU_SUFFIX:=_nofpu
48 SOFT_FLOAT_CONFIG_OPTION:=
54 ifeq ($(CONFIG_TAR_VERBOSITY),y)
60 ifneq ($(CONFIG_LARGEFILE),y)
61 DISABLE_LARGEFILE= --disable-largefile
63 TARGET_CFLAGS:=$(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING)
65 OPTIMIZE_FOR_CPU=$(ARCH)
68 DL_DIR:=$(BASE_DIR)/dl
69 BUILD_DIR:=$(BASE_DIR)/build_$(ARCH)$(ARCH_FPU_SUFFIX)
70 STAGING_DIR:=$(BASE_DIR)/staging_dir_$(ARCH)$(ARCH_FPU_SUFFIX)
71 SCRIPT_DIR:=$(BASE_DIR)/scripts
72 BIN_DIR:=$(BASE_DIR)/bin
73 STAMP_DIR:=$(BUILD_DIR)/stamp
74 PACKAGE_DIR:=$(BIN_DIR)/packages
75 STAMP_DIR:=$(BUILD_DIR)/stamp
76 TARGET_DIR:=$(BUILD_DIR)/root
77 TOOL_BUILD_DIR=$(BASE_DIR)/toolchain_build_$(ARCH)$(ARCH_FPU_SUFFIX)
78 TARGET_PATH=$(STAGING_DIR)/usr/bin:$(STAGING_DIR)/bin:/bin:/sbin:/usr/bin:/usr/sbin
79 IMAGE:=$(BUILD_DIR)/root_fs_$(ARCH)$(ARCH_FPU_SUFFIX)
80 REAL_GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux-uclibc
81 GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux
82 KERNEL_CROSS:=$(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-uclibc-
83 TARGET_CROSS:=$(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-uclibc-
84 TARGET_CC:=$(TARGET_CROSS)gcc
85 STRIP:=$(STAGING_DIR)/bin/sstrip
86 PATCH=$(SCRIPT_DIR)/patch-kernel.sh
87 SED:=$(STAGING_DIR)/bin/sed -i -e
88 LINUX_DIR:=$(BUILD_DIR)/linux
89 LINUX_HEADERS_DIR:=$(TOOL_BUILD_DIR)/linux
92 HOST_ARCH:=$(shell $(HOSTCC) -dumpmachine | sed -e s'/-.*//' \
93 -e 's/sparc.*/sparc/' \
96 -e 's/ppc/powerpc/g' \
97 -e 's/v850.*/v850/g' \
99 -e 's/mips-.*/mips/' \
100 -e 's/mipsel-.*/mipsel/' \
101 -e 's/cris.*/cris/' \
102 -e 's/i[3-9]86/i386/' \
104 GNU_HOST_NAME:=$(HOST_ARCH)-pc-linux-gnu
105 TARGET_CONFIGURE_OPTS=PATH=$(TARGET_PATH) \
106 AR=$(TARGET_CROSS)ar \
107 AS=$(TARGET_CROSS)as \
108 LD=$(TARGET_CROSS)ld \
109 NM=$(TARGET_CROSS)nm \
110 CC=$(TARGET_CROSS)gcc \
111 GCC=$(TARGET_CROSS)gcc \
112 CXX=$(TARGET_CROSS)g++ \
113 RANLIB=$(TARGET_CROSS)ranlib
115 ifeq ($(ENABLE_LOCALE),true)
118 DISABLE_NLS:=--disable-nls
121 ifeq ($(CONFIG_ENABLE_MULTILIB),y)
122 MULTILIB:=--enable-multilib
125 # invoke ipkg-build with some default options
126 IPKG_BUILD := PATH="$(TARGET_PATH)" ipkg-build -c -o root -g root
127 # where to build (and put) .ipk packages
128 IPKG_TARGET_DIR := $(PACKAGE_DIR)
129 IPKG:=IPKG_TMP=$(BUILD_DIR)/tmp IPKG_INSTROOT=$(TARGET_DIR) IPKG_CONF_DIR=$(STAGING_DIR)/etc IPKG_OFFLINE_ROOT=$(BUILD_DIR)/root $(SCRIPT_DIR)/ipkg -force-defaults -force-depends
130 IPKG_STATE_DIR := $(TARGET_DIR)/usr/lib/ipkg
132 RSTRIP:=STRIP="$(STRIP)" $(SCRIPT_DIR)/rstrip.sh
133 RSTRIP_KMOD:=STRIP="$(TARGET_CROSS)strip --strip-unneeded --remove-section=.comment" $(SCRIPT_DIR)/rstrip.sh