summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2016-01-20 21:31:56 +0000
committerFelix Fietkau <nbd@openwrt.org>2016-01-20 21:31:56 +0000
commitf08623516ffabde93d70a0dc809503cf60567452 (patch)
tree6f3d062b2bd9c7a950735c9f67479bceacc462ff /include
parenta81ad971df86f8c3b098a333ac868079ff279cc8 (diff)
downloadmtk-20170518-f08623516ffabde93d70a0dc809503cf60567452.zip
mtk-20170518-f08623516ffabde93d70a0dc809503cf60567452.tar.gz
mtk-20170518-f08623516ffabde93d70a0dc809503cf60567452.tar.bz2
build: add logging for package host builds
Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 48417
Diffstat (limited to 'include')
-rw-r--r--include/subdir.mk20
1 files changed, 18 insertions, 2 deletions
diff --git a/include/subdir.mk b/include/subdir.mk
index a444df0..f4085f9 100644
--- a/include/subdir.mk
+++ b/include/subdir.mk
@@ -29,6 +29,20 @@ endef
lastdir=$(word $(words $(subst /, ,$(1))),$(subst /, ,$(1)))
diralias=$(if $(findstring $(1),$(call lastdir,$(1))),,$(call lastdir,$(1)))
+# 1: subdir
+# 2: target
+# 3: build type
+# 4: build variant
+log_make = \
+ $(if $(call debug,$(1),v),,@)+ \
+ $(if $(BUILD_LOG), \
+ set -o pipefail; \
+ mkdir -p $(BUILD_LOG_DIR)/$(1)$(if $(4),/$(4));) \
+ $$(SUBMAKE) -r -C $(1) $(if $(3),$(3)-)$(2) \
+ BUILD_SUBDIR="$(1)" \
+ BUILD_VARIANT="$(4)" \
+ $(if $(BUILD_LOG),SILENT= 2>&1 | tee $(BUILD_LOG_DIR)/$(1)$(if $(4),/$(4))/$(if $(3),$(3)-)$(2).txt)
+
# Parameters: <subdir>
define subdir
$(call warn,$(1),d,D $(1))
@@ -37,13 +51,15 @@ define subdir
$(foreach target,$(SUBTARGETS),
$(foreach btype,$(buildtypes-$(bd)),
$(call warn_eval,$(1)/$(bd),t,T,$(1)/$(bd)/$(btype)/$(target): $(if $(QUILT),,$($(1)/$(bd)/$(btype)/$(target)) $(call $(1)//$(btype)/$(target),$(1)/$(bd)/$(btype))))
- $(if $(call debug,$(1)/$(bd),v),,@)+$$(SUBMAKE) -r -C $(1)/$(bd) $(btype)-$(target) BUILD_SUBDIR="$(1)/$(bd)" $(if $(findstring $(bd),$($(1)/builddirs-ignore-$(btype)-$(target))), || $(call ERROR,$(1), ERROR: $(1)/$(bd) [$(btype)] failed to build.))
+ $(call log_make,$(1)/$(bd),$(target),$(btype),$(filter-out __default,$(variant))) \
+ $(if $(findstring $(bd),$($(1)/builddirs-ignore-$(btype)-$(target))), || $(call ERROR,$(1), ERROR: $(1)/$(bd) [$(btype)] failed to build.))
$(if $(call diralias,$(bd)),$(call warn_eval,$(1)/$(bd),l,T,$(1)/$(call diralias,$(bd))/$(btype)/$(target): $(1)/$(bd)/$(btype)/$(target)))
)
$(call warn_eval,$(1)/$(bd),t,T,$(1)/$(bd)/$(target): $(if $(QUILT),,$($(1)/$(bd)/$(target)) $(call $(1)//$(target),$(1)/$(bd))))
$(foreach variant,$(if $(BUILD_VARIANT),$(BUILD_VARIANT),$(if $(strip $($(1)/$(bd)/variants)),$($(1)/$(bd)/variants),$(if $($(1)/$(bd)/default-variant),$($(1)/$(bd)/default-variant),__default))),
$(if $(BUILD_LOG),@mkdir -p $(BUILD_LOG_DIR)/$(1)/$(bd)/$(filter-out __default,$(variant)))
- $(if $(call debug,$(1)/$(bd),v),,@)+$(if $(BUILD_LOG),set -o pipefail;) $$(SUBMAKE) -r -C $(1)/$(bd) $(target) BUILD_SUBDIR="$(1)/$(bd)" BUILD_VARIANT="$(filter-out __default,$(variant))" $(if $(BUILD_LOG),SILENT= 2>&1 | tee $(BUILD_LOG_DIR)/$(1)/$(bd)/$(filter-out __default,$(variant))/$(target).txt) $(if $(findstring $(bd),$($(1)/builddirs-ignore-$(target))), || $(call ERROR,$(1), ERROR: $(1)/$(bd) failed to build$(if $(filter-out __default,$(variant)), (build variant: $(variant))).))
+ $(call log_make,$(1)/$(bd),$(target),,$(filter-out __default,$(variant))) \
+ $(if $(findstring $(bd),$($(1)/builddirs-ignore-$(target))), || $(call ERROR,$(1), ERROR: $(1)/$(bd) failed to build$(if $(filter-out __default,$(variant)), (build variant: $(variant))).))
)
$(if $(PREREQ_ONLY)$(DUMP_TARGET_DB),,
# aliases