-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmakefile
35 lines (33 loc) · 1.27 KB
/
makefile
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
TEST_DATA_DIR="./test/testdata"
VERSION ?= "99-dev-00.00-99"
LD_FLAGS = "-X 'github.com/telekom/aml-jens/internal/assets.VERSION=$(VERSION)' -X 'github.com/telekom/aml-jens/internal/assets.BUILD_TIME=$(shell date --iso-8601=seconds)'"
.PHONY: clean-binaries clean-packages test package help build-binaries coverage
all: help
build-binaries: # Build programs in cmd/*#Output: bin/
build-binaries: clean-binaries
@echo Building executables
@go build -v -ldflags=${LD_FLAGS} -o ./bin/ ./cmd/*
@chmod +x ./bin/*
clean-binaries:
@rm -rf ./bin/*
clean-packages:
@rm -rf ./out/*
clean: # Cleans binaries & packages
clean: clean-binaries clean-packages
@echo "Done cleaning"
test: # Run go tests
test:
@go test ./...
package: # Create a (.deb) package#Output: out/
package: test build-binaries
@mkdir -p out
@cd deployments/debian && VERSION=$(VERSION) $(MAKE) build
@echo Removing artifacts
@cd deployments/debian && VERSION=$(VERSION) $(MAKE) clean
coverage: # Create a html coverage report#Output: out/
@go test -coverprofile out/coverage.out ./...
@go tool cover -html=out/coverage.out -o out/coverage.html
@echo "View Coverage in ./out/coverage.html"
help: # Display this help
@echo 'Help:'
@cat makefile | grep ': \#' | grep --invert-match column | sed "s/^/ /" | column -s"\#" -t