2b9ceff6c3a95033122f05e54d09a6b5d932f64e
[openwrt/svn-archive/archive.git] / target / sdk / Makefile
1 #
2 # Copyright (C) 2006-2008 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 # $Id$
8
9 include $(TOPDIR)/rules.mk
10 include $(INCLUDE_DIR)/kernel.mk
11 include $(INCLUDE_DIR)/host.mk
12
13 override MAKEFLAGS=
14
15 PKG_OS:=$(shell uname -s)
16 PKG_CPU:=$(shell uname -m)
17
18 SDK_NAME:=OpenWrt-SDK-$(BOARD)-for-$(PKG_OS)-$(PKG_CPU)
19 SDK_BUILD_DIR:=$(BUILD_DIR)/$(SDK_NAME)
20 EXCLUDE_DIRS:=*/ccache */stamp */man */share */stampfiles */info
21
22 SVN_PACKAGE_URL=$(shell svn info ../../package | awk '/^URL:/ { print $$2; }')
23
24 all: compile
25
26 $(BIN_DIR)/$(SDK_NAME).tar.bz2: clean
27 mkdir -p $(SDK_BUILD_DIR)/dl $(SDK_BUILD_DIR)/package
28 $(CP) $(INCLUDE_DIR) $(SCRIPT_DIR) $(TOPDIR)/docs $(SDK_BUILD_DIR)/
29 $(TAR) -cf - -C $(TOPDIR) $(foreach exclude,$(EXCLUDE_DIRS),--exclude="$(exclude)") --exclude="staging_dir/$(ARCH)" staging_dir | \
30 $(TAR) -xf - -C $(SDK_BUILD_DIR)
31 mkdir -p $(SDK_BUILD_DIR)/target/linux
32 $(CP) $(GENERIC_PLATFORM_DIR) $(PLATFORM_DIR) $(SDK_BUILD_DIR)/target/linux/
33 rm -rf \
34 $(SDK_BUILD_DIR)/target/linux/*/files \
35 $(SDK_BUILD_DIR)/target/linux/*/patches
36 $(CP) \
37 $(TOPDIR)/LICENSE \
38 $(TOPDIR)/rules.mk \
39 $(TOPDIR)/.config \
40 ./files/Config.in \
41 ./files/Makefile \
42 ./files/README.SDK \
43 $(SDK_BUILD_DIR)/
44 $(CP) \
45 ./files/package/rules.mk \
46 $(TOPDIR)/package/Makefile \
47 $(SDK_BUILD_DIR)/package/
48 echo "src-svn trunk $(SVN_PACKAGE_URL)" \
49 > $(SDK_BUILD_DIR)/feeds.conf.default
50 cat $(TOPDIR)/feeds.conf.default \
51 >> $(SDK_BUILD_DIR)/feeds.conf.default
52 echo REVISION:="$(REVISION)" > $(SDK_BUILD_DIR)/include/version.mk
53 find $(SDK_BUILD_DIR) -name .git | $(XARGS) rm -rf
54 find $(SDK_BUILD_DIR) -name .svn | $(XARGS) rm -rf
55 find $(SDK_BUILD_DIR) -name CVS | $(XARGS) rm -rf
56 (cd $(BUILD_DIR); \
57 tar cfj $@ $(SDK_NAME); \
58 )
59
60 download:
61 prepare:
62 compile: $(BIN_DIR)/$(SDK_NAME).tar.bz2
63 install: compile
64
65 clean:
66 rm -rf $(SDK_BUILD_DIR) $(BIN_DIR)/$(SDK_NAME).tar.bz2