credit where credit is due
[openwrt.git] / target / linux / 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 default: clean all
8
9 TOPDIR:=${shell pwd}
10 export TOPDIR
11 IB:=1
12 export IB
13 include ./rules.mk
14
15 LINUX_BUILD_DIR:=$(BUILD_DIR)/linux-$(KERNEL)-$(BOARD)
16 IPKG_KERNEL:=IPKG_TMP=$(BUILD_DIR)/tmp IPKG_INSTROOT=$(LINUX_BUILD_DIR)/root IPKG_CONF_DIR=$(LINUX_BUILD_DIR) $(SCRIPT_DIR)/ipkg -force-defaults -force-depends
17
18 define image_template
19
20 all: all-$(1)-$(2)
21
22 all-$(1)-$(2):
23 @for listfile in ./lists/*.$(1)-$(2); do \
24 $(MAKE) -s `echo $$$$listfile | sed 's,.*lists/\(.*\).$(1)-$(2),BOARD=$(1) KERNEL=$(2) LIST=\1,'` build; \
25 done
26 endef
27
28 include ./kernel.mk
29
30 clean: FORCE
31 @rm -rf $(LINUX_BUILD_DIR)/root*
32 @rm -rf $(BIN_DIR)
33 all:
34
35 build: FORCE
36 echo
37 echo '### BUILDING IMAGE FROM lists/$(LIST).$(BOARD)-$(KERNEL)'
38 echo
39 rm -rf $(LINUX_BUILD_DIR)/root*
40 mkdir -p $(BIN_DIR)/$(LIST)
41 mkdir -p $(LINUX_BUILD_DIR)/tmp
42 mkdir -p $(LINUX_BUILD_DIR)/root
43 echo -e 'dest root /\noption offline_root $(LINUX_BUILD_DIR)/root' > $(LINUX_BUILD_DIR)/ipkg.conf
44 $(IPKG_KERNEL) install $(BUILD_DIR)/linux-$(KERNEL)-$(BOARD)/kernel[-_]*.ipk
45 for package in `grep -v '^#' lists/$(LIST).$(BOARD)-$(KERNEL)`; do \
46 $(IPKG_KERNEL) install `ls packages/$${package}_*`; \
47 done
48 if [ -d ./files ]; then \
49 $(CP) --remove-destination ./files/* $(LINUX_BUILD_DIR)/root; \
50 fi
51 if [ -d ./files.$(LIST) ]; then \
52 $(CP) --remove-destination ./files.$(LIST)/* $(LINUX_BUILD_DIR)/root; \
53 fi
54 find $(LINUX_BUILD_DIR)/root -name '.svn' || 'CVS' | xargs rm -rf
55 $(MAKE) -S -C image KERNEL="$(KERNEL)" BOARD="$(BOARD)" BIN_DIR="$(BIN_DIR)/$(LIST)" install
This page took 0.041336 seconds and 5 git commands to generate.