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