-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
42 lines (34 loc) · 1.06 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
name=beacon
version=$(shell git describe --tags --dirty)
gopkgs=./cmd/beacon ./beacon ./debug ./docker ./sns
export GOBIN=$(shell pwd)/bin
export GOPATH=$(shell pwd)/.go
org_url=github.com/BlueDragonX
org_path=$(GOPATH)/src/$(org_url)
project_url=$(org_url)/$(name)
project_path=$(org_path)/$(name)
.PHONY: clean test static
all: build
build: $(GOBIN)/beacon
static: $(OGBIN)/beacon.static
clean:
rm -rf $(GOBIN) $(GOPATH)
$(project_path):
mkdir -p $(org_path)
ln -sf $(shell pwd) $(project_path)
$(GOBIN)/beacon: $(project_path)
go get -d $(project_url)/cmd/beacon
go install $(project_url)/cmd/beacon
$(GOBIN)/beacon.static: $(project_path)
go get -d $(project_url)/cmd/beacon
GOBIN=$(GOPATH)/bin go install -ldflags "-linkmode external -extldflags -static" $(project_url)/cmd/beacon
mkdir -p $(GOBIN)
mv $(GOPATH)/bin/beacon $(GOBIN)/beacon.static
test: $(project_path)
test -z "$(shell gofmt -s -l $(gopkgs))"
for gopkg in $(gopkgs); do \
golint -set_exit_status $$gopkg || exit 1; \
done
go vet $(gopkgs)
go get -d -t $(gopkgs)
go test -v -race $(gopkgs)