forked from romapres2010/httpserver
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake_linux
More file actions
45 lines (36 loc) · 1.01 KB
/
Copy pathmake_linux
File metadata and controls
45 lines (36 loc) · 1.01 KB
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
APP?=httpserver
GOOS?=linux
COMMIT?=$(shell git rev-parse --short HEAD)
BUILD_TIME?=$(shell date -u '+%Y-%m-%d_%H:%M:%S')
.PHONY: check
check: prepare_metalinter
golangci-lint run ../../...
.PHONY: rebuild
rebuild: clean
CGO_ENABLED=0 GOOS=${GOOS} go build -v -a -mod vendor \
-ldflags "-X main.commit=${COMMIT} -X main.buildTime=${BUILD_TIME}" \
-o bin/${GOOS}/${APP}
.PHONY: build
build: clean
CGO_ENABLED=0 GOOS=${GOOS} go build -v -mod vendor \
-ldflags "-X main.commit=${COMMIT} -X main.buildTime=${BUILD_TIME}" \
-o bin/${GOOS}/${APP}
.PHONY: clean
clean:
@rm -f bin/${GOOS}/${APP}
.PHONY: vendor
vendor: prepare_dep
dep ensure
HAS_DEP := $(shell command -v dep;)
HAS_METALINTER := $(shell command -v golangci-lint;)
.PHONY: prepare_dep
prepare_dep:
ifndef HAS_DEP
go get -u -v -d github.com/golang/dep/cmd/dep && \
go install -v github.com/golang/dep/cmd/dep
endif
.PHONY: prepare_metalinter
prepare_metalinter:
ifndef HAS_METALINTER
go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
endif