-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmakefile
More file actions
41 lines (34 loc) · 1005 Bytes
/
makefile
File metadata and controls
41 lines (34 loc) · 1005 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Based around the auto-documented Makefile:
# http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
.PHONY: build
build: ## Builds artifact
$(call print-target)
@mkdir -p ./build
CGO_ENABLED=0 go build -ldflags "$(LDFLAGS)" -o ./build/agentd
.PHONY: test
test: ## Runs all tests
$(call print-target)
go test ./... -v
.PHONY: lint
lint: ## Runs go vet
$(call print-target)
go vet ./...
.PHONY: format
format: ## Formats all Go source files
$(call print-target)
gofmt -w .
.PHONY: nix-build
nix-build: ## Builds the Nix package for the current system
$(call print-target)
nix build --out-link ./build/result
.PHONY: clean
clean: ## Removes build artifacts
$(call print-target)
rm -rf ./build
.PHONY: help
.DEFAULT_GOAL := help
help: ## Prints this help message
@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
define print-target
@printf "Executing target: \033[36m$@\033[0m\n"
endef