-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
51 lines (39 loc) · 1.81 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
BUILD_DIR=build
CC=go build
GITHASH=$(shell git rev-parse HEAD)
DFLAGS=-race
CFLAGS=-X github.com/warp-poke/ssl-go-agent/cmd.githash=$(GITHASH)
CROSS=GOOS=linux GOARCH=amd64
rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d))
VPATH= $(BUILD_DIR)
.SECONDEXPANSION:
init:
go get -u github.com/alecthomas/gometalinter
gometalinter --install --update
dep:
dep ensure
build: poke-ssl-agent.go $$(call rwildcard, ./cmd, *.go) $$(call rwildcard, ./core, *.go)
$(CC) $(DFLAGS) -ldflags "$(CFLAGS)" -o $(BUILD_DIR)/poke-ssl-agent poke-ssl-agent.go
.PHONY: release
release: poke-ssl-agent.go $$(call rwildcard, ./cmd, *.go) $$(call rwildcard, ./core, *.go)
$(CC) -ldflags "$(CFLAGS)" -o $(BUILD_DIR)/poke-ssl-agent poke-ssl-agent.go
.PHONY: dist
dist: poke-ssl-agent.go $$(call rwildcard, ./cmd, *.go) $$(call rwildcard, ./core, *.go)
$(CROSS) $(CC) -ldflags "$(CFLAGS) -s -w" -o $(BUILD_DIR)/poke-ssl-agent poke-ssl-agent.go
.PHONY: lint
lint:
@command -v gometalinter >/dev/null 2>&1 || { echo >&2 "gometalinter is required but not available please follow instructions from https://github.com/alecthomas/gometalinter"; exit 1; }
gometalinter --deadline=180s --disable-all --enable=gofmt ./cmd/... ./models/... ./
gometalinter --deadline=180s --disable-all --enable=vet ./cmd/... ./models/... ./
gometalinter --deadline=180s --disable-all --enable=golint ./cmd/... ./models/... ./
gometalinter --deadline=180s --disable-all --enable=ineffassign ./cmd/... ./models/... ./
gometalinter --deadline=180s --disable-all --enable=misspell ./cmd/... ./models/... ./
gometalinter --deadline=180s --disable-all --enable=staticcheck ./cmd/... ./models/... ./
.PHONY: format
format:
gofmt -w -s ./cmd ./core ./models poke-ssl-agent.go
.PHONY: dev
dev: format lint build
.PHONY: clean
clean:
rm -rf $BUILD_DIR