-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
35 lines (24 loc) · 1.13 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
GOOS := $(if $(GOOS),$(GOOS),linux)
GOARCH := $(if $(GOARCH),$(GOARCH),amd64)
GO=GO15VENDOREXPERIMENT="1" CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH) GO111MODULE=on go
GOTEST=GO15VENDOREXPERIMENT="1" CGO_ENABLED=1 GO111MODULE=on go test # go race detector requires cgo
VERSION := $(if $(VERSION),$(VERSION),latest)
PACKAGES := $$(go list ./...| grep -vE 'vendor' )
TEST_DIR := /tmp/schrodinger_test
FILES := $$(find . -name "*.go" | grep -vE "vendor")
GOFILTER := grep -vE 'vendor|render.Delims|bindata_assetfs|testutil|\.pb\.go'
GOCHECKER := $(GOFILTER) | awk '{ print } END { if (NR > 0) { exit 1 } }'
GOLINT := go list ./... | grep -vE 'vendor' | xargs -L1 -I {} golint {} 2>&1 | $(GOCHECKER)
LDFLAGS += -X "github.com/you06/doppelganger/util.BuildTS=$(shell date -u '+%Y-%m-%d %I:%M:%S')"
LDFLAGS += -X "github.com/you06/doppelganger/util.BuildHash=$(shell git rev-parse HEAD)"
GOBUILD=$(GO) build -ldflags '$(LDFLAGS)'
default: build
build: client
all: check test manager agent sch-ctl notifier-mgr
client:
$(GOBUILD) $(GOMOD) -o bin/doppelganger *.go
clean:
@rm -rf bin/*
.PHONY: all clean client test
test:
$(GOTEST) ./...