let ipkg fail when a package file to be installed is not found
[openwrt/svn-archive/archive.git] / openwrt / target / linux / Makefile
1 include $(TOPDIR)/rules.mk
2
3 PKG_OS:=$(shell uname -s)
4 PKG_CPU:=$(shell uname -m)
5
6 IB_NAME:=OpenWrt-ImageBuilder-$(PKG_OS)-$(PKG_CPU)
7 IB_DIR:=$(BUILD_DIR)/$(IB_NAME)
8
9 define kernel_template
10
11 $(1)/$(2)-clean:
12 @$(TRACE) target/linux/$(2)-$(1)-clean
13 $(MAKE) -C $(2)-$(1) BOARD="$(2)" clean
14
15 $(1)/$(2)-prepare:
16 @$(TRACE) target/linux/$(2)-$(1)-prepare
17 $(MAKE) -C $(2)-$(1) BOARD="$(2)" prepare
18
19 $(1)/$(2)-compile:
20 @$(TRACE) target/linux/$(2)-$(1)-compile
21 $(MAKE) -C $(2)-$(1) BOARD="$(2)" compile
22
23 $(1)/$(2)-rebuild:
24 @$(TRACE) target/linux/$(2)-$(1)-rebuild
25 $(MAKE) -C $(2)-$(1) BOARD="$(2)" rebuild
26
27 $(1)/$(2)-install:
28 @$(TRACE) target/linux/$(2)-$(1)-install
29 $(MAKE) -C $(2)-$(1) BOARD="$(2)" install
30
31 $(1)/$(2)-image: $(1)/$(2)-install
32 @$(TRACE) target/linux/image-install
33 $(MAKE) -C image KERNEL="$(1)" BOARD="$(2)" install
34
35 $(1)/$(2)-install-ib:
36 @$(TRACE) target/linux/image-install-ib
37 $(MAKE) -C image KERNEL="$(1)" BOARD="$(2)" IB_DIR="$(IB_DIR)" install-ib
38 echo '$$$$(eval $$$$(call image_template,$(2),$(1)))' >> $(IB_DIR)/kernel.mk
39
40
41 ifeq ($(BR2_LINUX_$(3)),y)
42 clean: $(1)/$(2)-clean
43 prepare: $(1)/$(2)-prepare
44 compile: $(1)/$(2)-compile
45 rebuild: $(1)/$(2)-rebuild
46 $(BIN_DIR)/$(IB_NAME).tar.bz2 install: $(1)/$(2)-image
47 install-ib: $(1)/$(2)-install-ib
48 package/%:
49 $(MAKE) -C $(2)-$(1) BOARD="$(2)" $$@
50 endif
51
52 .PHONY: $(1)/$(2)-clean $(1)/$(2)-prepare $(1)/$(2)-compile $(1)/$(2)-rebuild $(1)/$(2)-install $(1)/$(2)-image $(1)/$(2)-install-ib
53 endef
54
55 .PHONY: clean prepare compile rebuild install imagebuilder install-ib
56
57 install-ib:
58
59 $(BIN_DIR)/$(IB_NAME).tar.bz2:
60 rm -rf $(IB_DIR)
61 mkdir -p $(IB_DIR)/packages
62 mkdir -p $(IB_DIR)/scripts
63 $(CP) ./imagebuilder/* $(IB_DIR)/
64 $(CP) $(TOPDIR)/bin/packages/*.ipk $(IB_DIR)/packages/
65 $(CP) $(TOPDIR)/scripts/ipkg $(IB_DIR)/scripts/
66 $(MAKE) install-ib
67 $(CP) $(TOPDIR)/rules.mk $(IB_DIR)
68 $(CP) ./image $(IB_DIR)/
69 $(CP) $(TOPDIR)/.config $(IB_DIR)/
70 find $(IB_DIR) -name .svn | xargs rm -rf
71 find $(IB_DIR) -name CVS | xargs rm -rf
72 (cd $(BUILD_DIR); tar c $(IB_NAME) | bzip2 -c > $(BIN_DIR)/$(IB_NAME).tar.bz2)
73
74 ifeq ($(BR2_PACKAGE_IMAGEBUILDER),y)
75 install: $(BIN_DIR)/$(IB_NAME).tar.bz2
76 endif
77
78 prepare:
79 @$(TRACE) target/linux/image-prepare
80 $(MAKE) -C image prepare
81 compile:
82 @$(TRACE) target/linux/image-compile
83 $(MAKE) -C image compile
84 install:
85 rebuild:
86 clean:
87
88 $(eval $(call kernel_template,2.4,brcm,2_4_BRCM))
89 $(eval $(call kernel_template,2.4,ar7,2_4_AR7))
90 $(eval $(call kernel_template,2.4,x86,2_4_X86))
91 $(eval $(call kernel_template,2.6,brcm,2_6_BRCM))
92 $(eval $(call kernel_template,2.6,x86,2_6_X86))
93 $(eval $(call kernel_template,2.4,ar531x,2_4_AR531X))
94 $(eval $(call kernel_template,2.6,aruba,2_6_ARUBA))
95 $(eval $(call kernel_template,2.6,au1000,2_6_AU1000))
96 $(eval $(call kernel_template,2.6,xscale,2_6_XSCALE))
97 $(eval $(call kernel_template,2.6,sibyte,2_6_SIBYTE))