2016-07-22 19:30:21 +03:00
|
|
|
BINDIR=bin
|
|
|
|
BIN=custom-script-extension
|
2016-07-29 00:39:53 +03:00
|
|
|
BUNDLEDIR=bundle
|
|
|
|
BUNDLE=custom-script-extension.zip
|
2016-07-22 19:30:21 +03:00
|
|
|
|
2016-07-29 00:43:15 +03:00
|
|
|
bundle: clean binary
|
|
|
|
@mkdir -p $(BUNDLEDIR)
|
|
|
|
zip ./$(BUNDLEDIR)/$(BUNDLE) ./$(BINDIR)/$(BIN)
|
|
|
|
zip ./$(BUNDLEDIR)/$(BUNDLE) ./$(BINDIR)/custom-script-shim
|
2016-08-01 23:51:52 +03:00
|
|
|
zip -j ./$(BUNDLEDIR)/$(BUNDLE) ./misc/HandlerManifest.json
|
2016-07-22 19:30:21 +03:00
|
|
|
binary: clean
|
|
|
|
if [ -z "$$GOPATH" ]; then \
|
|
|
|
echo "GOPATH is not set"; \
|
|
|
|
exit 1; \
|
|
|
|
fi
|
|
|
|
GOOS=linux GOARCH=amd64 go build -v \
|
|
|
|
-ldflags "-X main.BuildDate=`date -u --rfc-3339=seconds 2> /dev/null | sed -e 's/ /T/'` \
|
|
|
|
-X main.Version=`<./VERSION` \
|
|
|
|
-X main.GitCommit=`git rev-parse --short HEAD` \
|
2016-07-28 01:00:01 +03:00
|
|
|
-X main.State=`if [ -n "$$(git status --porcelain)" ]; then echo 'dirty'; fi`" \
|
2016-08-01 23:44:25 +03:00
|
|
|
-o $(BINDIR)/$(BIN) ./main
|
2016-07-29 00:39:53 +03:00
|
|
|
cp ./misc/custom-script-shim ./$(BINDIR)
|
2016-07-22 19:30:21 +03:00
|
|
|
clean:
|
2016-07-29 00:39:53 +03:00
|
|
|
rm -rf "$(BINDIR)" "$(BUNDLEDIR)"
|
2016-07-22 19:30:21 +03:00
|
|
|
|
2016-07-29 00:39:53 +03:00
|
|
|
.PHONY: clean binary
|