1 -include $(TOPDIR)/.config
5 ARCH:=$(strip $(subst ",, $(CONFIG_ARCH)))
6 TARGET_OPTIMIZATION:=$(strip $(subst ",, $(CONFIG_TARGET_OPTIMIZATION)))
7 WGET:=$(strip $(subst ",, $(CONFIG_WGET)))
8 #"))"))")) # fix vim's broken syntax highlighting
10 OPTIMIZE_FOR_CPU:=$(ARCH)
15 INCLUDE_DIR:=$(TOPDIR)/include
16 SCRIPT_DIR:=$(TOPDIR)/scripts
17 TOOL_BUILD_DIR:=$(TOPDIR)/toolchain_build_$(ARCH)
18 STAGING_DIR:=$(TOPDIR)/staging_dir_$(ARCH)
19 BIN_DIR:=$(TOPDIR)/bin
20 PACKAGE_DIR:=$(BIN_DIR)/packages
21 IPKG_TARGET_DIR:=$(PACKAGE_DIR)
22 BUILD_DIR:=$(TOPDIR)/build_$(ARCH)
23 STAMP_DIR:=$(BUILD_DIR)/stamp
24 TARGET_DIR:=$(BUILD_DIR)/root
25 IPKG_STATE_DIR:=$(TARGET_DIR)/usr/lib/ipkg
27 REAL_GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux-uclibc
28 GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux
29 KERNEL_CROSS:=$(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-uclibc-
30 TARGET_CROSS:=$(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-uclibc-
31 IMAGE:=$(BUILD_DIR)/root_fs_$(ARCH)
33 TARGET_PATH:=$(STAGING_DIR)/usr/bin:$(STAGING_DIR)/bin:/bin:/sbin:/usr/bin:/usr/sbin
34 TARGET_CFLAGS:=$(TARGET_OPTIMIZATION)
36 LINUX_DIR:=$(BUILD_DIR)/linux
37 LINUX_HEADERS_DIR:=$(TOOL_BUILD_DIR)/linux
41 TARGET_CC:=$(TARGET_CROSS)gcc
42 STRIP:=$(STAGING_DIR)/bin/sstrip
43 PATCH:=$(SCRIPT_DIR)/patch-kernel.sh
44 SED:=$(STAGING_DIR)/bin/sed -i -e
47 HOST_ARCH:=$(shell $(HOSTCC) -dumpmachine | sed -e s'/-.*//' \
48 -e 's/sparc.*/sparc/' \
54 -e 's/mips-.*/mips/' \
55 -e 's/mipsel-.*/mipsel/' \
57 -e 's/i[3-9]86/i386/' \
60 GNU_HOST_NAME:=$(HOST_ARCH)-pc-linux-gnu
62 TARGET_CONFIGURE_OPTS:= \
64 AR=$(TARGET_CROSS)ar \
65 AS=$(TARGET_CROSS)as \
66 LD=$(TARGET_CROSS)ld \
67 NM=$(TARGET_CROSS)nm \
68 CC=$(TARGET_CROSS)gcc \
69 GCC=$(TARGET_CROSS)gcc \
70 CXX=$(TARGET_CROSS)g++ \
71 RANLIB=$(TARGET_CROSS)ranlib \
72 STRIP=$(TARGET_CROSS)strip
74 # strip an entire directory
77 STRIP_KMOD="$(TARGET_CROSS)strip --strip-unneeded --remove-section=.comment" \
78 $(SCRIPT_DIR)/rstrip.sh
80 # where to build (and put) .ipk packages
82 IPKG_TMP=$(BUILD_DIR)/tmp \
83 IPKG_INSTROOT=$(TARGET_DIR) \
84 IPKG_CONF_DIR=$(STAGING_DIR)/etc \
85 IPKG_OFFLINE_ROOT=$(BUILD_DIR)/root \
86 $(SCRIPT_DIR)/ipkg -force-defaults -force-depends
88 # invoke ipkg-build with some default options
90 PATH="$(TARGET_PATH)" ipkg-build -c -o root -g root
92 ifeq ($(CONFIG_ENABLE_LOCALE),true)
95 DISABLE_NLS:=--disable-nls
98 ifneq ($(CONFIG_LARGEFILE),y)
99 DISABLE_LARGEFILE= --disable-largefile
102 ifeq ($(CONFIG_TAR_VERBOSITY),y)