diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/debug.mk | 34 | ||||
-rw-r--r-- | include/host.mk | 5 | ||||
-rw-r--r-- | include/quilt.mk | 4 | ||||
-rw-r--r-- | include/subdir.mk | 56 | ||||
-rw-r--r-- | include/toplevel.mk | 42 | ||||
-rw-r--r-- | include/verbose.mk | 2 |
6 files changed, 77 insertions, 66 deletions
diff --git a/include/debug.mk b/include/debug.mk new file mode 100644 index 0000000..73e6179 --- /dev/null +++ b/include/debug.mk @@ -0,0 +1,34 @@ +# +# Copyright (C) 2007 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +# debug flags: +# +# d: show subdirectory tree +# t: show added targets +# l: show legacy targets +# v: verbose (no .SILENCE for common targets) + +ifeq ($(DEBUG),all) + build_debug:=dltv +else + build_debug:=$(DEBUG) +endif + +define debug +$$(findstring $(2),$$(if $$(DEBUG_DIR),$$(if $$(filter $$(DEBUG_DIR)%,$(1)),$(build_debug)),$(build_debug))) +endef + +define warn +$$(if $(call debug,$(1),$(2)),$$(warning $(3))) +endef + +define warn_eval +$(call warn,$(1),$(2),$(3) $(4)) +$(4) +endef + + diff --git a/include/host.mk b/include/host.mk index 8b2e56c..d163c99 100644 --- a/include/host.mk +++ b/include/host.mk @@ -1,17 +1,18 @@ # -# Copyright (C) 2006 OpenWrt.org +# Copyright (C) 2007 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. # +TMP_DIR ?= $(TOPDIR)/tmp -include $(TMP_DIR)/.host.mk export TAR -TMP_DIR ?= $(TOPDIR)/tmp ifneq ($(__host_inc),1) __host_inc:=1 +.PRECIOUS: $(TMP_DIR)/.host.mk $(TMP_DIR)/.host.mk: $(TOPDIR)/include/host.mk @mkdir -p $(TMP_DIR) @( \ diff --git a/include/quilt.mk b/include/quilt.mk index 7714f29..dc5a9d2 100644 --- a/include/quilt.mk +++ b/include/quilt.mk @@ -10,6 +10,10 @@ ifeq ($(KERNEL_BUILD),1) endif PATCH_DIR?=./patches +ifeq ($(MAKECMDGOALS),refresh) + override QUILT=1 +endif + define Quilt/Patch @for patch in $$$$( (cd $(1) && ls) 2>/dev/null ); do ( \ cp "$(1)/$$$$patch" $(PKG_BUILD_DIR); \ diff --git a/include/subdir.mk b/include/subdir.mk index 16e4f4b..a27333d 100644 --- a/include/subdir.mk +++ b/include/subdir.mk @@ -1,32 +1,14 @@ -# debug flags: +# +# Copyright (C) 2007 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. # -# d: show subdirectory tree -# t: show added targets -# l: show legacy targets - -ifeq ($(DEBUG),all) - build_debug:=dlt -else - build_debug:=$(DEBUG) -endif - -define debug -$$(findstring $(2),$$(if $$(DEBUG_DIR),$$(if $$(filter $$(DEBUG_DIR)%,$(1)),$(build_debug)),$(build_debug))) -endef - -define warn -$$(if $(call debug,$(1),$(2)),$$(warning $(3))) -endef - -define warn_eval -$(call warn,$(1),$(2),$(3) $(4)) -$(4) -endef SUBTARGETS:=clean download prepare compile install update refresh prereq define subtarget - $(call warn_eval,$(1),t,T,$(1)/$(2): $($(1)/) $(foreach bd,$(if $($(1)/builddirs-$(2)),$($(1)/builddirs-$(2)),$($(1)/builddirs)),$(1)/$(bd)/$(2))) + $(call warn_eval,$(1),t,T,$(1)/$(2): $($(1)/) $(foreach bd,$(if $($(1)/builddirs-$(2)),$(filter-out .,$($(1)/builddirs-$(2))),$($(1)/builddirs)),$(1)/$(bd)/$(2))) endef @@ -46,19 +28,19 @@ define subdir $(foreach target,$(SUBTARGETS),$(call subtarget,$(1),$(target))) endef -# Parameters: <subdir> <name> +# Parameters: <subdir> <name> <target> define stampfile - $(1)/stamp:=$(STAGING_DIR)/stampfiles/.$(2)_installed - $(call rdep,$(1),$$($(1)/stamp)) - - $$($(1)/stamp): - @+$(MAKE) $(1)/install - @mkdir -p $$$$(dirname $$($(1)/stamp)) - @touch $$($(1)/stamp) - .PRECIOUS: $$($(1)/stamp) # work around a make bug - - $(1)//clean:=$(1)/stamp/clean - $(1)/stamp/clean: FORCE - @rm -f $$($(1)/stamp) + $(1)/stamp-$(3):=$(STAGING_DIR)/stampfiles/.$(2)_$(3) + $(call rdep,$(1),$$($(1)/stamp-$(3)),) + + $$($(1)/stamp-$(3)): + @+$(MAKE) $(1)/$(3) + @mkdir -p $$$$(dirname $$($(1)/stamp-$(3))) + @touch $$($(1)/stamp-$(3)) + .PRECIOUS: $$($(1)/stamp-$(3)) # work around a make bug + + $(1)//clean:=$(1)/stamp-$(3)/clean + $(1)/stamp-$(3)/clean: FORCE + @rm -f $$($(1)/stamp-$(3)) endef diff --git a/include/toplevel.mk b/include/toplevel.mk index 0583983..33b318a 100644 --- a/include/toplevel.mk +++ b/include/toplevel.mk @@ -9,10 +9,9 @@ RELEASE:=Kamikaze #VERSION:=2.0 # uncomment for final release -all: world - SHELL:=/usr/bin/env bash OPENWRTVERSION:=$(RELEASE) +PREP_MK= OPENWRT_BUILD= QUIET=0 include $(TOPDIR)/include/verbose.mk ifneq ($(VERSION),) OPENWRTVERSION:=$(VERSION) ($(OPENWRTVERSION)) @@ -26,27 +25,26 @@ export OPENWRTVERSION ifeq ($(FORCE),) .config scripts/config/conf scripts/config/mconf: tmp/.prereq-build - world: prereq endif SCAN_COOKIE?=$(shell echo $$$$) export SCAN_COOKIE -tmp/.packageinfo tmp/.targetinfo prepare-tmpinfo: - @mkdir -p tmp/info - @+$(NO_TRACE_MAKE) -s -f include/scan.mk SCAN_TARGET="packageinfo" SCAN_DIR="package" SCAN_NAME="package" SCAN_DEPS="$(TOPDIR)/include/package*.mk" SCAN_DEPTH=4 SCAN_EXTRA="" - @+$(NO_TRACE_MAKE) -s -f include/scan.mk SCAN_TARGET="targetinfo" SCAN_DIR="target/linux" SCAN_NAME="target" SCAN_DEPS="profiles/*.mk $(TOPDIR)/include/kernel*.mk" SCAN_DEPTH=2 SCAN_EXTRA="" - @for type in package target; do \ +tmp/.packageinfo tmp/.targetinfo prepare-tmpinfo: FORCE + mkdir -p tmp/info + +$(NO_TRACE_MAKE) -s -f include/scan.mk SCAN_TARGET="packageinfo" SCAN_DIR="package" SCAN_NAME="package" SCAN_DEPS="$(TOPDIR)/include/package*.mk" SCAN_DEPTH=4 SCAN_EXTRA="" + +$(NO_TRACE_MAKE) -s -f include/scan.mk SCAN_TARGET="targetinfo" SCAN_DIR="target/linux" SCAN_NAME="target" SCAN_DEPS="profiles/*.mk $(TOPDIR)/include/kernel*.mk" SCAN_DEPTH=2 SCAN_EXTRA="" + for type in package target; do \ f=tmp/.$${type}info; t=tmp/.config-$${type}.in; \ [ "$$t" -nt "$$f" ] || ./scripts/metadata.pl $${type}_config < "$$f" > "$$t" || { rm -f "$$t"; echo "Failed to build $$t"; false; break; }; \ done + ./scripts/metadata.pl package_mk < tmp/.packageinfo > tmp/.packagedeps || { rm -f tmp/.packagedeps; false; } .config: ./scripts/config/conf prepare-tmpinfo @+if [ \! -f .config ]; then \ [ -e $(HOME)/.openwrt/defconfig ] && cp $(HOME)/.openwrt/defconfig .config; \ - $(NO_TRACE_MAKE) menuconfig QUIET=0 OPENWRT_BUILD=; \ + $(NO_TRACE_MAKE) menuconfig $(PREP_MK); \ fi - $< -D .config Config.in &> /dev/null scripts/config/mconf: @+$(MAKE) -C scripts/config all @@ -88,20 +86,6 @@ tmp/.prereq-build: include/prereq-build.mk } touch $@ -tmp/.prereq-package: tmp/.packageinfo .config -tmp/.prereq-target: tmp/.targetinfo .config -tmp/.prereq-package tmp/.prereq-target: include/prereq.mk - mkdir -p tmp - rm -f tmp/.host.mk - @+$(NO_TRACE_MAKE) -s -C $(patsubst tmp/.prereq-%,%,$@) prereq 2>/dev/null || { \ - echo "Prerequisite check failed. Use FORCE=1 to override."; \ - false; \ - } - touch $@ - -prereq: tmp/.prereq-build tmp/.prereq-package tmp/.prereq-target .config FORCE - @true - download: .config FORCE $(MAKE) -j1 tools/download $(MAKE) -j1 toolchain/download @@ -111,8 +95,12 @@ download: .config FORCE clean dirclean distclean: @$(MAKE) $@ +prereq:: .config + @+$(SUBMAKE) -s tmp/.prereq-build $(PREP_MK) + @$(NO_TRACE_MAKE) -s $@ + %:: - @$(SUBMAKE) -s prereq QUIET=0 OPENWRT_BUILD= + @+$(PREP_MK) $(NO_TRACE_MAKE) -s prereq @+$(MAKE) $@ help: @@ -128,7 +116,9 @@ symlinkclean: -find package -type l | xargs rm -f rm -rf tmp -.SILENT: symlinkclean clean dirclean distclean config-clean download help tmpinfo-clean .config scripts/config/mconf scripts/config/conf menuconfig tmp/.prereq-build tmp/.prereq-package tmp/.prereq-target +ifeq ($(findstring v,$(DEBUG)),) + .SILENT: symlinkclean clean dirclean distclean config-clean download help tmpinfo-clean .config scripts/config/mconf scripts/config/conf menuconfig tmp/.prereq-build tmp/.prereq-package tmp/.prereq-target tmp/.packageinfo tmp/.targetinfo prepare-tmpinfo +endif .PHONY: help FORCE .NOTPARALLEL: diff --git a/include/verbose.mk b/include/verbose.mk index 5ceaf99..4abdf8d 100644 --- a/include/verbose.mk +++ b/include/verbose.mk @@ -44,7 +44,7 @@ ifneq ($(KBUILD_VERBOSE),99) MAKE:=&>/dev/null $(MAKE) endif export QUIET:=1 - MAKE:=cmd() { $(MAKE) $$* || { echo "make $$*: build failed. Please re-run make with V=99 to see what's going on"; false; } } 3>&1 4>&2; cmd + MAKE:=cmd() { $(MAKE) -s $$* || { echo "make $$*: build failed. Please re-run make with V=99 to see what's going on"; false; } } 3>&1 4>&2; cmd endif .SILENT: $(MAKECMDGOALS) |