-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
25 additions
and
8 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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
APP_NAME := dr | ||
|
||
VERSION :=$(shell git describe --match 'v[0-9]*' --dirty='.m' --always) | ||
REVISION :=$(shell git rev-parse HEAD)$(shell if git diff --no-ext-diff --quiet --exit-code; then echo .m; fi) | ||
|
||
OS ?=$(shell uname -s | tr '[:upper:]' '[:lower:]') | ||
ARCH ?=$(shell go env GOARCH | tr '[:upper:]' '[:lower:]') | ||
|
||
build: | ||
@if [ -z "$(ARCH)" ]; then echo "mandatory ARCH field is empty"; exit 1; fi | ||
@if [ -z "$(OS)" ]; then echo "mandatory OS field is empty"; exit 1; fi | ||
@echo "Building for OS=$(OS), ARCH=$(ARCH), VERSION=$(VERSION), REVISION=$(REVISION)" | ||
@GOOS=$(OS) GOARCH=$(ARCH) go build \ | ||
-ldflags "-X main.Version=$(VERSION) -X main.Revision=$(REVISION) -s -w" \ | ||
-trimpath -a -o $(APP_NAME) | ||
|
||
test: | ||
go test ./... -v | ||
|
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