| 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) V=$(V) |
|---|
| 27 | else |
|---|
| 28 | $(SCRIPT_CLEAN_EXEC) $(MAKE) -C $(OPENWRT_BUILD_DIR) |
|---|
| 29 | endif |
|---|
| 30 | touch $@ |
|---|
| 31 | |
|---|
| 32 | openwrt/prepare: openwrt/checkout openwrt/patch openwrt/merge-config openwrt/download-link |
|---|
| 33 | touch $@ |
|---|
| 34 | |
|---|
| 35 | openwrt/merge-config: .config $(OPENWRT_BUILD_DIR)/.config openwrt/checkout openwrt/patch |
|---|
| 36 | mkdir -p $(TMP_DIR) |
|---|
| 37 | @# Copy default OpenWrt settings |
|---|
| 38 | cp $(CONFIG_DIR)/openwrt.defconfig $(TMP_DIR)/.config_openwrt |
|---|
| 39 | @# Merge default OpenWrt settings with menu settings |
|---|
| 40 | cat .config | grep -v -e CONFIG_TARGET_BOARD -e "^#" >> $(TMP_DIR)/.config_openwrt |
|---|
| 41 | @# Merge default and menu settings with possibly altered settings in make menuconfig in OpenWrt |
|---|
| 42 | touch $(OPENWRT_BUILD_DIR)/.config |
|---|
| 43 | cp $(OPENWRT_BUILD_DIR)/.config $(OPENWRT_BUILD_DIR)/.config.org |
|---|
| 44 | @$(SCRIPT_KCONFIG) + $(OPENWRT_BUILD_DIR)/.config.org $(TMP_DIR)/.config_openwrt > $(OPENWRT_BUILD_DIR)/.config |
|---|
| 45 | @# Make sure the config is clean |
|---|
| 46 | $(SCRIPT_CLEAN_EXEC) $(MAKE) -C $(OPENWRT_BUILD_DIR) defconfig |
|---|
| 47 | @# Copy DebWrt config to the build dir - used to set kernel compile options |
|---|
| 48 | cp .config $(OPENWRT_BUILD_DIR)/.config.debwrt |
|---|
| 49 | touch $@ |
|---|
| 50 | |
|---|
| 51 | openwrt/download-link: openwrt/checkout |
|---|
| 52 | ifneq ($(OPENWRT_DOWNLOAD_DIR),) |
|---|
| 53 | cd $(OPENWRT_BUILD_DIR) && if [ -d $(OPENWRT_DOWNLOAD_DIR) -a ! -e dl ]; then ln -snf $(OPENWRT_DOWNLOAD_DIR) dl; fi |
|---|
| 54 | endif |
|---|
| 55 | touch $@ |
|---|
| 56 | |
|---|
| 57 | openwrt/patch: openwrt/checkout |
|---|
| 58 | patch -d $(OPENWRT_BUILD_DIR) -p 0 -N < $(PATCHES_DIR_OPENWRT)/001_disable_all_openwrt_packages |
|---|
| 59 | ifeq ($(IS_OPENWRT_TRUNK),y) |
|---|
| 60 | patch -d $(OPENWRT_BUILD_DIR) -p 0 -N < $(PATCHES_DIR_OPENWRT)/trunk/002_install_kernel_modules_and_merge_debwrt_config |
|---|
| 61 | patch -d $(OPENWRT_BUILD_DIR) -p 0 -N < $(PATCHES_DIR_OPENWRT)/trunk/005_make_empty_rootfs |
|---|
| 62 | else ifeq ($(IS_OPENWRT_BACKFIRE),y) |
|---|
| 63 | patch -d $(OPENWRT_BUILD_DIR) -p 0 -N < $(PATCHES_DIR_OPENWRT)/backfire/002_install_kernel_modules_and_merge_debwrt_config |
|---|
| 64 | patch -d $(OPENWRT_BUILD_DIR) -p 0 -N < $(PATCHES_DIR_OPENWRT)/backfire/005_make_empty_rootfs |
|---|
| 65 | endif |
|---|
| 66 | #patch -d $(OPENWRT_BUILD_DIR) -p 0 -N < $(PATCHES_DIR_OPENWRT)/003_set_kernel_version |
|---|
| 67 | patch -d $(OPENWRT_BUILD_DIR) -p 0 -N < $(PATCHES_DIR_OPENWRT)/004_save_environment_variables |
|---|
| 68 | touch $@ |
|---|
| 69 | |
|---|
| 70 | openwrt/checkout: |
|---|
| 71 | rm -rf $(OPENWRT_BUILD_DIR) |
|---|
| 72 | mkdir -p $(OPENWRT_BUILD_DIR) |
|---|
| 73 | ifeq ($(IS_OPENWRT_TRUNK),y) |
|---|
| 74 | cd $(OPENWRT_BUILD_DIR) && svn co svn://svn.openwrt.org/openwrt/trunk/ . |
|---|
| 75 | else ifeq ($(IS_OPENWRT_BACKFIRE),y) |
|---|
| 76 | cd $(OPENWRT_BUILD_DIR) && svn co svn://svn.openwrt.org/openwrt/branches/backfire/ . |
|---|
| 77 | else |
|---|
| 78 | cd $(OPENWRT_BUILD_DIR) && svn co -r $(OPENWRT_REVISION) svn://svn.openwrt.org/openwrt/trunk/ . |
|---|
| 79 | endif |
|---|
| 80 | touch $@ |
|---|
| 81 | |
|---|
| 82 | openwrt/update: openwrt/checkout |
|---|
| 83 | ifeq ($(IS_OPENWRT_TRUNK),y) |
|---|
| 84 | cd $(OPENWRT_BUILD_DIR) && svn update svn://svn.openwrt.org/openwrt/trunk/ . |
|---|
| 85 | else ifeq ($(IS_OPENWRT_BACKFIRE),y) |
|---|
| 86 | cd $(OPENWRT_BUILD_DIR) && svn update svn://svn.openwrt.org/openwrt/branches/backfire/ . |
|---|
| 87 | else |
|---|
| 88 | cd $(OPENWRT_BUILD_DIR) && svn update -r $(OPENWRT_REVISION) svn://svn.openwrt.org/openwrt/trunk/ . |
|---|
| 89 | endif |
|---|
| 90 | |
|---|
| 91 | openwrt/menuconfig: openwrt/prepare |
|---|
| 92 | $(SCRIPT_CLEAN_EXEC) $(MAKE) -C $(OPENWRT_BUILD_DIR) menuconfig |
|---|
| 93 | |
|---|
| 94 | openwrt/clean: |
|---|
| 95 | rm -rf $(OPENWRT_BUILD_DIR) |
|---|
| 96 | rm -f openwrt/checkout |
|---|
| 97 | rm -f openwrt/patch |
|---|
| 98 | |
|---|