Skip to content

Commit 1aee152

Browse files
authored
Add Makefile documentation (#50)
Add help texts to Makefile targets Signed-off-by: ddelange <[email protected]>
1 parent 3fd2814 commit 1aee152

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,35 +21,49 @@ ifeq (run,$(firstword $(MAKECMDGOALS)))
2121
endif
2222

2323
.PHONY: all
24+
## Alias for `build`
2425
all: build
2526

2627
.PHONY: build
28+
## Build runtime Docker image
2729
build:
2830
./scripts/build_docker.sh --target runtime
2931

3032
.PHONY: build.develop
33+
## Build developer container image
3134
build.develop:
3235
./scripts/build_docker.sh --target develop
3336

3437
.PHONY: develop
38+
## Run interactive shell inside developer container
3539
develop: build.develop
3640
./scripts/develop.sh
3741

3842
.PHONY: run
43+
## Run make target inside developer container (e.g. `make run fmt`)
3944
run: build.develop
4045
./scripts/develop.sh make $(RUN_ARGS)
4146

4247
.PHONY: test
48+
## Run tests
4349
test:
4450
./scripts/run_tests.sh
4551

4652
.PHONY: fmt
53+
## Auto-format source code and report code-style violations (lint)
4754
fmt:
4855
./scripts/fmt.sh
4956

5057
.PHONY: proto.compile
58+
## Compile protos
5159
proto.compile:
5260
./scripts/compile_protos.sh
5361

62+
.DEFAULT_GOAL := help
63+
.PHONY: help
64+
## Print Makefile documentation
65+
help:
66+
@perl -0 -nle 'printf("\033[36m %-15s\033[0m %s\n", "$$2", "$$1") while m/^##\s*([^\r\n]+)\n^([\w.-]+):[^=]/gm' $(MAKEFILE_LIST) | sort
67+
5468
# Override targets if they are included in RUN_ARGs so it doesn't run them twice
5569
$(eval $(RUN_ARGS):;@:)

0 commit comments

Comments
 (0)