-
Notifications
You must be signed in to change notification settings - Fork 14
/
Makefile
45 lines (32 loc) · 1.1 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
.PHONY: all build ci clean dep format ginkgo test install
BUILD_DEST = build/uaa
INSTALL_DEST = $(GOPATH)/bin/uaa
COMMIT_HASH=`git rev-parse --short HEAD`
GOFILES=`find . -type f -name '*.go'`
ifndef VERSION
VERSION = DEV
endif
GOFLAGS := -v -ldflags "-X code.cloudfoundry.org/uaa-cli/version.Version=${VERSION} -X code.cloudfoundry.org/uaa-cli/version.Commit=${COMMIT_HASH}"
all: dep test clean build
clean:
rm -rf build
format:
gofmt -l -s -w ${GOFILES}
ginkgo:
bin/test 2>&1
test: format ginkgo
dep:
go install github.com/onsi/ginkgo/ginkgo@latest
ci: ginkgo
build:
mkdir -p build
CGO_ENABLED=0 go build $(GOFLAGS) -o $(BUILD_DEST)
build_all:
mkdir -p build
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build $(GOFLAGS) -o $(BUILD_DEST)-darwin-arm64
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build $(GOFLAGS) -o $(BUILD_DEST)-darwin-amd64
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build $(GOFLAGS) -o $(BUILD_DEST)-linux-amd64
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build $(GOFLAGS) -o $(BUILD_DEST)-windows-amd64
install:
rm -rf $(INSTALL_DEST)
cp $(BUILD_DEST) $(INSTALL_DEST)