1 | # DebWrt - Debian on Embedded devices |
---|
2 | # |
---|
3 | # Copyright (C) 2010 Johan van Zoomeren <amain@debwrt.net> |
---|
4 | # |
---|
5 | # This program is free software: you can redistribute it and/or modify |
---|
6 | # it under the terms of the GNU General Public License as published by |
---|
7 | # the Free Software Foundation, either version 3 of the License, or |
---|
8 | # (at your option) any later version. |
---|
9 | # |
---|
10 | # This program is distributed in the hope that it will be useful, |
---|
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
13 | # GNU General Public License for more details. |
---|
14 | # |
---|
15 | # You should have received a copy of the GNU General Public License |
---|
16 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
17 | |
---|
18 | OPENWRT_PATCHES_DIR=$(TOPDIR)/openwrt/patches |
---|
19 | |
---|
20 | openwrt/all: openwrt/build |
---|
21 | $(MAKE) -C $(TOPDIR) openwrt/deliver |
---|
22 | touch $@ |
---|
23 | |
---|
24 | openwrt/build: openwrt/prepare |
---|
25 | ifeq ("$(origin V)", "command line") |
---|
26 | $(SCRIPT_CLEAN_EXEC) $(MAKE) -C $(OPENWRT_BUILD_DIR) $(CONFIG_OPENWRT_MAKE_OPTIONS) V=$(V) |
---|
27 | else |
---|
28 | $(SCRIPT_CLEAN_EXEC) $(MAKE) -C $(OPENWRT_BUILD_DIR) $(CONFIG_OPENWRT_MAKE_OPTIONS) |
---|
29 | endif |
---|
30 | touch $@ |
---|
31 | |
---|
32 | openwrt/download: |
---|
33 | ifeq ("$(origin V)", "command line") |
---|
34 | $(SCRIPT_CLEAN_EXEC) $(MAKE) -C $(OPENWRT_BUILD_DIR) download V=$(V) |
---|
35 | else |
---|
36 | $(SCRIPT_CLEAN_EXEC) $(MAKE) -C $(OPENWRT_BUILD_DIR) download |
---|
37 | endif |
---|
38 | touch $@ |
---|
39 | |
---|
40 | openwrt/prepare: \ |
---|
41 | openwrt/checkout \ |
---|
42 | openwrt/patch \ |
---|
43 | plugins/apply-openwrt \ |
---|
44 | openwrt/merge-config \ |
---|
45 | openwrt/download-link \ |
---|
46 | # end openwrt/prepare: |
---|
47 | touch $@ |
---|
48 | |
---|
49 | openwrt/merge-config: .config $(OPENWRT_BUILD_DIR)/.config openwrt/checkout openwrt/patch |
---|
50 | mkdir -p $(TMP_DIR) |
---|
51 | # Copy default OpenWrt settings |
---|
52 | cp $(CONFIG_DIR)/openwrt.defconfig $(TMP_DIR)/.config_openwrt |
---|
53 | # Merge default OpenWrt settings with menu settings |
---|
54 | #cat .config | grep -v -e CONFIG_TARGET_BOARD -e "^#" >> $(TMP_DIR)/.config_openwrt |
---|
55 | cat .config | grep -v -e CONFIG_TARGET_BOARD >> $(TMP_DIR)/.config_openwrt |
---|
56 | # Merge default and menu settings with possibly altered settings in make menuconfig in OpenWrt |
---|
57 | touch $(OPENWRT_BUILD_DIR)/.config |
---|
58 | cp $(OPENWRT_BUILD_DIR)/.config $(OPENWRT_BUILD_DIR)/.config.org |
---|
59 | $(SCRIPT_KCONFIG) + $(OPENWRT_BUILD_DIR)/.config.org $(TMP_DIR)/.config_openwrt > $(OPENWRT_BUILD_DIR)/.config |
---|
60 | # Make sure the config is clean |
---|
61 | $(SCRIPT_CLEAN_EXEC) $(MAKE) -C $(OPENWRT_BUILD_DIR) defconfig |
---|
62 | # Copy DebWrt config to the build dir used to set kernel compile options |
---|
63 | cp .config $(OPENWRT_BUILD_DIR)/.config.debwrt |
---|
64 | touch $@ |
---|
65 | |
---|
66 | $(OPENWRT_BUILD_DIR)/.config: openwrt/checkout |
---|
67 | [ ! -f $@ ] && touch $(OPENWRT_BUILD_DIR)/.config |
---|
68 | |
---|
69 | openwrt/download-link: openwrt/checkout |
---|
70 | ifneq ($(OPENWRT_DOWNLOAD_DIR),) |
---|
71 | cd $(OPENWRT_BUILD_DIR) && if [ -d $(OPENWRT_DOWNLOAD_DIR) -a ! -e dl ]; then ln -snf $(OPENWRT_DOWNLOAD_DIR) dl; fi |
---|
72 | endif |
---|
73 | touch $@ |
---|
74 | |
---|
75 | openwrt/patch: openwrt/checkout |
---|
76 | patch -d $(OPENWRT_BUILD_DIR) -p 0 -N \ |
---|
77 | < $(PATCHES_DIR_OPENWRT)/001_disable_all_openwrt_packages |
---|
78 | ifeq ($(IS_OPENWRT_TRUNK),y) |
---|
79 | patch -d $(OPENWRT_BUILD_DIR) -p 0 -N \ |
---|
80 | < $(PATCHES_DIR_OPENWRT)/trunk/002_install_kernel_modules_and_merge_debwrt_config |
---|
81 | patch -d $(OPENWRT_BUILD_DIR) -p 0 -N \ |
---|
82 | < $(PATCHES_DIR_OPENWRT)/trunk/005_make_empty_rootfs |
---|
83 | patch -d $(OPENWRT_BUILD_DIR) -p 1 -N \ |
---|
84 | < $(PATCHES_DIR_OPENWRT)/trunk/006_reverse-changeset27849-changes.patch |
---|
85 | else ifeq ($(IS_OPENWRT_BACKFIRE),y) |
---|
86 | patch -d $(OPENWRT_BUILD_DIR) -p 0 -N \ |
---|
87 | < $(PATCHES_DIR_OPENWRT)/backfire/002_install_kernel_modules_and_merge_debwrt_config |
---|
88 | patch -d $(OPENWRT_BUILD_DIR) -p 0 -N \ |
---|
89 | < $(PATCHES_DIR_OPENWRT)/backfire/005_make_empty_rootfs |
---|
90 | endif |
---|
91 | #patch -d $(OPENWRT_BUILD_DIR) -p 0 -N \ |
---|
92 | < $(PATCHES_DIR_OPENWRT)/003_set_kernel_version |
---|
93 | patch -d $(OPENWRT_BUILD_DIR) -p 0 -N \ |
---|
94 | < $(PATCHES_DIR_OPENWRT)/004_save_environment_variables |
---|
95 | touch $@ |
---|
96 | |
---|
97 | $(OPENWRT_BUILD_DIR)/.debwrt.checkout.stamp: |
---|
98 | openwrt/checkout: $(OPENWRT_BUILD_DIR)/.debwrt.checkout.stamp |
---|
99 | rm -rf $(OPENWRT_BUILD_DIR) |
---|
100 | mkdir -p $(OPENWRT_BUILD_DIR) |
---|
101 | ifeq ($(IS_OPENWRT_TRUNK),y) |
---|
102 | cd $(OPENWRT_BUILD_DIR) && \ |
---|
103 | svn co svn://svn.openwrt.org/openwrt/trunk/ . |
---|
104 | else ifeq ($(IS_OPENWRT_BACKFIRE),y) |
---|
105 | cd $(OPENWRT_BUILD_DIR) && \ |
---|
106 | svn co svn://svn.openwrt.org/openwrt/branches/backfire/ . |
---|
107 | else |
---|
108 | cd $(OPENWRT_BUILD_DIR) && \ |
---|
109 | svn co -r $(OPENWRT_REVISION) svn://svn.openwrt.org/openwrt/trunk/ . |
---|
110 | endif |
---|
111 | touch $(OPENWRT_BUILD_DIR)/.debwrt.checkout.stamp |
---|
112 | touch $@ |
---|
113 | |
---|
114 | openwrt/update: openwrt/checkout |
---|
115 | cd $(OPENWRT_BUILD_DIR) && svn update |
---|
116 | |
---|
117 | openwrt/menuconfig: openwrt/prepare |
---|
118 | $(SCRIPT_CLEAN_EXEC) $(MAKE) -C $(OPENWRT_BUILD_DIR) menuconfig |
---|
119 | |
---|
120 | # Tune kernel configuration |
---|
121 | openwrt/kernel_menuconfig: openwrt/prepare |
---|
122 | $(SCRIPT_CLEAN_EXEC) $(MAKE) -C $(OPENWRT_BUILD_DIR) kernel_menuconfig |
---|
123 | rm -f openwrt/build |
---|
124 | |
---|
125 | openwrt/clean: |
---|
126 | $(SCRIPT_CLEAN_EXEC) $(MAKE) -C $(OPENWRT_BUILD_DIR) clean V=$(V) |
---|
127 | |
---|
128 | openwrt/dirclean: |
---|
129 | $(SCRIPT_CLEAN_EXEC) $(MAKE) -C $(OPENWRT_BUILD_DIR) dirclean V=$(V) |
---|
130 | |
---|
131 | openwrt/distclean: |
---|
132 | $(SCRIPT_CLEAN_EXEC) $(MAKE) -C $(OPENWRT_BUILD_DIR) distclean V=$(V) |
---|
133 | |
---|
134 | openwrt/debwrt-clean: |
---|
135 | rm -rf $(OPENWRT_BUILD_DIR) |
---|
136 | rm -f openwrt/checkout |
---|
137 | rm -f openwrt/patch |
---|