From 674f6a0828a4b7124a63ce1bee55c8aab95ead1b Mon Sep 17 00:00:00 2001 From: Michael Richters Date: Tue, 5 Apr 2022 20:43:33 -0500 Subject: [PATCH] Use make's built-in `.DEFAULT_GOAL` variable to set default target(s) Instead of using the phony `DEFAULT_GOAL` target, use make's special variable `.DEFAULT_GOAL` to work around the problem of including arduino-cli.mk at the top of the sketch makefile. Signed-off-by: Michael Richters --- Makefile | 2 +- etc/makefiles/arduino-cli.mk | 3 ++- etc/makefiles/sketch.mk | 2 +- tests/Makefile | 2 ++ 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index ded28e4f..fd69be88 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,7 @@ ifneq ($(TEST_PATH),) TEST_PATH_ARG="TEST_PATH='$(TEST_PATH)'" endif -DEFAULT_GOAL: smoke-sketches +.DEFAULT_GOAL := smoke-sketches .PHONY: setup setup: $(ARDUINO_CLI_PATH) $(ARDUINO_DIRECTORIES_DATA)/arduino-cli.yaml install-arduino-core-avr install-arduino-core-kaleidoscope $(ARDUINO_DIRECTORIES_USER)/hardware/keyboardio/avr/boards.txt $(ARDUINO_DIRECTORIES_USER)/hardware/keyboardio/virtual/boards.txt diff --git a/etc/makefiles/arduino-cli.mk b/etc/makefiles/arduino-cli.mk index 4ee3d94a..06bd8bde 100644 --- a/etc/makefiles/arduino-cli.mk +++ b/etc/makefiles/arduino-cli.mk @@ -114,9 +114,10 @@ endif .PHONY: configure-arduino-cli install-arduino-core-kaleidoscope install-arduino-core-avr .PHONY: stupid-workaround-for-make-inclusion-semantics -stupid-workaround-for-make-inclusion-semantics: DEFAULT_GOAL +stupid-workaround-for-make-inclusion-semantics: @: # This is here so that the sketch makefile including this file doesn't @: # default to arduino-cli installation as its priamry target + @echo "No default target specified; aborting. Please set the .DEFAULT_GOAL variable in your makefile." $(KALEIDOSCOPE_BIN_DIR)/arduino-cli: $(QUIET) curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR="$(KALEIDOSCOPE_BIN_DIR)" sh diff --git a/etc/makefiles/sketch.mk b/etc/makefiles/sketch.mk index e3cd2151..48e41265 100644 --- a/etc/makefiles/sketch.mk +++ b/etc/makefiles/sketch.mk @@ -99,7 +99,7 @@ endif -DEFAULT_GOAL: compile +.DEFAULT_GOAL := compile #$(SKETCH_FILE_PATH): diff --git a/tests/Makefile b/tests/Makefile index 66c66159..e29fe95f 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -39,6 +39,8 @@ MAKEFLAGS += --no-print-directory include $(top_dir)/etc/makefiles/arduino-cli.mk +.DEFAULT_GOAL := all + # If we start off in tests to run make all, the sketch makefiles guess the wrong location for # Kaliedoscope's makefiles KALEIDOSCOPE_ETC_DIR ?= $(top_dir)/etc