Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Makefile documentation #25

Merged
merged 2 commits into from
Aug 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,32 +23,45 @@ ifeq (run,$(firstword $(MAKECMDGOALS)))
endif

.PHONY: all
## Alias for `build`
all: build

.PHONY: build
## Build runtime Docker image
build:
docker build -t ${IMG_NAME}:latest --target runtime .

.PHONY: build.develop
## Build develop container image
build.develop:
docker build -t ${IMG_NAME}-develop:latest --target develop .

.PHONY: develop
## Run interactive shell inside developer container
develop: build.develop
./scripts/develop.sh

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

.PHONY: fmt
## Auto-format source code and report code-style violations (lint)
fmt:
./scripts/fmt.sh

.PHONY: test
## Run tests
test:
go test -coverprofile cover.out `go list ./...`

.DEFAULT_GOAL := help
.PHONY: help
## Print Makefile documentation
help:
@perl -0 -nle 'printf("\033[36m %-15s\033[0m %s\n", "$$2", "$$1") while m/^##\s*([^\r\n]+)\n^([\w.-]+):[^=]/gm' $(MAKEFILE_LIST) | sort

# Override targets if they are included in RUN_ARGs so it doesn't run them twice
# otherwise 'make run fmt' would be equivalent to calling './scripts/develop.sh make fmt'
# followed by 'make fmt'
Expand Down