2017-04-19 13:36:52 +00:00
|
|
|
SISYPHUS_GO_EXECUTABLE ?= go
|
|
|
|
DIST_DIRS := find * -type d -exec
|
2017-04-19 19:04:06 +00:00
|
|
|
VERSION_GIT != git describe --tags
|
|
|
|
VERSION_GIT_CLEAN != echo ${VERSION_GIT} | sed -nre 's/^[^0-9]*(([0-9]+\.)*[0-9]+).*/\1/p'
|
|
|
|
VERSION ?= ${VERSION_GIT_CLEAN}
|
|
|
|
VERSION_INCHANGELOG != head -n1 CHANGELOG.md | sed -nre 's/^[^0-9]*(([0-9]+\.)*[0-9]+).*/\1/p'
|
2017-04-19 13:36:52 +00:00
|
|
|
|
2017-04-19 19:04:06 +00:00
|
|
|
verify-version:
|
|
|
|
@if [ "$(VERSION)" = "$(VERSION_INCHANGELOG)" ]; then \
|
|
|
|
echo "sisyphus: $(VERSION_INCHANGELOG)"; \
|
|
|
|
elif [ "$(VERSION)" = "$(VERSION_INCHANGELOG)-dev" ]; then \
|
|
|
|
echo "sisyphus (development): $(VERSION_INCHANGELOG)"; \
|
|
|
|
else \
|
|
|
|
echo "Version number does not match CHANGELOG.md"; \
|
|
|
|
echo "Build Version: $(VERSION)"; \
|
|
|
|
echo "CHANGELOG : $(VERSION_INCHANGELOG)"; \
|
|
|
|
exit 1; \
|
|
|
|
fi
|
|
|
|
|
|
|
|
build: verify-version
|
2017-04-19 14:35:12 +00:00
|
|
|
${SISYPHUS_GO_EXECUTABLE} build -o sisyphus/sisyphus -ldflags "-X main.version=${VERSION}" sisyphus/sisyphus.go
|
2017-04-19 13:36:52 +00:00
|
|
|
|
|
|
|
install: build
|
|
|
|
install -d ${DESTDIR}/usr/local/bin/
|
2017-04-19 14:35:12 +00:00
|
|
|
install -m 755 ./sisyphus/sisyphus ${DESTDIR}/usr/local/bin/sisyphus
|
2017-04-19 13:36:52 +00:00
|
|
|
|
|
|
|
test:
|
2017-04-19 14:35:12 +00:00
|
|
|
${SISYPHUS_GO_EXECUTABLE} get -u github.com/onsi/ginkgo/ginkgo
|
|
|
|
${SISYPHUS_GO_EXECUTABLE} get -u github.com/onsi/gomega
|
|
|
|
${GOPATH}/bin/ginkgo -r --randomizeAllSpecs --randomizeSuites --failOnPending --progress
|
2017-04-19 13:36:52 +00:00
|
|
|
|
|
|
|
integration-test:
|
|
|
|
${SISYPHUS_GO_EXECUTABLE} build
|
|
|
|
./sisyphus run
|
|
|
|
./sisyphus start
|
|
|
|
./sisyphus restart
|
|
|
|
./sisyphus status
|
|
|
|
./sisyphus stop
|
|
|
|
|
|
|
|
clean:
|
2017-04-19 14:35:12 +00:00
|
|
|
rm -f ./sisyphus/sisyphus
|
2017-04-19 13:36:52 +00:00
|
|
|
rm -rf ./dist
|
|
|
|
|
|
|
|
build-all:
|
2017-04-19 14:35:12 +00:00
|
|
|
${SISYPHUS_GO_EXECUTABLE} get -u github.com/franciscocpg/gox
|
|
|
|
${GOPATH}/bin/gox -verbose \
|
2017-04-19 13:36:52 +00:00
|
|
|
-ldflags "-X main.version=${VERSION}" \
|
|
|
|
-os="linux darwin windows freebsd openbsd netbsd" \
|
|
|
|
-arch="amd64 386 armv5 armv6 armv7 arm64" \
|
|
|
|
-osarch="!darwin/arm64" \
|
2017-04-19 14:35:12 +00:00
|
|
|
-output="dist/{{.OS}}-{{.Arch}}/{{.Dir}}" ./sisyphus
|
2017-04-19 13:36:52 +00:00
|
|
|
|
|
|
|
dist: build-all
|
|
|
|
cd dist && \
|
|
|
|
$(DIST_DIRS) cp ../LICENSE {} \; && \
|
|
|
|
$(DIST_DIRS) cp ../README.md {} \; && \
|
|
|
|
$(DIST_DIRS) tar -zcf sisyphus-${VERSION}-{}.tar.gz {} \; && \
|
|
|
|
$(DIST_DIRS) zip -r sisyphus-${VERSION}-{}.zip {} \; && \
|
|
|
|
cd ..
|
|
|
|
|
2017-04-19 14:35:12 +00:00
|
|
|
.PHONY: build test install clean build-all dist integration-test verify-version
|
2017-04-19 13:36:52 +00:00
|
|
|
|