2017-03-18 00:38:03 +00:00
|
|
|
NAME=ctop
|
|
|
|
VERSION=$(shell cat VERSION)
|
|
|
|
BUILD=$(shell git rev-parse --short HEAD)
|
2017-06-13 20:25:58 +00:00
|
|
|
EXT_LD_FLAGS="-Wl,--allow-multiple-definition"
|
|
|
|
LD_FLAGS="-w -X main.version=$(VERSION) -X main.build=$(BUILD) -extldflags=$(EXT_LD_FLAGS)"
|
2017-03-18 00:38:03 +00:00
|
|
|
|
|
|
|
clean:
|
2017-07-12 03:16:50 +00:00
|
|
|
rm -rf _build/ release/
|
2017-03-18 00:38:03 +00:00
|
|
|
|
|
|
|
build:
|
2017-09-03 01:33:14 +00:00
|
|
|
dep ensure
|
2017-03-18 00:38:03 +00:00
|
|
|
CGO_ENABLED=0 go build -tags release -ldflags $(LD_FLAGS) -o ctop
|
|
|
|
|
2017-03-19 04:26:25 +00:00
|
|
|
build-dev:
|
2017-06-13 20:25:58 +00:00
|
|
|
go build -ldflags "-w -X main.version=$(VERSION)-dev -X main.build=$(BUILD) -extldflags=$(EXT_LD_FLAGS)"
|
2017-03-19 04:26:25 +00:00
|
|
|
|
2017-03-18 00:38:03 +00:00
|
|
|
build-all:
|
2017-11-18 07:51:15 +00:00
|
|
|
mkdir -p _build
|
2017-06-24 11:04:56 +00:00
|
|
|
GOOS=darwin GOARCH=amd64 go build -tags release -ldflags $(LD_FLAGS) -o _build/ctop-$(VERSION)-darwin-amd64
|
|
|
|
GOOS=linux GOARCH=amd64 go build -tags release -ldflags $(LD_FLAGS) -o _build/ctop-$(VERSION)-linux-amd64
|
|
|
|
GOOS=linux GOARCH=arm go build -tags release -ldflags $(LD_FLAGS) -o _build/ctop-$(VERSION)-linux-arm
|
|
|
|
GOOS=linux GOARCH=arm64 go build -tags release -ldflags $(LD_FLAGS) -o _build/ctop-$(VERSION)-linux-arm64
|
2017-11-18 07:51:15 +00:00
|
|
|
cd _build; sha256sum * > sha256sums.txt
|
2017-03-18 00:38:03 +00:00
|
|
|
|
2017-03-19 04:26:25 +00:00
|
|
|
image:
|
2017-03-19 06:14:56 +00:00
|
|
|
docker build -t ctop -f Dockerfile .
|
2017-03-19 04:26:25 +00:00
|
|
|
|
2017-03-18 00:38:03 +00:00
|
|
|
release:
|
2017-07-12 03:16:50 +00:00
|
|
|
mkdir release
|
2017-03-18 00:38:03 +00:00
|
|
|
go get github.com/progrium/gh-release/...
|
2017-07-12 03:16:50 +00:00
|
|
|
cp _build/* release
|
2017-03-18 00:38:03 +00:00
|
|
|
gh-release create bcicen/$(NAME) $(VERSION) \
|
|
|
|
$(shell git rev-parse --abbrev-ref HEAD) $(VERSION)
|
|
|
|
|
|
|
|
.PHONY: build
|