From ca8b0228e3caed0aa60a9eaa1a02d7d4e60a6ced Mon Sep 17 00:00:00 2001 From: Terekhin Alexander Date: Wed, 15 May 2024 10:09:35 +0300 Subject: [PATCH] Add makefile Signed-off-by: Terekhin Alexander --- Makefile | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..060505f --- /dev/null +++ b/Makefile @@ -0,0 +1,30 @@ +BINARY = cli-mon +GOARCH = amd64 + +LDFLAGS = -ldflags "-s -w -buildid=$(git rev-parse HEAD)" + +# Build the project +all: clean test linux darwin windows + +linux: + GOOS=linux GOARCH=${GOARCH} go build ${LDFLAGS} -tags netgo -o ${BINARY}-linux-${GOARCH} . ; \ + cd - >/dev/null + +darwin: + GOOS=darwin GOARCH=${GOARCH} go build ${LDFLAGS} -tags netgo -o ${BINARY}-darwin-${GOARCH} . ; \ + cd - >/dev/null + +windows: + GOOS=windows GOARCH=${GOARCH} go build ${LDFLAGS} -tags netgo -o ${BINARY}-windows-${GOARCH}.exe . ; \ + cd - >/dev/null + +test: + go test + +fmt: + go fmt + +clean: + rm -f ${BINARY}-* + +.PHONY: linux darwin windows test fmt clean \ No newline at end of file