Skip to content

Commit 32c4b43

Browse files
committed
Makefile: refactor add docs and add command line help target
1 parent 867c93d commit 32c4b43

1 file changed

Lines changed: 20 additions & 22 deletions

File tree

Makefile

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,46 +11,44 @@ define check_command
1111
}
1212
endef
1313

14-
all : check_rake
14+
.PHONY: all test clean check checkinstall checkupdate composecheck composetest check_rake check_docker_compose check_pre_commit help
15+
.DEFAULT_GOAL := all
16+
17+
all: check_rake ## build all targets, install (locally) in-repo
1518
$(RAKE)
16-
.PHONY : all
1719

18-
test : check_rake all
20+
test: check_rake all ## build and run all mruby tests
1921
$(RAKE) test
20-
.PHONY : test
2122

22-
clean : check_rake
23+
clean: check_rake ## clean all built and in-repo installed artifacts
2324
$(RAKE) clean
24-
.PHONY : clean
2525

26-
check : check_pre_commit
26+
check: check_pre_commit ## run all pre-commit hooks against all files
2727
$(PRE_COMMIT) run --all-files
28-
.PHONY : check
2928

30-
checkinstall : check_pre_commit
29+
checkinstall: check_pre_commit ## install the pre-commit hooks
3130
$(PRE_COMMIT) install
32-
.PHONY : checkinstall
3331

34-
checkupdate : check_pre_commit
32+
checkupdate: check_pre_commit ## check the pre-commit hooks for updates
3533
$(PRE_COMMIT) autoupdate
36-
.PHONY : checkupdate
3734

38-
composecheck : check_docker_compose check_pre_commit
35+
composecheck: check_docker_compose check_pre_commit ## run all pre-commit hooks against all files with docker-compose
3936
$(DOCKER_COMPOSE) -p mruby run test $(PRE_COMMIT) run --all-files
40-
.PHONY : composecheck
4137

42-
composetest : check_docker_compose
38+
composetest: check_docker_compose ## build and run all mruby tests with docker-compose
4339
$(DOCKER_COMPOSE) -p mruby run test
44-
.PHONY : composetest
4540

46-
check_rake:
41+
check_rake: ## check if Rake is installed
4742
$(call check_command, $(RAKE))
48-
.PHONY : check_rake
4943

50-
check_docker_compose:
44+
check_docker_compose: ## check if docker-compose is installed
5145
$(call check_command, $(DOCKER_COMPOSE))
52-
.PHONY : check_docker_compose
5346

54-
check_pre_commit:
47+
check_pre_commit: ## check if pre-commit is installed
5548
$(call check_command, $(PRE_COMMIT))
56-
.PHONY : check_pre_commit
49+
50+
help: ## display this help message
51+
@echo "Usage: make <target>"
52+
@echo
53+
@echo "Available targets:"
54+
@grep -E '^[a-z_-]+:.*##' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*## *"}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}'

0 commit comments

Comments
 (0)