-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
45 lines (36 loc) · 929 Bytes
/
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
36
37
38
39
40
41
42
43
44
45
GOARCH ?= $(shell go env GOARCH)
GOOS ?= $(shell go env GOOS)
PWD = $(shell pwd)
BUILD_DIR := ${PWD}/build
DIST_DIR := ${BUILD_DIR}/dist/$(GOOS)_$(GOARCH)
REPORTS_DIR := ${BUILD_DIR}/reports/coverage
.PHONY: all
all: version clean test coverage build
############
## Building
############
.PHONY: build-dirs
build-dirs:
@mkdir -p ${BUILD_DIR}
@mkdir -p ${DIST_DIR}
@mkdir -p ${REPORTS_DIR}
.PHONY: build
build: build-dirs Makefile
@echo "Building ${DIST_DIR}/avm..."
@go build -v -ldflags="-X 'github.com/armory/avm/cmd.Version=${VERSION}'" -o ${DIST_DIR}/avm main.go
############
## Testing
############
.PHONY: test
test: build-dirs Makefile
@go test -cover ./...
.PHONY: coverage
coverage:
@go test -coverprofile=profile.cov ./...
@go tool cover -html=profile.cov -o ${BUILD_DIR}/reports/coverage/index.html
.PHONY: version
version:
@echo $(VERSION)
.PHONY: clean
clean:
rm -rf dist