Skip to content

Commit

Permalink
Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
fbsobreira committed May 3, 2020
1 parent 19983f8 commit 3ef1f98
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
SHELL := /bin/bash
version := $(shell git rev-list --count HEAD)
commit := $(shell git describe --always --long --dirty)
built_at := $(shell date +%FT%T%z)
built_by := ${USER}@cryptochain.network
BUILD_TARGET := tronctl

flags := -gcflags="all=-N -l -c 2"
ldflags := -X main.version=v${version} -X main.commit=${commit}
ldflags += -X main.builtAt=${built_at} -X main.builtBy=${built_by}
cli := ./bin/${BUILD_TARGET}
uname := $(shell uname)

env := GO111MODULE=on

DIR := ${CURDIR}
export CGO_LDFLAGS=-L$(DIR)/bin/lib -Wl,-rpath -Wl,\$ORIGIN/lib

all:
$(env) go build -o $(cli) -ldflags="$(ldflags)" cmd/main.go

debug:
$(env) go build $(flags) -o $(cli) -ldflags="$(ldflags)" cmd/main.go

install:all
cp $(cli) ~/.local/bin

clean:
@rm -f $(cli)
@rm -rf ./bin

0 comments on commit 3ef1f98

Please sign in to comment.