-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from zerodha/refactor-config
Add a few refactors
- Loading branch information
Showing
8 changed files
with
241 additions
and
216 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
# Git version for injecting into Go bins. | ||
LAST_COMMIT := $(shell git rev-parse --short HEAD) | ||
LAST_COMMIT_DATE := $(shell git show -s --format=%ci ${LAST_COMMIT}) | ||
VERSION := $(shell git describe --tags) | ||
BUILDSTR := ${VERSION} (Commit: ${LAST_COMMIT_DATE} (${LAST_COMMIT}), Build: $(shell date +"%Y-%m-%d% %H:%M:%S %z")) | ||
# Try to get the commit hash from 1) git 2) the VERSION file 3) fallback. | ||
LAST_COMMIT := $(or $(shell git rev-parse --short HEAD 2> /dev/null),$(shell head -n 1 VERSION | grep -oP -m 1 "^[a-z0-9]+$$"),"") | ||
|
||
BIN := kaf-relay.bin | ||
DIST := dist | ||
# Try to get the semver from 1) git 2) the VERSION file 3) fallback. | ||
VERSION := $(or $(LISTMONK_VERSION),$(shell git describe --tags --abbrev=0 2> /dev/null),$(shell grep -oP 'tag: \Kv\d+\.\d+\.\d+(-[a-zA-Z0-9.-]+)?' VERSION),"v0.0.0") | ||
BUILDSTR := ${VERSION} (\#${LAST_COMMIT} $(shell date -u +"%Y-%m-%dT%H:%M:%S%z")) | ||
|
||
.PHONY: dist | ||
dist: | ||
mkdir -p ${DIST} | ||
CGO_ENABLED=1 go build -o ${BIN} --ldflags="-X 'main.buildString=${BUILDSTR}'" | ||
cp ${BIN} ${DIST} | ||
BIN := kaf-relay | ||
|
||
.PHONY: build | ||
build: $(BIN) | ||
|
||
$(BIN): | ||
CGO_ENABLED=0 go build -o ${BIN} --ldflags="-X 'main.buildString=${BUILDSTR}'" | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -rf ${DIST} | ||
rm -rf ${BIN} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.