-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
31 lines (26 loc) · 747 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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"
CGO_ENABLED=0 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}