| 1 | # Makefile for OpenWrt
|
|---|
| 2 | #
|
|---|
| 3 | # Copyright (C) 2005 by Felix Fietkau <openwrt@nbd.name>
|
|---|
| 4 | # Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
|
|---|
| 5 | #
|
|---|
| 6 | # This program is free software; you can redistribute it and/or modify
|
|---|
| 7 | # it under the terms of the GNU General Public License as published by
|
|---|
| 8 | # the Free Software Foundation; either version 2 of the License, or
|
|---|
| 9 | # (at your option) any later version.
|
|---|
| 10 | #
|
|---|
| 11 | # This program is distributed in the hope that it will be useful,
|
|---|
| 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|---|
| 14 | # General Public License for more details.
|
|---|
| 15 | #
|
|---|
| 16 | # You should have received a copy of the GNU General Public License
|
|---|
| 17 | # along with this program; if not, write to the Free Software
|
|---|
| 18 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|---|
| 19 | #
|
|---|
| 20 |
|
|---|
| 21 | #--------------------------------------------------------------
|
|---|
| 22 | # Just run 'make menuconfig', configure stuff, then run 'make'.
|
|---|
| 23 | # You shouldn't need to mess with anything beyond this point...
|
|---|
| 24 | #--------------------------------------------------------------
|
|---|
| 25 | TOPDIR=${shell pwd}
|
|---|
| 26 | export TOPDIR
|
|---|
| 27 |
|
|---|
| 28 | ifneq ($(DEVELOPER),)
|
|---|
| 29 | CONFIG_CONFIG_IN = Config.in.devel
|
|---|
| 30 | else
|
|---|
| 31 | CONFIG_CONFIG_IN = Config.in
|
|---|
| 32 | endif
|
|---|
| 33 | CONFIG = package/config
|
|---|
| 34 |
|
|---|
| 35 | noconfig_targets := menuconfig config oldconfig randconfig \
|
|---|
| 36 | allyesconfig allnoconfig tags
|
|---|
| 37 |
|
|---|
| 38 | # Pull in the user's configuration file
|
|---|
| 39 | ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
|
|---|
| 40 | -include $(TOPDIR)/.config
|
|---|
| 41 | endif
|
|---|
| 42 |
|
|---|
| 43 | ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y)
|
|---|
| 44 | include $(TOPDIR)/rules.mk
|
|---|
| 45 |
|
|---|
| 46 | all: world
|
|---|
| 47 |
|
|---|
| 48 | .NOTPARALLEL:
|
|---|
| 49 | .PHONY: all world clean dirclean distclean image_clean target_clean source configtest
|
|---|
| 50 |
|
|---|
| 51 | #############################################################
|
|---|
| 52 | #
|
|---|
| 53 | # You should probably leave this stuff alone unless you know
|
|---|
| 54 | # what you are doing.
|
|---|
| 55 | #
|
|---|
| 56 | #############################################################
|
|---|
| 57 |
|
|---|
| 58 | # In this section, we need .config
|
|---|
| 59 | include .config.cmd
|
|---|
| 60 |
|
|---|
| 61 | world: $(DL_DIR) $(BUILD_DIR) configtest
|
|---|
| 62 | $(MAKE) toolchain/install target/compile package/compile root_clean package/install target/install package_index
|
|---|
| 63 | @$(TRACE) Build complete.
|
|---|
| 64 |
|
|---|
| 65 | configtest:
|
|---|
| 66 | -cp .config .config.test
|
|---|
| 67 | -scripts/configtest.pl
|
|---|
| 68 |
|
|---|
| 69 | package_index:
|
|---|
| 70 | (cd $(PACKAGE_DIR); $(STAGING_DIR)/usr/bin/ipkg-make-index . > Packages)
|
|---|
| 71 |
|
|---|
| 72 | $(DL_DIR):
|
|---|
| 73 | @mkdir -p $(DL_DIR)
|
|---|
| 74 |
|
|---|
| 75 | $(BUILD_DIR):
|
|---|
| 76 | @mkdir -p $(BUILD_DIR)
|
|---|
| 77 |
|
|---|
| 78 | source: toolchain/source package/source target/source
|
|---|
| 79 |
|
|---|
| 80 | package/%:
|
|---|
| 81 | @$(TRACE) $@
|
|---|
| 82 | $(MAKE) -C package $(patsubst package/%,%,$@)
|
|---|
| 83 |
|
|---|
| 84 | target/%:
|
|---|
| 85 | @$(TRACE) $@
|
|---|
| 86 | $(MAKE) -C target $(patsubst target/%,%,$@)
|
|---|
| 87 |
|
|---|
| 88 | toolchain/%:
|
|---|
| 89 | @$(TRACE) $@
|
|---|
| 90 | $(MAKE) -C toolchain $(patsubst toolchain/%,%,$@)
|
|---|
| 91 |
|
|---|
| 92 | #############################################################
|
|---|
| 93 | #
|
|---|
| 94 | # Cleanup and misc junk
|
|---|
| 95 | #
|
|---|
| 96 | #############################################################
|
|---|
| 97 | root_clean:
|
|---|
| 98 | @$(TRACE) root_clean
|
|---|
| 99 | rm -rf $(BUILD_DIR)/linux-*/root $(BUILD_DIR)/root
|
|---|
| 100 |
|
|---|
| 101 | target_clean: root_clean
|
|---|
| 102 | rm -f $(STAMP_DIR)/.*-compile
|
|---|
| 103 | rm -f $(STAMP_DIR)/.*-install
|
|---|
| 104 | rm -rf $(BIN_DIR)
|
|---|
| 105 |
|
|---|
| 106 | clean: dirclean
|
|---|
| 107 |
|
|---|
| 108 | dirclean:
|
|---|
| 109 | @$(TRACE) dirclean
|
|---|
| 110 | @$(MAKE) -C $(CONFIG) clean
|
|---|
| 111 | rm -rf $(BUILD_DIR)
|
|---|
| 112 |
|
|---|
| 113 | distclean: dirclean
|
|---|
| 114 | rm -rf $(STAMP_DIR) $(TOOL_BUILD_DIR) $(STAGING_DIR)
|
|---|
| 115 | rm -f .config* .tmpconfig.h
|
|---|
| 116 |
|
|---|
| 117 | else # ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y)
|
|---|
| 118 |
|
|---|
| 119 | all: menuconfig
|
|---|
| 120 |
|
|---|
| 121 | # configuration
|
|---|
| 122 | # ---------------------------------------------------------------------------
|
|---|
| 123 |
|
|---|
| 124 | $(CONFIG)/conf:
|
|---|
| 125 | $(MAKE) -C $(CONFIG) conf
|
|---|
| 126 | $(CONFIG)/mconf:
|
|---|
| 127 | $(MAKE) -C $(CONFIG)
|
|---|
| 128 |
|
|---|
| 129 | menuconfig: $(CONFIG)/mconf
|
|---|
| 130 | -touch .config
|
|---|
| 131 | -cp .config .config.test
|
|---|
| 132 | @$(CONFIG)/mconf $(CONFIG_CONFIG_IN)
|
|---|
| 133 | -./scripts/configtest.pl
|
|---|
| 134 |
|
|---|
| 135 | config: $(CONFIG)/conf
|
|---|
| 136 | -touch .config
|
|---|
| 137 | -cp .config .config.test
|
|---|
| 138 | @$(CONFIG)/conf $(CONFIG_CONFIG_IN)
|
|---|
| 139 | -./scripts/configtest.pl
|
|---|
| 140 |
|
|---|
| 141 | oldconfig: $(CONFIG)/conf
|
|---|
| 142 | -touch .config
|
|---|
| 143 | -cp .config .config.test
|
|---|
| 144 | @$(CONFIG)/conf -o $(CONFIG_CONFIG_IN)
|
|---|
| 145 | -./scripts/configtest.pl
|
|---|
| 146 |
|
|---|
| 147 | randconfig: $(CONFIG)/conf
|
|---|
| 148 | -touch .config
|
|---|
| 149 | -cp .config .config.test
|
|---|
| 150 | @$(CONFIG)/conf -r $(CONFIG_CONFIG_IN)
|
|---|
| 151 | -./scripts/configtest.pl
|
|---|
| 152 |
|
|---|
| 153 | allyesconfig: $(CONFIG)/conf
|
|---|
| 154 | -touch .config
|
|---|
| 155 | -cp .config .config.test
|
|---|
| 156 | @$(CONFIG)/conf -o $(CONFIG_CONFIG_IN)
|
|---|
| 157 | -./scripts/configtest.pl
|
|---|
| 158 |
|
|---|
| 159 | allnoconfig: $(CONFIG)/conf
|
|---|
| 160 | -touch .config
|
|---|
| 161 | -cp .config .config.test
|
|---|
| 162 | @$(CONFIG)/conf -n $(CONFIG_CONFIG_IN)
|
|---|
| 163 | -./scripts/configtest.pl
|
|---|
| 164 |
|
|---|
| 165 | endif # ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y)
|
|---|