-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
36 lines (26 loc) · 905 Bytes
/
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
GOFMT_FILES ?= $$(find . -name '*.go' |grep -v vendor)
GOTEST ?= $$(go list ./... |grep -v 'vendor')
VERSION ?= $(shell git describe --exact-match 2> /dev/null || \
git describe --match=$(git rev-parse --short=8 HEAD) --always --dirty --abbrev=8)
TARGET := rackspace-cloud-controller-manager
LDFLAGS := "-w -s -X 'github.com/os-pc/cloud-provider-rackspace/pkg/version.Version=${VERSION}'"
REGISTRY := ospc
default: build
fmtcheck:
@echo "gofmt -s -d *.go"
@sh -c "'$(CURDIR)/scripts/gofmtcheck.sh'"
fmt:
gofmt -s -w $(GOFMT_FILES)
test: fmtcheck
go test $(GOTEST)
build: fmtcheck
GCO_ENABLED=0 GOOS=linux go build \
-ldflags $(LDFLAGS) \
-o $(TARGET) \
cmd/openstack-cloud-controller-manager/main.go
clean:
rm -rf $(TARGET)
image: build
docker build -t $(REGISTRY)/$(TARGET):$(VERSION) .
push: image
docker push $(REGISTRY)/$(TARGET):$(VERSION)