From b00157bfaf35d747b74cbfdc45d3ff8dd4f75b95 Mon Sep 17 00:00:00 2001 From: Yusuf Kanchwala Date: Thu, 23 Jul 2020 23:58:01 +0530 Subject: [PATCH] add Makefile --- Makefile | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..e5cdcdefe --- /dev/null +++ b/Makefile @@ -0,0 +1,41 @@ +GITCOMMIT := $(shell git rev-parse --short HEAD 2>/dev/null) +BUILD_FLAGS := -v -ldflags "-w -s" + +BUILD_DIR = build +BINARY_NAME = terrascan + + +# default +default: build + + +# build terrascan binary +build: clean + @mkdir -p $(BUILD_DIR) > /dev/null + go build ${BUILD_FLAGS} -o ${BUILD_DIR}/${BINARY_NAME} cmd/terrascan/main.go + @echo "terrascan binary created in ${BUILD_DIR} directory" + + +# clean build +clean: + @rm -rf $(BUILD_DIR) + + +# run all validation tests +validate: gofmt govet golint + + +# gofmt validation +gofmt: + ./scripts/validate-gofmt.sh + ./scripts/fix-gofmt.sh + + +# golint validation +golint: + ./scripts/validate-golint.sh + + +# govet validation +govet: + ./scripts/validate-govet.sh