source: trunk/openwrt/openwrt.mk @ 288

Last change on this file since 288 was 288, checked in by amain, 8 years ago

Add menuconfig option to pass commandline parameters to openwrt make ( by default -j 3 is passed )

File size: 4.8 KB
Line 
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
18OPENWRT_PATCHES_DIR=$(TOPDIR)/openwrt/patches
19
20openwrt/all: openwrt/build
21        $(MAKE) -C $(TOPDIR) openwrt/deliver
22        touch $@
23
24openwrt/build: openwrt/prepare
25ifeq ("$(origin V)", "command line")
26        $(SCRIPT_CLEAN_EXEC) $(MAKE) -C $(OPENWRT_BUILD_DIR) $(CONFIG_OPENWRT_MAKE_OPTIONS) V=$(V)
27else
28        $(SCRIPT_CLEAN_EXEC) $(MAKE) -C $(OPENWRT_BUILD_DIR) $(CONFIG_OPENWRT_MAKE_OPTIONS)
29endif
30        touch $@
31
32openwrt/download:
33ifeq ("$(origin V)", "command line")
34        $(SCRIPT_CLEAN_EXEC) $(MAKE) -C $(OPENWRT_BUILD_DIR) download V=$(V)
35else
36        $(SCRIPT_CLEAN_EXEC) $(MAKE) -C $(OPENWRT_BUILD_DIR) download
37endif
38        touch $@
39
40openwrt/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
49openwrt/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
69openwrt/download-link: openwrt/checkout
70ifneq ($(OPENWRT_DOWNLOAD_DIR),)
71        cd $(OPENWRT_BUILD_DIR) && if [ -d $(OPENWRT_DOWNLOAD_DIR) -a ! -e dl ]; then ln -snf $(OPENWRT_DOWNLOAD_DIR) dl; fi
72endif
73        touch $@
74
75openwrt/patch: openwrt/checkout
76        patch -d $(OPENWRT_BUILD_DIR) -p 0 -N \
77          < $(PATCHES_DIR_OPENWRT)/001_disable_all_openwrt_packages
78ifeq ($(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
83else ifeq ($(IS_OPENWRT_BACKFIRE),y)
84        patch -d $(OPENWRT_BUILD_DIR) -p 0 -N \
85          < $(PATCHES_DIR_OPENWRT)/backfire/002_install_kernel_modules_and_merge_debwrt_config
86        patch -d $(OPENWRT_BUILD_DIR) -p 0 -N \
87          < $(PATCHES_DIR_OPENWRT)/backfire/005_make_empty_rootfs
88endif
89        #patch -d $(OPENWRT_BUILD_DIR) -p 0 -N \
90          < $(PATCHES_DIR_OPENWRT)/003_set_kernel_version
91        patch -d $(OPENWRT_BUILD_DIR) -p 0 -N \
92          < $(PATCHES_DIR_OPENWRT)/004_save_environment_variables
93        touch $@
94
95$(OPENWRT_BUILD_DIR)/.debwrt.checkout.stamp:
96openwrt/checkout: $(OPENWRT_BUILD_DIR)/.debwrt.checkout.stamp
97        rm -rf $(OPENWRT_BUILD_DIR)
98        mkdir -p $(OPENWRT_BUILD_DIR)
99ifeq ($(IS_OPENWRT_TRUNK),y)
100        cd $(OPENWRT_BUILD_DIR) && \
101          svn co svn://svn.openwrt.org/openwrt/trunk/ .
102else ifeq ($(IS_OPENWRT_BACKFIRE),y)
103        cd $(OPENWRT_BUILD_DIR) && \
104          svn co svn://svn.openwrt.org/openwrt/branches/backfire/ .
105else
106        cd $(OPENWRT_BUILD_DIR) && \
107          svn co -r $(OPENWRT_REVISION) svn://svn.openwrt.org/openwrt/trunk/ .
108endif
109        touch $(OPENWRT_BUILD_DIR)/.debwrt.checkout.stamp
110        touch $@
111
112openwrt/update: openwrt/checkout
113        cd $(OPENWRT_BUILD_DIR) && svn update
114
115openwrt/menuconfig: openwrt/prepare
116        $(SCRIPT_CLEAN_EXEC) $(MAKE) -C $(OPENWRT_BUILD_DIR) menuconfig
117
118# Tune kernel configuration
119openwrt/kernel_menuconfig: openwrt/prepare
120        $(SCRIPT_CLEAN_EXEC) $(MAKE) -C $(OPENWRT_BUILD_DIR) kernel_menuconfig
121        rm -f openwrt/build
122
123openwrt/clean:
124        $(SCRIPT_CLEAN_EXEC) $(MAKE) -C $(OPENWRT_BUILD_DIR) clean V=$(V)
125
126openwrt/dirclean:
127        $(SCRIPT_CLEAN_EXEC) $(MAKE) -C $(OPENWRT_BUILD_DIR) dirclean V=$(V)
128
129openwrt/distclean:
130        $(SCRIPT_CLEAN_EXEC) $(MAKE) -C $(OPENWRT_BUILD_DIR) distclean V=$(V)
131
132openwrt/debwrt-clean:
133        rm -rf $(OPENWRT_BUILD_DIR)
134        rm -f openwrt/checkout
135        rm -f openwrt/patch
Note: See TracBrowser for help on using the repository browser.