Skip to content

Commit 7f88f72

Browse files
author
Jeff McCormick
authored
Merge pull request CrunchyData#29 from crunchyjohn/master
Prevent 'make clean' from being dangerous
2 parents 41688df + ff3cd2b commit 7f88f72

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

Makefile

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,25 @@
1-
21
RELTMPDIR=/tmp/release.$(CO_VERSION)
32
RELFILE=/tmp/postgres-operator.$(CO_VERSION).tar.gz
43

4+
#======= Safety checks =======
5+
check-go-vars:
6+
ifndef GOPATH
7+
$(error GOPATH is not set)
8+
endif
9+
ifndef GOBIN
10+
$(error GOBIN is not set)
11+
endif
12+
13+
#======= Main functions =======
514
run:
615
cd examples/operator && ./run.sh
7-
pgo:
16+
pgo: check-go-vars
817
cd client && go build -o $(GOBIN)/pgo pgo.go
9-
clean:
18+
clean: check-go-vars
1019
rm -rf $(GOPATH)/pkg/* $(GOBIN)/*
1120
go get -u github.com/FiloSottile/gvt
1221
gvt restore
13-
operatorimage:
22+
operatorimage: check-go-vars
1423
cd operator && go install postgres-operator.go
1524
cp $(GOBIN)/postgres-operator bin/postgres-operator
1625
docker build -t postgres-operator -f $(CO_BASEOS)/Dockerfile.postgres-operator.$(CO_BASEOS) .
@@ -25,7 +34,7 @@ all:
2534
push:
2635
docker push crunchydata/lspvc:$(CO_IMAGE_TAG)
2736
docker push crunchydata/postgres-operator:$(CO_IMAGE_TAG)
28-
release:
37+
release: check-go-vars
2938
rm -rf $(RELTMPDIR) $(RELFILE)
3039
mkdir $(RELTMPDIR)
3140
cp $(GOBIN)/pgo $(RELTMPDIR)

0 commit comments

Comments
 (0)