2 # Copyright (C) 2006-2008 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR)/rules.mk
9 include $(INCLUDE_DIR)/kernel.mk
10 include $(INCLUDE_DIR)/host.mk
14 PKG_OS:=$(word 2,$(subst -, ,$(shell $(HOSTCC) -dumpmachine)))
15 PKG_CPU:=$(word 1,$(subst -, ,$(shell $(HOSTCC) -dumpmachine)))
17 SDK_NAME:=OpenWrt-SDK-$(BOARD)-for-$(PKG_OS)-$(PKG_CPU)-gcc-$(GCCV)_$(LIBC)-$(LIBCV)
18 SDK_BUILD_DIR:=$(BUILD_DIR)/$(SDK_NAME)
19 EXCLUDE_DIRS:=*/ccache \
25 SVN_PACKAGE_URL=$(shell svn info ../../package | awk '/^URL:/ { print $$2; }')
29 $(BIN_DIR)/$(SDK_NAME).tar.bz2: clean
30 mkdir -p $(SDK_BUILD_DIR)/dl $(SDK_BUILD_DIR)/package
31 $(CP) $(INCLUDE_DIR) $(SCRIPT_DIR) $(TOPDIR)/docs $(SDK_BUILD_DIR)/
32 $(TAR) -cf - -C $(TOPDIR) \
33 $(foreach exclude,$(EXCLUDE_DIRS),--exclude="$(exclude)") \
34 --exclude="staging_dir/$(ARCH)" \
35 staging_dir/host staging_dir/target-$(ARCH)$(ARCH_SUFFIX)_$(LIBC)-$(LIBCV)$(if $(CONFIG_arm),_eabi) \
36 staging_dir/toolchain-$(ARCH)$(ARCH_SUFFIX)_gcc-$(GCCV)_$(LIBC)-$(LIBCV)$(if $(CONFIG_arm),_eabi) | \
37 $(TAR) -xf - -C $(SDK_BUILD_DIR)
38 mkdir -p $(SDK_BUILD_DIR)/target/linux
39 $(CP) $(GENERIC_PLATFORM_DIR) $(PLATFORM_DIR) $(SDK_BUILD_DIR)/target/linux/
41 $(SDK_BUILD_DIR)/target/linux/*/files \
42 $(SDK_BUILD_DIR)/target/linux/*/patches
52 ./files/package/rules.mk \
53 $(TOPDIR)/package/Makefile \
54 $(SDK_BUILD_DIR)/package/
55 $(if $(SVN_PACKAGE_URL),echo "src-svn trunk $(SVN_PACKAGE_URL)" \
56 > $(SDK_BUILD_DIR)/feeds.conf.default,\
57 -rm -f $(SDK_BUILD_DIR)/feeds.conf.default)
58 cat $(TOPDIR)/feeds.conf.default \
59 >> $(SDK_BUILD_DIR)/feeds.conf.default
60 $(SED) 's,^# REVISION:=.*,REVISION:=$(REVISION),g' $(SDK_BUILD_DIR)/include/version.mk
61 find $(SDK_BUILD_DIR) -name .git | $(XARGS) rm -rf
62 find $(SDK_BUILD_DIR) -name .svn | $(XARGS) rm -rf
63 find $(SDK_BUILD_DIR) -name CVS | $(XARGS) rm -rf
65 tar cfj $@ $(SDK_NAME); \
70 compile: $(BIN_DIR)/$(SDK_NAME).tar.bz2
74 rm -rf $(SDK_BUILD_DIR) $(BIN_DIR)/$(SDK_NAME).tar.bz2