Skip to content

Commit

Permalink
add: Makefile
Browse files Browse the repository at this point in the history
Signed-off-by: Hemanth Krishna <[email protected]>
  • Loading branch information
DarthBenro008 committed Mar 6, 2023
1 parent 736525d commit a0a5248
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@

# Go workspace file
go.work
.idea/
.idea/
.bin/
31 changes: 31 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
PROJECT_NAME = "sorobix-formatter"
BASE=$(shell pwd)
BUILD_DIR=$(BASE)/bin
VERSION ?= "v1.0"
BUILD_DATE = $(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
COMMIT_SHA = $(shell git rev-parse --short HEAD)
LDFLAGS = -ldflags "-w -X main.version=${VERSION} -X main.buildDate=${BUILD_DATE} -X main.commit=${COMMIT_SHA}"
PACKAGE = $(shell go list -m)

.PHONY: clean
clean:
@echo "> Cleaning Build targets"
rm -rf bin

.PHONY: deps
deps:
@echo "> Installing dependencies"
@go mod tidy
@go mod download

.PHONY: build
build: deps
@echo "> Building Binary"
go build ${LDFLAGS} -o ${BUILD_DIR}/${PROJECT_NAME}
@echo "> Binary has been built successfully"


.PHONY: run
run: build
@echo "> Running ${PROJECT_NAME}"
${BUILD_DIR}/${PROJECT_NAME}

0 comments on commit a0a5248

Please sign in to comment.