forked from vitelabs/go-vite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
76 lines (58 loc) · 3.12 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
.PHONY: all clean
.PHONY: gvite_linux gvite-linux-amd64 gvite-darwin-amd64
.PHONY: gvite-darwin gvite-darwin-amd64
.PHONY: gvite-windows gvite-windows-amd64
.PHONY: gitversion
GO ?= latest
MAINDIR = gvite
SERVERMAIN = $(shell pwd)/cmd/$(MAINDIR)/main.go
BUILDDIR = $(shell pwd)/build
GOBIN = $(BUILDDIR)/cmd/$(MAINDIR)
VITE_VERSION = $(shell cat buildversion)
gitversion:
@echo "package govite" > $(shell pwd)/buildversion.go
@echo "const VITE_VERSION = \""$(shell git rev-parse HEAD)"\"" >> $(shell pwd)/buildversion.go
@echo "const VITE_BUILD_VERSION = \""$(VITE_VERSION)"\"" >> $(shell pwd)/buildversion.go
gvite:
@echo "package govite" > $(shell pwd)/buildversion.go
@echo "const VITE_VERSION = \""$(shell git rev-parse HEAD)"\"" >> $(shell pwd)/buildversion.go
@echo "const VITE_BUILD_VERSION = \""$(VITE_VERSION)"\"" >> $(shell pwd)/buildversion.go
go build -i -o $(GOBIN)/gvite $(SERVERMAIN)
@echo "Build server done."
@echo "Run \"$(GOBIN)/gvite\" to start gvite."
all: gvite-windows gvite-darwin gvite-linux
clean:
rm -r $(BUILDDIR)/
gvite-linux: gvite-linux-amd64
@echo "Linux cross compilation done:"
gvite-linux-amd64:
@echo "version package version is "$(VITE_VERSION)"."
@echo "package govite" > $(shell pwd)/buildversion.go
@echo "const VITE_VERSION = \""$(shell git rev-parse HEAD)"\"" >> $(shell pwd)/buildversion.go
@echo "const VITE_BUILD_VERSION = \""$(VITE_VERSION)"\"" >> $(shell pwd)/buildversion.go
env GOOS=linux GOARCH=amd64 go build -i -o $(GOBIN)/gvite-$(VITE_VERSION)-linux/gvite $(SERVERMAIN)
@cp $(shell pwd)/node_config.json $(GOBIN)/gvite-$(VITE_VERSION)-linux/node_config.json
@cp $(shell pwd)/bootstraplinux $(GOBIN)/gvite-$(VITE_VERSION)-linux/bootstrap
@echo "Build server done."
@ls -ld $(GOBIN)/gvite-$(VITE_VERSION)-linux/gvite
gvite-darwin:
@echo "version package version is "$(VITE_VERSION)"."
@echo "package govite" > $(shell pwd)/buildversion.go
@echo "const VITE_VERSION = \""$(shell git rev-parse HEAD)"\"" >> $(shell pwd)/buildversion.go
@echo "const VITE_BUILD_VERSION = \""$(VITE_VERSION)"\"" >> $(shell pwd)/buildversion.go
env GOOS=darwin GOARCH=amd64 go build -i -o $(GOBIN)/gvite-$(VITE_VERSION)-darwin/gvite $(SERVERMAIN)
@cp $(shell pwd)/node_config.json $(GOBIN)/gvite-$(VITE_VERSION)-darwin/node_config.json
@cp $(shell pwd)/bootstrap $(GOBIN)/gvite-$(VITE_VERSION)-darwin/bootstrap
@echo "Build server done."
@ls -ld $(GOBIN)/gvite-$(VITE_VERSION)-darwin/gvite
gvite-windows: gvite-windows-amd64
@echo "Windows cross compilation done:"
@ls -ld $(GOBIN)/gvite-$(VITE_VERSION)-windows/gvite-windows-*
gvite-windows-amd64:
@echo "package govite" > $(shell pwd)/buildversion.go
@echo "const VITE_VERSION = \""$(shell git rev-parse HEAD)"\"" >> $(shell pwd)/buildversion.go
@echo "const VITE_BUILD_VERSION = \""$(VITE_VERSION)"\"" >> $(shell pwd)/buildversion.go
env GOOS=windows GOARCH=amd64 go build -i -o $(GOBIN)/gvite-$(VITE_VERSION)-windows/gvite-windows-amd64.exe $(SERVERMAIN)
@cp $(shell pwd)/node_config.json $(GOBIN)/gvite-$(VITE_VERSION)-windows/node_config.json
@echo "Build server done."ls
@ls -ld $(GOBIN)/gvite-$(VITE_VERSION)-windows/gvite-windows-amd64.exe