forked from dhutty/golinks
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
47 lines (36 loc) · 950 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
46
47
.PHONY: dev build image release test deps clean
CGO_ENABLED=0
COMMIT=`git rev-parse --short HEAD`
APP=golinks
REPO?=prologic/$(APP)
TAG?=latest
BUILD?=-dev
all: dev
dev: build
@./$(APP)
deps:
@go get github.com/GeertJohan/go.rice/rice
@go get ./...
@rice embed-go
build: clean deps
@echo " -> Building $(TAG)$(BUILD)"
@go build -tags "netgo static_build" -installsuffix netgo \
-ldflags "-w -X github.com/$(REPO).GitCommit=$(COMMIT) -X github.com/$(REPO).Build=$(BUILD)" .
@echo "Built $$(./$(APP) -v)"
image:
@docker build --build-arg TAG=$(TAG) --build-arg BUILD=$(BUILD) -t $(REPO):$(TAG) .
@echo "Image created: $(REPO):$(TAG)"
release:
@./tools/release.sh
profile:
@go test -cpuprofile cpu.prof -memprofile mem.prof -v -bench ./...
bench:
@go test -v -bench ./...
test: build
@go test -v \
-cover -coverprofile=coverage.txt -covermode=atomic \
-coverpkg=$(shell go list) \
-race \
.
clean:
@git clean -f -d -X