-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
71 lines (51 loc) · 2.02 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
version="0.0.1"
version_file=VERSION
working_dir=$(shell pwd)
arch="armhf"
remote_host = "[email protected]"
clean:
-rm lora-ttn
build-go:
cd ./src;go build -o lora-ttn service.go;cd ../
build-go-arm:
cd ./src;GOOS=linux GOARCH=arm GOARM=6 go build -ldflags="-s -w" -o lora-ttn service.go;cd ../
build-go-amd:
cd ./src;GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o lora-ttn service.go;cd ../
configure-arm:
python ./scripts/config_env.py prod $(version) armhf
configure-amd64:
python ./scripts/config_env.py prod $(version) amd64
package-tar:
tar cvzf lora-ttn_$(version).tar.gz lora-ttn VERSION
clean-deb:
find package/debian -name ".DS_Store" -delete
find package/debian -name "delete_me" -delete
find package/debian -name ".DS_Store" -delete
find package/debian -name "delete_me" -delete
package-deb-doc:clean-deb
@echo "Packaging application using Thingsplex debian package layout"
chmod a+x package/debian/DEBIAN/*
cp ./src/lora-ttn package/debian/opt/thingsplex/lora-ttn
cp VERSION package/debian/opt/thingsplex/lora-ttn
docker run --rm -v ${working_dir}:/build -w /build --name debuild debian dpkg-deb --build package/debian
@echo "Done"
package-docker-amd:build-go-amd
cp ./src/lora-ttn package/docker/service
cd ./package/docker;docker build -t lora-ttn .
deb-arm : clean configure-arm build-go-arm package-deb-doc
@echo "Building Thingsplex ARM package"
mv package/debian.deb package/build/lora-ttn_$(version)_armhf.deb
deb-amd : configure-amd64 build-go-amd package-deb-doc
@echo "Building Thingsplex AMD package"
mv package/debian.deb lora-ttn_$(version)_amd64.deb
upload :
@echo "Uploading the package to remote host"
scp package/build/lora-ttn_$(version)_armhf.deb $(remote_host):~/
remote-install : upload
@echo "Uploading and installing the package on remote host"
ssh -t $(remote_host) "sudo dpkg -i lora-ttn_$(version)_armhf.deb"
deb-remote-install : deb-arm remote-install
@echo "Package was built and installed on remote host"
run :
cd ./src; go run service.go -c ../testdata;cd ../
.phony : clean