forked from kubeflow/spark-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
38 lines (32 loc) · 1.45 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
.SILENT:
.PHONY: clean-sparkctl
SPARK_OPERATOR_GOPATH=/go/src/github.com/GoogleCloudPlatform/spark-on-k8s-operator
DEP_VERSION:=`grep DEP_VERSION= Dockerfile | awk -F\" '{print $$2}'`
BUILDER=`grep "FROM golang:" Dockerfile | awk '{print $$2}'`
UNAME:=`uname | tr '[:upper:]' '[:lower:]'`
all: clean-sparkctl build-sparkctl install-sparkctl
build-sparkctl:
[ ! -f "sparkctl/sparkctl-darwin-amd64" ] || [ ! -f "sparkctl/sparkctl-linux-amd64" ] && \
echo building using $(BUILDER) and dep $(DEP_VERSION) && \
docker run -it -w $(SPARK_OPERATOR_GOPATH) \
-v $$(pwd):$(SPARK_OPERATOR_GOPATH) $(BUILDER) sh -c \
"apk add --no-cache bash git && \
wget https://github.com/golang/dep/releases/download/v"$(DEP_VERSION)"/dep-linux-amd64 -O /usr/bin/dep && \
chmod +x /usr/bin/dep && \
cd sparkctl && \
dep ensure -v -vendor-only && \
./build.sh" || true
clean-sparkctl:
rm -f sparkctl/sparkctl-darwin-amd64 sparkctl/sparkctl-linux-amd64
install-sparkctl: | sparkctl/sparkctl-darwin-amd64 sparkctl/sparkctl-linux-amd64
@if [ "$(UNAME)" = "linux" ]; then \
echo "installing linux binary to /usr/local/bin/sparkctl"; \
sudo cp sparkctl/sparkctl-linux-amd64 /usr/local/bin/sparkctl; \
sudo chmod +x /usr/local/bin/sparkctl; \
elif [ "$(UNAME)" = "darwin" ]; then \
echo "installing macos binary to /usr/local/bin/sparkctl"; \
cp sparkctl/sparkctl-darwin-amd64 /usr/local/bin/sparkctl; \
chmod +x /usr/local/bin/sparkctl; \
else \
echo "$(UNAME) not supported"; \
fi