ctop/Makefile

38 lines
1.3 KiB
Makefile
Raw Normal View History

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
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-18 00:38:03 +00:00
build-all:
2017-11-18 07:51:15 +00:00
mkdir -p _build
2018-01-31 17:05:54 +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
GOOS=windows GOARCH=amd64 go build -tags release -ldflags $(LD_FLAGS) -o _build/ctop-$(VERSION)-windows-amd64
2017-11-18 07:51:15 +00:00
cd _build; sha256sum * > sha256sums.txt
2017-03-18 00:38:03 +00:00
image:
docker build -t ctop -f Dockerfile .
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-11-19 15:06:29 +00:00
cd release; sha256sum --quiet --check sha256sums.txt
2017-03-18 00:38:03 +00:00
gh-release create bcicen/$(NAME) $(VERSION) \
$(shell git rev-parse --abbrev-ref HEAD) $(VERSION)
.PHONY: build