From 2d22e8325d7c440131f40039f302603a25b10b94 Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Thu, 21 May 2015 13:45:53 -0700 Subject: [PATCH] Fix double build when using new make target syntax When make is invoked as "make posix posix_default" it will build the posix_default target twice. The Makefile was fixed to correct this. If "make posix" is run, the Makefile still calls "make PX4_TARGET_OS=posix". If "make posix posix_default" is run, the posix target just exports PX4_TARGET_OS=posix and then make evaluates the next goal (posix_default). Signed-off-by: Mark Charlebois --- Makefile | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 3f78f32362..a14fd13a65 100644 --- a/Makefile +++ b/Makefile @@ -37,6 +37,7 @@ TARGETS := nuttx posix qurt EXPLICIT_TARGET := $(filter $(TARGETS),$(MAKECMDGOALS)) ifneq ($(EXPLICIT_TARGET),) export PX4_TARGET_OS=$(EXPLICIT_TARGET) + export GOALS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS)) endif # @@ -277,14 +278,12 @@ testbuild: $(Q) (cd $(PX4_BASE) && $(MAKE) distclean && $(MAKE) archives && $(MAKE) -j8) $(Q) (zip -r Firmware.zip $(PX4_BASE)/Images) -nuttx: - make PX4_TARGET_OS=$@ $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS)) - -posix: - make PX4_TARGET_OS=$@ $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS)) - -qurt: - make PX4_TARGET_OS=$@ $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS)) +nuttx posix qurt: +ifeq ($(GOALS),) + make PX4_TARGET_OS=$@ $(GOALS) +else + export PX4_TARGET_OS=$@ +endif posixrun: Tools/posix_run.sh