aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGirts Folkmanis <girtsf@users.noreply.github.com>2016-09-14 18:06:47 -0700
committerTravis Geiselbrecht <geist@foobox.com>2016-09-30 10:41:23 -0700
commit9a2fcf2b608dc704daa2101a390aae8c6340c0e6 (patch)
tree219c350e700d43b3a5a289e977a1ab42e832eca4
parent6782ea9af6ff1d5bb91b5879b44c7118fe792b30 (diff)
downloadcommon-9a2fcf2b608dc704daa2101a390aae8c6340c0e6.tar.gz
[make] don't call build engine multiple times.
If some included rule.mk defines an additional make target that the user might want to call (e.g., "flash"), and user specifies a project name on the command line, then previously the outer "makefile" would call engine.mk multiple times. The new logic prevents that. Additionally, silence extra "Nothing to be done" messages when calling engine.mk again after removing the project name from make goals.
-rw-r--r--engine.mk1
-rw-r--r--makefile11
2 files changed, 10 insertions, 2 deletions
diff --git a/engine.mk b/engine.mk
index cffbcdd2..9cd5e2d6 100644
--- a/engine.mk
+++ b/engine.mk
@@ -24,6 +24,7 @@ ifneq ($(project-name),)
ifneq ($(strip $(foreach d,$(LKINC),$(wildcard $(d)/project/$(project-name).mk))),)
do-nothing := 1
$(MAKECMDGOALS) _all: make-make
+ @:
make-make:
@PROJECT=$(project-name) $(MAKE) -rR -f $(LOCAL_MAKEFILE) $(filter-out $(project-name), $(MAKECMDGOALS))
diff --git a/makefile b/makefile
index 02158b80..a8e9c180 100644
--- a/makefile
+++ b/makefile
@@ -28,9 +28,16 @@ export BUILDROOT
export DEFAULT_PROJECT
export TOOLCHAIN_PREFIX
-# vaneer makefile that calls into the engine with lk as the build root
+# veneer makefile that calls into the engine with lk as the build root
# if we're the top level invocation, call ourselves with additional args
-$(MAKECMDGOALS) _top:
+_top:
@$(MAKE) -C $(LKMAKEROOT) -rR -f $(LKROOT)/engine.mk $(addprefix -I,$(LKINC)) $(MAKECMDGOALS)
+# If any arguments were provided, create a recipe for them that depends
+# on the _top rule (thus calling it), but otherwise do nothing.
+# "@:" (vs empty rule ";") prevents extra "'foo' is up to date." messages from
+# being emitted.
+$(MAKECMDGOALS): _top
+ @:
+
.PHONY: _top