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 <tcrawford@system76.com>
This commit is contained in:
Tim Crawford
2023-01-09 10:38:48 -07:00
committed by Jeremy Soller
parent 58f9ed4051
commit 623d3ce8ab

View File

@ -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=<B> 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"