forked from harsh-px/px
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
70 lines (53 loc) · 1.26 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
CLINAME := px
SHA := $(shell git rev-parse --short HEAD)
BRANCH := $(subst /,-,$(shell git rev-parse --abbrev-ref HEAD))
VER := $(shell git describe --tags)
#VER := 0.0.0-$(SHA)
ARCH := $(shell go env GOARCH)
GOOS := $(shell go env GOOS)
DIR=.
ifdef APP_SUFFIX
VERSION = $(VER)-$(subst /,-,$(APP_SUFFIX))
else
ifeq (master,$(BRANCH))
VERSION = $(VER)
else
VERSION = $(VER)-$(BRANCH)
endif
endif
LDFLAGS :=-ldflags "-X github.com/portworx/px/cmd.PxVersion=$(VERSION)"
ifneq (windows,$(GOOS))
PKG_NAME = $(CLINAME)
else
PKG_NAME = $(CLINAME).exe
endif
PACKAGE := $(CLINAME)-$(VERSION).$(GOOS).$(ARCH).zip
all: px
install:
go install
lint:
go list ./... | grep -v /vendor/ | xargs -L1 golint -set_exit_status
px:
go build $(LDFLAGS)
release: darwin_amd64_dist \
windows_amd64_dist \
linux_amd64_dist
darwin_amd64_dist:
GOOS=darwin GOARCH=amd64 $(MAKE) dist
windows_amd64_dist:
GOOS=windows GOARCH=amd64 $(MAKE) dist
linux_amd64_dist:
GOOS=linux GOARCH=amd64 $(MAKE) dist
dist: $(PACKAGE)
test:
./hack/test.sh
$(PACKAGE): all
@echo Packaging client Binaries...
@mkdir -p dist
@zip dist/$@ $(PKG_NAME)
@rm -f $(PKG_NAME)
clean:
rm -f $(PKG_NAME)
rm -rf dist
.PHONY: dist all clean darwin_amd64_dist windows_amd64_dist linux_amd64_dist \
install release px test