-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
30 lines (23 loc) · 848 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
APP = gateway
USER = ubuntu
KEY = ../pub/ce_key
REMOTE = /home/ubuntu
release: linux64 vars
ssh -i $(KEY) $(HOST) "rm -f $(REMOTE)/$(APP)"
scp -i $(KEY) $(APP) $(HOST):$(REMOTE)
# Redirect stdout and stderr so it doesn't hang
# https://stackoverflow.com/a/29172
ssh -i $(KEY) $(HOST) "nohup ./$(APP) > st.out 2> st.err < /dev/null &"
vars:
$(eval PUBLIC_DNS = $(shell terraform output public_dns))
$(eval HOST = $(USER)@$(PUBLIC_DNS))
linux64:
env GOOS=linux GOARCH=amd64 go build -o $(APP) -i ../.
build:
env GOOS=linux GOARCH=amd64 go build -o bin/$(APP)-linux -i .
env GOOS=darwin GOARCH=amd64 go build -o bin/$(APP)-darwin -i .
env GOOS=windows GOARCH=amd64 go build -o bin/gateway.exe -i .
deploy:
env GOOS=linux GOARCH=arm GOARM=5 go build -o bin/gateway-arm -i .; scp bin/gateway-arm pi@192.168.10.12:~/
clean:
rm $(APP)