-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
58 lines (46 loc) · 1.12 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
GO15VENDOREXPERIMENT = 1
OSXCROSS_NO_INCLUDE_PATH_WARNINGS = 1
VERSION = v0.0.1
NAME := kustomize_api
TARGET := bin/$(NAME)
DIST_DIRS := find * -type d -exec
SRCS := $(shell find . -type f -name '*.go')
LDFLAGS := -ldflags="-s -X \"main.version=$(VERSION)\""
OPTS :=-a -installsuffix cgo
$(TARGET): $(SRCS)
go build $(OPTS) $(LDFLAGS) -o bin/$(NAME) ${NAME}.go
.PHONY: install
install:
go install $(LDFLAGS)
.PHONY: clean
clean:
rm -rf bin/*
.PHONY: clean-all
clean-all:
rm -rf bin/*
rm -rf dist/*
.PHONY: run
run:
go run $(NAME).go
.PHONY: upde
upde:
dep ensure -update
.PHONY: deps
dep:
dep ensure
.PHONY: dep-install
dep-install:
go get -u github.com/golang/dep/cmd/dep
cross-build: deps
for os in darwin linux windows; do \
for arch in amd64 386; do \
GOOS=$$os GOARCH=$$arch CGO_ENABLED=0 go build -a -tags netgo -installsuffix netgo $(LDFLAGS) -o dist/$(NAME)-$$os-$$arch/$(NAME); \
done; \
done
dist:
cd dist && \
$(DIST_DIRS) cp ../LICENSE {} \; && \
$(DIST_DIRS) cp ../README.md {} \; && \
$(DIST_DIRS) tar -zcf {}-$(VERSION).tar.gz {} \; && \
$(DIST_DIRS) zip -r {}-$(VERSION).zip {} \; && \
cd ..