forked from sorintlab/stolon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
43 lines (28 loc) · 1.2 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
PROJDIR=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
# change to project dir so we can express all as relative paths
$(shell cd $(PROJDIR))
REPO_PATH=github.com/sorintlab/stolon
VERSION ?= $(shell scripts/git-version.sh)
LD_FLAGS="-w -X $(REPO_PATH)/cmd.Version=$(VERSION)"
$(shell mkdir -p bin )
.PHONY: all
all: build
.PHONY: build
build: sentinel keeper proxy stolonctl
.PHONY: test
test: build
./test
.PHONY: sentinel keeper proxy stolonctl docker
keeper:
GO111MODULE=on go build -ldflags $(LD_FLAGS) -o $(PROJDIR)/bin/stolon-keeper $(REPO_PATH)/cmd/keeper
sentinel:
CGO_ENABLED=0 GO111MODULE=on go build -ldflags $(LD_FLAGS) -o $(PROJDIR)/bin/stolon-sentinel $(REPO_PATH)/cmd/sentinel
proxy:
CGO_ENABLED=0 GO111MODULE=on go build -ldflags $(LD_FLAGS) -o $(PROJDIR)/bin/stolon-proxy $(REPO_PATH)/cmd/proxy
stolonctl:
CGO_ENABLED=0 GO111MODULE=on go build -ldflags $(LD_FLAGS) -o $(PROJDIR)/bin/stolonctl $(REPO_PATH)/cmd/stolonctl
.PHONY: docker
docker:
if [ -z $${PGVERSION} ]; then echo 'PGVERSION is undefined'; exit 1; fi; \
if [ -z $${TAG} ]; then echo 'TAG is undefined'; exit 1; fi; \
docker build --build-arg PGVERSION=${PGVERSION} -t ${TAG} -f examples/kubernetes/image/docker/Dockerfile .