fix the image builder
[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 PKG_OS:=$(shell uname -s)
14 PKG_CPU:=$(shell uname -m | sed "s/ //g")
15
16 IB_NAME:=OpenWrt-ImageBuilder-$(BOARD)-$(KERNEL)-for-$(PKG_OS)-$(PKG_CPU)
17 PKG_BUILD_DIR:=$(BUILD_DIR)/$(IB_NAME)
18 IB_KDIR:=$(patsubst $(TOPDIR)/%,$(PKG_BUILD_DIR)/%,$(KERNEL_BUILD_DIR))
19
20 all: compile
21
22 $(BIN_DIR)/$(IB_NAME).tar.bz2: clean
23 rm -rf $(PKG_BUILD_DIR)
24 mkdir -p $(IB_KDIR) $(PKG_BUILD_DIR)/staging_dir/host $(PKG_BUILD_DIR)/target
25 $(CP) \
26 $(INCLUDE_DIR) $(SCRIPT_DIR) $(PACKAGE_DIR) \
27 $(TOPDIR)/rules.mk $(TOPDIR)/.config \
28 ./files/Makefile \
29 $(TMP_DIR)/.targetinfo \
30 $(TMP_DIR)/.packageinfo \
31 $(PKG_BUILD_DIR)/
32 $(CP) $(TOOLCHAIN_DIR)/bin $(PKG_BUILD_DIR)/staging_dir/host/
33 $(CP) $(STAGING_DIR_HOST)/bin/* $(PKG_BUILD_DIR)/staging_dir/host/bin/
34 $(CP) $(TOPDIR)/target/linux $(PKG_BUILD_DIR)/target/
35 rm -rf \
36 $(PKG_BUILD_DIR)/target/linux/*/patches \
37 $(PKG_BUILD_DIR)/target/linux/*/*/patches
38 -cp $(KERNEL_BUILD_DIR)/* $(IB_KDIR)/ # don't copy subdirectories here
39 find $(PKG_BUILD_DIR) -name .svn | $(XARGS) rm -rf
40 find $(PKG_BUILD_DIR) -name CVS | $(XARGS) rm -rf
41 find $(PKG_BUILD_DIR) -name .git | $(XARGS) rm -rf
42 $(TAR) c -C $(BUILD_DIR) $(IB_NAME) | bzip2 -c > $@
43
44 download:
45 prepare:
46 compile: $(BIN_DIR)/$(IB_NAME).tar.bz2
47 install: compile
48
49 clean: FORCE
50 rm -rf $(PKG_BUILD_DIR) $(BIN_DIR)/$(IB_NAME).tar.bz2