large target/linux cleanup
[openwrt.git] / 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/linux-$(1)/clean
13 $(MAKE) -C $(2)-$(1) BOARD="$(2)" clean
14
15 $(1)/$(2)-prepare:
16 @$(TRACE) target/linux/linux-$(1)/prepare
17 $(MAKE) -C $(2)-$(1) BOARD="$(2)" prepare
18
19 $(1)/$(2)-compile:
20 @$(TRACE) target/linux/linux-$(1)/compile
21 $(MAKE) -C $(2)-$(1) BOARD="$(2)" compile
22
23 $(1)/$(2)-rebuild:
24 @$(TRACE) target/linux/linux-$(1)/rebuild
25 $(MAKE) -C $(2)-$(1) BOARD="$(2)" rebuild
26
27 $(1)/$(2)-install:
28 @$(TRACE) target/linux/linux-$(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 endif
49
50 .PHONY: $(1)/$(2)-clean $(1)/$(2)-prepare $(1)/$(2)-compile $(1)/$(2)-rebuild $(1)/$(2)-install $(1)/$(2)-image $(1)/$(2)-install-ib
51 endef
52
53 .PHONY: clean prepare compile rebuild install imagebuilder install-ib
54
55 install-ib:
56
57 $(BIN_DIR)/$(IB_NAME).tar.bz2:
58 rm -rf $(IB_DIR)
59 mkdir -p $(IB_DIR)/packages
60 mkdir -p $(IB_DIR)/scripts
61 cp -fpR ./imagebuilder/* $(IB_DIR)/
62 cp -fpR $(TOPDIR)/bin/packages/*.ipk $(IB_DIR)/packages/
63 cp $(TOPDIR)/scripts/ipkg $(IB_DIR)/scripts/
64 $(MAKE) install-ib
65 cp $(TOPDIR)/rules.mk $(IB_DIR)
66 cp -fpR ./image $(IB_DIR)/
67 cp $(TOPDIR)/.config $(IB_DIR)/
68 find $(IB_DIR) -name .svn | xargs rm -rf
69 find $(IB_DIR) -name CVS | xargs rm -rf
70 (cd $(BUILD_DIR); tar c $(IB_NAME) | bzip2 -c > $(BIN_DIR)/$(IB_NAME).tar.bz2)
71
72 ifeq ($(BR2_PACKAGE_IMAGEBUILDER),y)
73 install: $(BIN_DIR)/$(IB_NAME).tar.bz2
74 endif
75
76 prepare:
77 @$(TRACE) target/linux/image/prepare
78 $(MAKE) -C image prepare
79 compile:
80 @$(TRACE) target/linux/image/compile
81 $(MAKE) -C image compile
82 install:
83 rebuild:
84 clean:
85
86 $(eval $(call kernel_template,2.4,brcm,2_4_BRCM))
87 $(eval $(call kernel_template,2.4,ar7,2_4_AR7))
88 $(eval $(call kernel_template,2.4,x86,2_4_X86))
89 $(eval $(call kernel_template,2.6,brcm,2_6_BRCM))
90 $(eval $(call kernel_template,2.6,x86,2_6_X86))
91 $(eval $(call kernel_template,2.4,ar531x,2_4_AR531X))
This page took 0.042463 seconds and 5 git commands to generate.