-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
68 lines (46 loc) · 956 Bytes
/
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
app_name = pritunl-http-api
define build-linux
@rm -f $(app_name)*
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo
endef
define build-mac
@rm -f $(app_name)*
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -a -installsuffix cgo
endef
define build-window
@rm -f $(app_name)*
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -a -installsuffix cgo
endef
define stop
@export pid=`ps -ef | grep $(app_name) | grep -v 'grep' | awk '{print $$2}'`; \
if [[ "$$pid" != "" ]] ;\
then \
echo "kill $$pid ..." ;\
kill $$pid && sleep 5 && kill -9 $$pid ;\
fi
endef
define start
@./$(app_name)
endef
define dev
@rm -f $(app_name)*
@go build
endef
stop:
$(call stop)
start:
$(call start)
restart:
$(call stop)
$(call start)
dev:
$(call stop)
$(call dev)
$(call start)
linux:
$(call build-linux)
mac:
$(call build-mac)
window:
$(call build-window)
.PHONY: stop start dev restart linux mac window