-
Notifications
You must be signed in to change notification settings - Fork 215
/
Makefile
33 lines (25 loc) · 839 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
32
33
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
all:
$(env) go build -o $(cli) -ldflags="$(ldflags)" cmd/main.go
windows:
$(env) GOOS=windows GOARCH=amd64 go build -o $(cli).exe -ldflags="$(ldflags)" cmd/main.go
run:
$(env) go run -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