diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..7743202 --- /dev/null +++ b/Makefile @@ -0,0 +1,21 @@ +ifndef VERBOSE +.SILENT: +endif + +all: binary + +.PHONY: fmt +fmt: + sh ./scripts/build.sh fmt + +.PHONY: clean +clean: + sh ./scripts/build.sh clean + +.PHONY: binary +binary: + sh ./scripts/build.sh build + +.PHONY: install +install: + sh ./scripts/build.sh install \ No newline at end of file diff --git a/scripts/build.sh b/scripts/build.sh new file mode 100644 index 0000000..0a5786f --- /dev/null +++ b/scripts/build.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +set -eu + +TARGET=${TARGET:-"target"} + +GOOS="$(go env GOOS)" +GOARCH="$(go env GOARCH)" + +TARGET="$TARGET/${GOOS}-${GOARCH}/docker-pps" +if [ "${GOOS}" = "windows" ]; then + TARGET="${TARGET}.exe" +fi + +case "$1" in + fmt) + go fmt $(go list) + ;; + clean) + rm -rf ./target + ;; + build) + go build -o "${TARGET}" + ;; + install) + go install + ;; + *) + echo "Usage: $0 {fmt|clean|build|install}" + exit 1 +esac +