| 1 | # Makefile for FreeWRT development environment
|
|---|
| 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 |
|
|---|
| 26 | TOPDIR=${shell pwd}
|
|---|
| 27 | export TOPDIR
|
|---|
| 28 |
|
|---|
| 29 | CONFIG_CONFIG_IN = Config.in
|
|---|
| 30 | CONFIG = package/config
|
|---|
| 31 |
|
|---|
| 32 | noconfig_targets := menuconfig config oldconfig randconfig \
|
|---|
| 33 | allyesconfig allnoconfig tags
|
|---|
| 34 |
|
|---|
| 35 | # Pull in the user's configuration file
|
|---|
| 36 | ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
|
|---|
| 37 | -include $(TOPDIR)/.config
|
|---|
| 38 | endif
|
|---|
| 39 |
|
|---|
| 40 | ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y)
|
|---|
| 41 | include $(TOPDIR)/rules.mk
|
|---|
| 42 |
|
|---|
| 43 | all: world
|
|---|
| 44 |
|
|---|
| 45 | .NOTPARALLEL:
|
|---|
| 46 | .PHONY: all world clean cleandir distclean image_clean target_clean source
|
|---|
| 47 |
|
|---|
| 48 | #############################################################
|
|---|
| 49 | #
|
|---|
| 50 | # You should probably leave this stuff alone unless you know
|
|---|
| 51 | # what you are doing.
|
|---|
| 52 | #
|
|---|
| 53 | #############################################################
|
|---|
| 54 |
|
|---|
| 55 | # In this section, we need .config
|
|---|
| 56 | include .config.cmd
|
|---|
| 57 |
|
|---|
| 58 | world: $(DL_DIR) $(BUILD_DIR)
|
|---|
| 59 | $(MAKE) -f build.mk toolchain/install target/compile package/compile root_clean package/install target/install package_index
|
|---|
| 60 | @$(TRACE) Build complete.
|
|---|
| 61 |
|
|---|
| 62 | package_index:
|
|---|
| 63 | (cd $(PACKAGE_DIR); $(STAGING_DIR)/usr/bin/ipkg-make-index . > Packages)
|
|---|
| 64 |
|
|---|
| 65 | $(DL_DIR):
|
|---|
| 66 | @mkdir -p $(DL_DIR)
|
|---|
| 67 |
|
|---|
| 68 | $(BUILD_DIR):
|
|---|
| 69 | @mkdir -p $(BUILD_DIR)
|
|---|
| 70 |
|
|---|
| 71 | source: toolchain/source package/source target/source
|
|---|
| 72 |
|
|---|
| 73 | package/%:
|
|---|
| 74 | @$(TRACE) $@
|
|---|
| 75 | $(MAKE) -C package $(patsubst package/%,%,$@)
|
|---|
| 76 |
|
|---|
| 77 | target/%:
|
|---|
| 78 | @$(TRACE) $@
|
|---|
| 79 | $(MAKE) -C target $(patsubst target/%,%,$@)
|
|---|
| 80 |
|
|---|
| 81 | toolchain/%:
|
|---|
| 82 | @$(TRACE) $@
|
|---|
| 83 | $(MAKE) -C toolchain $(patsubst toolchain/%,%,$@)
|
|---|
| 84 |
|
|---|
| 85 | #############################################################
|
|---|
| 86 | #
|
|---|
| 87 | # Cleanup and misc junk
|
|---|
| 88 | #
|
|---|
| 89 | #############################################################
|
|---|
| 90 | root_clean:
|
|---|
| 91 | @$(TRACE) root_clean
|
|---|
| 92 | rm -rf $(BUILD_DIR)/linux-*/root $(BUILD_DIR)/root
|
|---|
| 93 |
|
|---|
| 94 | target_clean: root_clean
|
|---|
| 95 | rm -f $(STAMP_DIR)/.*-compile
|
|---|
| 96 | rm -f $(STAMP_DIR)/.*-install
|
|---|
| 97 | rm -rf $(BIN_DIR)
|
|---|
| 98 |
|
|---|
| 99 | clean:
|
|---|
| 100 | @$(TRACE) clean
|
|---|
| 101 | @$(MAKE) -C $(CONFIG) clean
|
|---|
| 102 | rm -rf $(BUILD_DIR) $(BIN_DIR)
|
|---|
| 103 |
|
|---|
| 104 | cleandir:
|
|---|
| 105 | @$(TRACE) cleandir
|
|---|
| 106 | @$(MAKE) -C $(CONFIG) clean
|
|---|
| 107 | rm -rf $(BUILD_DIR) $(BIN_DIR)
|
|---|
| 108 | rm -rf $(STAMP_DIR) $(TOOL_BUILD_DIR) $(STAGING_DIR)
|
|---|
| 109 | rm -f .tmpconfig.h
|
|---|
| 110 |
|
|---|
| 111 | distclean:
|
|---|
| 112 | @$(TRACE) distclean
|
|---|
| 113 | @$(MAKE) -C $(CONFIG) clean
|
|---|
| 114 | rm -rf $(BUILD_DIR) $(BIN_DIR) $(DL_DIR)
|
|---|
| 115 | rm -rf $(STAMP_DIR) $(TOOL_BUILD_DIR) $(STAGING_DIR)
|
|---|
| 116 | rm -f .config* .tmpconfig.h
|
|---|
| 117 |
|
|---|
| 118 | else # ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y)
|
|---|
| 119 |
|
|---|
| 120 | include $(TOPDIR)/lbin/prereq.mk
|
|---|
| 121 |
|
|---|
| 122 | all: menuconfig
|
|---|
| 123 |
|
|---|
| 124 | # configuration
|
|---|
| 125 | # ---------------------------------------------------------------------------
|
|---|
| 126 |
|
|---|
| 127 | $(CONFIG)/conf:
|
|---|
| 128 | $(MAKE) -C $(CONFIG) conf
|
|---|
| 129 | $(CONFIG)/mconf:
|
|---|
| 130 | $(MAKE) -C $(CONFIG)
|
|---|
| 131 |
|
|---|
| 132 | menuconfig: $(CONFIG)/mconf
|
|---|
| 133 | -touch .config
|
|---|
| 134 | @$(CONFIG)/mconf $(CONFIG_CONFIG_IN)
|
|---|
| 135 |
|
|---|
| 136 | config: $(CONFIG)/conf
|
|---|
| 137 | -touch .config
|
|---|
| 138 | @$(CONFIG)/conf $(CONFIG_CONFIG_IN)
|
|---|
| 139 |
|
|---|
| 140 | oldconfig: $(CONFIG)/conf
|
|---|
| 141 | -touch .config
|
|---|
| 142 | @$(CONFIG)/conf -o $(CONFIG_CONFIG_IN)
|
|---|
| 143 |
|
|---|
| 144 | randconfig: $(CONFIG)/conf
|
|---|
| 145 | -touch .config
|
|---|
| 146 | @$(CONFIG)/conf -r $(CONFIG_CONFIG_IN)
|
|---|
| 147 |
|
|---|
| 148 | allyesconfig: $(CONFIG)/conf
|
|---|
| 149 | -touch .config
|
|---|
| 150 | @$(CONFIG)/conf -o $(CONFIG_CONFIG_IN)
|
|---|
| 151 |
|
|---|
| 152 | allnoconfig: $(CONFIG)/conf
|
|---|
| 153 | -touch .config
|
|---|
| 154 | @$(CONFIG)/conf -n $(CONFIG_CONFIG_IN)
|
|---|
| 155 |
|
|---|
| 156 | endif # ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y)
|
|---|