merge r16201 to 8.09
[openwrt/svn-archive/archive.git] / target / imagebuilder / Makefile
1 #
2 # Copyright (C) 2006 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: Makefile 6070 2007-01-10 21:21:59Z nbd $
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 | sed "s/ //g")
17
18 IB_NAME:=OpenWrt-ImageBuilder-$(BOARD)-for-$(PKG_OS)-$(PKG_CPU)
19 PKG_BUILD_DIR:=$(BUILD_DIR)/$(IB_NAME)
20 IB_KDIR:=$(patsubst $(TOPDIR)/%,$(PKG_BUILD_DIR)/%,$(KERNEL_BUILD_DIR))
21
22 all: compile
23
24 $(BIN_DIR)/$(IB_NAME).tar.bz2: clean
25 rm -rf $(PKG_BUILD_DIR)
26 mkdir -p $(IB_KDIR) $(PKG_BUILD_DIR)/staging_dir/host $(PKG_BUILD_DIR)/target
27 $(CP) \
28 $(INCLUDE_DIR) $(SCRIPT_DIR) \
29 $(TOPDIR)/rules.mk $(TOPDIR)/.config \
30 ./files/Makefile \
31 $(TMP_DIR)/.targetinfo \
32 $(TMP_DIR)/.packageinfo \
33 $(PKG_BUILD_DIR)/
34 $(CP) $(PACKAGE_DIR) $(PKG_BUILD_DIR)/packages
35 $(CP) $(TOOLCHAIN_DIR)/bin $(PKG_BUILD_DIR)/staging_dir/host/
36 $(CP) $(STAGING_DIR_HOST)/bin/* $(PKG_BUILD_DIR)/staging_dir/host/bin/
37 $(CP) $(TOPDIR)/target/linux $(PKG_BUILD_DIR)/target/
38 rm -rf \
39 $(PKG_BUILD_DIR)/target/linux/*/patches \
40 $(PKG_BUILD_DIR)/target/linux/*/*/patches
41 -cp $(KERNEL_BUILD_DIR)/* $(IB_KDIR)/ # don't copy subdirectories here
42 find $(PKG_BUILD_DIR) -name .svn | $(XARGS) rm -rf
43 find $(PKG_BUILD_DIR) -name CVS | $(XARGS) rm -rf
44 find $(PKG_BUILD_DIR) -name .git | $(XARGS) rm -rf
45 $(TAR) c -C $(BUILD_DIR) $(IB_NAME) | bzip2 -c > $@
46
47 download:
48 prepare:
49 compile: $(BIN_DIR)/$(IB_NAME).tar.bz2
50 install: compile
51
52 clean: FORCE
53 rm -rf $(PKG_BUILD_DIR) $(BIN_DIR)/$(IB_NAME).tar.bz2