-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
executable file
·73 lines (63 loc) · 2.63 KB
/
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
EXECUTABLE := bitcoinpay-miner
GITVERSION := $(shell git rev-parse --short HEAD)
DEV=dev
RELEASE=release
LDFLAG_DEV = -X github.com/btceasypay/github.com/btceasypay/bitcoinpay-miner/version.Build=$(DEV)-$(GITVERSION)
LDFLAG_RELEASE = -X github.com/btceasypay/github.com/btceasypay/bitcoinpay-miner/version.Build=$(RELEASE)-$(GITVERSION)
GOFLAGS_DEV = -ldflags "$(LDFLAG_DEV)"
TAGS=cuda
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
TAGS=opencl
endif
GOFLAGS_RELEASE = -ldflags "$(LDFLAG_RELEASE)"
VERSION=$(shell ./build/bin/bitcoinpay-miner --version | grep ^bitcoinpay-miner | cut -d' ' -f3|cut -d'+' -f1)
GOBIN = ./build/bin
UNIX_EXECUTABLES := \
build/release/darwin/amd64/bin/$(EXECUTABLE) \
build/release/linux/amd64/bin/$(EXECUTABLE)
WIN_EXECUTABLES := \
build/release/windows/amd64/bin/$(EXECUTABLE).exe
EXECUTABLES=$(UNIX_EXECUTABLES) $(WIN_EXECUTABLES)
COMPRESSED_EXECUTABLES=$(UNIX_EXECUTABLES:%=%.tar.gz) $(WIN_EXECUTABLES:%.exe=%.zip)
RELEASE_TARGETS=$(EXECUTABLES) $(COMPRESSED_EXECUTABLES)
.PHONY: bitcoinpay-miner release
bitcoinpay-miner: miner-build
@echo "Done building."
@echo " $(shell $(GOBIN)/bitcoinpay-miner --version))"
@echo "Run \"$(GOBIN)/bitcoinpay-miner\" to launch."
miner-build:
@go build -o $(GOBIN)/bitcoinpay-miner -tags $(TAGS) $(GOFLAGS_DEV) "github.com/btceasypay/bitcoinpay-miner"
checkversion: miner-build
# @echo version $(VERSION)
all: bitcoinpay-miner
# amd64 release
build/release/%: OS=$(word 3,$(subst /, ,$(@)))
build/release/%: ARCH=$(word 4,$(subst /, ,$(@)))
build/release/%/$(EXECUTABLE):
@echo Build $(@)
go build $(GOFLAGS_RELEASE) -o $(@) -tags $(TAGS) "github.com/btceasypay/bitcoinpay-miner"
build/release/%/$(EXECUTABLE).exe:
@echo Build $(@)
go build $(GOFLAGS_RELEASE) -o $(@) -tags $(TAGS) "github.com/btceasypay/bitcoinpay-miner"
%.zip: %.exe
@echo zip $(EXECUTABLE)-$(VERSION)-$(OS)-$(ARCH)
@cp example.solo.conf solo.conf
@cp example.pool.conf pool.conf
@sh installLibrary.sh
@zip -j $(EXECUTABLE)-$(VERSION)-$(OS)-$(ARCH).zip "$<" libcudacuckoo.so libcuckoo.so cuckoo.dll cudacuckoo.dll libcuckoo.dylib mining.bat solo.conf pool.conf
%.tar.gz : %
@echo tar $(EXECUTABLE)-$(VERSION)-$(OS)-$(ARCH)
@tar -zcvf $(EXECUTABLE)-$(VERSION)-$(OS)-$(ARCH).tar.gz "$<"
release: clean checkversion
@echo "Build release version : $(VERSION)"
@$(MAKE) $(RELEASE_TARGETS)
@shasum -a 512 $(EXECUTABLES) > $(EXECUTABLE)-$(VERSION)_checksum.txt
@shasum -a 512 $(EXECUTABLE)-$(VERSION)-* >> $(EXECUTABLE)-$(VERSION)_checksum.txt
checksum: checkversion
@cat $(EXECUTABLE)-$(VERSION)_checksum.txt|shasum -c
clean:
@rm -f *.zip
@rm -f *.tar.gz
@rm -f ./build/bin/bitcoinpay-miner
@rm -rf ./build/release