2 # Copyright (C) 2006 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 -include $(TOPDIR
)/.config
9 include $(TOPDIR
)/include/host.mk
10 include $(TOPDIR
)/include/verbose.mk
12 export SHELL
=/usr
/bin
/env bash
-c
'. $(TOPDIR)/include/shell.sh; eval "$$2"' --
13 export BASH
=$(shell which bash
)
15 ARCH
:=$(strip $(subst ",, $(CONFIG_ARCH)))
16 TARGET_OPTIMIZATION:=$(strip $(subst ",, $(CONFIG_TARGET_OPTIMIZATION
)))
17 WGET
:=$(strip $(subst ",, $(CONFIG_WGET)))
18 #"))"))")) # fix vim's broken syntax highlighting
20 OPTIMIZE_FOR_CPU
:=$(ARCH
)
25 INCLUDE_DIR
:=$(TOPDIR
)/include
26 SCRIPT_DIR
:=$(TOPDIR
)/scripts
27 TOOL_BUILD_DIR
:=$(TOPDIR
)/tool_build
28 TOOLCHAIN_BUILD_DIR
:=$(TOPDIR
)/toolchain_build_
$(ARCH
)
29 STAGING_DIR
:=$(TOPDIR
)/staging_dir_
$(ARCH
)
30 BIN_DIR
:=$(TOPDIR
)/bin
31 PACKAGE_DIR
:=$(BIN_DIR
)/packages
32 IPKG_TARGET_DIR
:=$(PACKAGE_DIR
)
33 BUILD_DIR
:=$(TOPDIR
)/build_
$(ARCH
)
34 TMP_DIR
:=$(BUILD_DIR
)/tmp
35 STAMP_DIR
:=$(BUILD_DIR
)/stamp
36 TARGET_DIR
:=$(BUILD_DIR
)/root
37 IPKG_STATE_DIR
:=$(TARGET_DIR
)/usr
/lib
/ipkg
39 ifeq ($(CONFIG_NATIVE_TOOLCHAIN
),)
40 REAL_GNU_TARGET_NAME
=$(OPTIMIZE_FOR_CPU
)-linux-uclibc
41 GNU_TARGET_NAME
=$(OPTIMIZE_FOR_CPU
)-linux
42 TARGET_CROSS
:=$(OPTIMIZE_FOR_CPU
)-linux-uclibc-
45 IMAGE
:=$(BUILD_DIR
)/root_fs_
$(ARCH
)
47 TARGET_PATH
:=$(STAGING_DIR
)/usr
/bin
:$(STAGING_DIR
)/bin
:$(PATH
)
48 TARGET_CFLAGS
:=$(TARGET_OPTIMIZATION
)
50 export PATH
:=$(TARGET_PATH
)
52 LINUX_DIR
:=$(BUILD_DIR
)/linux
53 LINUX_HEADERS_DIR
:=$(TOOLCHAIN_BUILD_DIR
)/linux
57 TARGET_CC
:=$(TARGET_CROSS
)gcc
58 STRIP
:=$(STAGING_DIR
)/bin
/sstrip
59 PATCH
:=$(SCRIPT_DIR
)/patch-kernel.sh
60 SED
:=$(STAGING_DIR
)/bin
/sed
-i
-e
63 ifneq ($(CONFIG_CCACHE
),)
64 # FIXME: move this variable to a better location
65 export CCACHE_DIR
=$(STAGING_DIR
)/ccache
66 TARGET_CC
:= ccache
$(TARGET_CC
)
69 TARGET_CONFIGURE_OPTS
:= \
70 AR
=$(TARGET_CROSS
)ar \
71 AS
="$(TARGET_CC) -c $(TARGET_CFLAGS)" \
72 LD
=$(TARGET_CROSS
)ld \
73 NM
=$(TARGET_CROSS
)nm \
76 CXX
=$(TARGET_CROSS
)g
++ \
77 RANLIB
=$(TARGET_CROSS
)ranlib \
78 STRIP
=$(TARGET_CROSS
)strip
80 # strip an entire directory
83 STRIP_KMOD
="$(TARGET_CROSS)strip --strip-unneeded --remove-section=.comment" \
84 $(SCRIPT_DIR
)/rstrip.sh
86 # where to build (and put) .ipk packages
88 IPKG_TMP
=$(BUILD_DIR
)/tmp \
89 IPKG_INSTROOT
=$(TARGET_DIR
) \
90 IPKG_CONF_DIR
=$(STAGING_DIR
)/etc \
91 IPKG_OFFLINE_ROOT
=$(BUILD_DIR
)/root \
92 $(SCRIPT_DIR
)/ipkg
-force-defaults
-force-depends
94 # invoke ipkg-build with some default options
96 ipkg-build
-c
-o
0 -g
0
98 ifeq ($(CONFIG_ENABLE_LOCALE
),true
)
101 DISABLE_NLS
:=--disable-nls
104 ifneq ($(CONFIG_LARGEFILE
),y
)
105 DISABLE_LARGEFILE
= --disable-largefile
108 ifeq ($(CONFIG_TAR_VERBOSITY
),y
)