From 623d3ce8abf939a00357e2f16cbd9d6f92c1bbf0 Mon Sep 17 00:00:00 2001 From: Tim Crawford Date: Mon, 9 Jan 2023 10:38:48 -0700 Subject: [PATCH] make: Add new targets - fmt: Apply clang-format - list-boards: list of available build targets - help: Short description of make targets Signed-off-by: Tim Crawford --- Makefile | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 1ebba7d..79487cd 100644 --- a/Makefile +++ b/Makefile @@ -13,10 +13,7 @@ endif # Parameter for current board ifeq ($(BOARD),) all: - @echo "Please set BOARD to one of the following:" - @cd src/board && for board in */*/board.mk; do \ - echo " $$(dirname "$$board")"; \ - done + @echo -e "\x1B[31mBOARD must be specified\x1B[0m" @exit 1 else # Calculate version @@ -73,11 +70,32 @@ endif clean: rm -rf $(obj) +.PHONY: fmt +fmt: + ./scripts/clang-format.sh apply + .PHONY: lint lint: ./scripts/lint/lint.sh +.PHONY: list-boards +list-boards: + @cd src/board && for board in */*/board.mk; do \ + echo "$$(dirname "$$board")"; \ + done + +# This target is run during setup, and is not shown in the help text. .PHONY: git-config git-config: $(eval HOOKS = "$(shell git rev-parse --git-dir)/hooks") ln -sfrv scripts/hooks/pre-commit.sh "$(HOOKS)/pre-commit" + +.PHONY: help +help: + @echo "System76 EC build targets" + @echo " [all] BOARD= Build the specified board" + @echo " list-boards List available target boards" + @echo " clean Remove build artifacts" + @echo " fmt Format the source code" + @echo " lint Run lint checks" + @echo " help Print this message"