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