forked from nDenerserve/SmartPi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
111 lines (101 loc) · 2.59 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
BINARY_READOUT=smartpireadout
BINARY_SERVER=smartpiserver
BINARY_FTPUPLOAD=smartpiftpupload
#VERSION=0.3.7
VERSION := $(shell git describe --always --long --dirty)
BUILD_TIME := $(shell date -u '+%Y-%m-%d_%I:%M:%S%p')
BUILDPATH=$(CURDIR)
GO=$(shell which go)
GOBUILD=$(GO) build
GOINSTALL=$(GO) install
GOCLEAN=$(GO) clean
GOGET=$(GO) get
all: makedir get buildsmartpireadout buildsmartpiserver buildsmartpiftpupload
#all: makedir get buildsmartpireadout
makedir:
@echo "start building tree..."
@if [ ! -d $(BUILDPATH)/bin ] ; then mkdir -p $(BUILDPATH)/bin ; fi
@if [ ! -d $(BUILDPATH)/pkg ] ; then mkdir -p $(BUILDPATH)/pkg ; fi
get:
buildsmartpireadout:
@echo "start building smartpireadout..."
$(GOBUILD) -o bin/$(BINARY_READOUT) -ldflags="-X main.appVersion=${VERSION}_${BUILD_TIME}" src/readout/*.go
@echo "building smartpireadout done"
buildsmartpiserver:
@echo "start building smartpiserver..."
$(GOBUILD) -o bin/$(BINARY_SERVER) -ldflags="-X main.appVersion=${VERSION}_${BUILD_TIME}" src/main/server.go
@echo "building smartpiserver done"
buildsmartpiftpupload:
@echo "start building smartpiftpupload..."
$(GOBUILD) -o bin/$(BINARY_FTPUPLOAD) -ldflags="-X main.appVersion=${VERSION}_${BUILD_TIME}" src/main/ftpupload.go
@echo "building smartpiftpupload done"
install:
@echo install
# if [ `pidof smartpireadout` > "0" ]
# then killall smartpireadout
# fi
#
# if [ `pidof smartpiserver` > "0" ]
# then killall smartpiserver
# fi
#
# if [ `pidof smartpiftpupload` > "0" ]
# then killall smartpiftpupload
# fi
#
# if [ ! -d /var/tmp/smartpi ];
# then mkdir -p /var/tmp/smartpi
# fi
#
# cat /etc/fstab | grep smartpi | grep -v "#"
# if [ $? = 0 ];
# then
# :
# else
# echo "tmpfs /var/tmp/smartpi tmpfs nodev,nosuid,size=100M 0 0" >> /etc/fstab
# fi
#
#
# cat /etc/modules | grep i2c-bcm2708 | grep -v "#"
# if [ $? = 0 ];
# then
# :
# else
# echo "i2c-bcm2708" >> /etc/modules
# fi
#
# cat /etc/modules | grep i2c-dev | grep -v "#"
# if [ $? = 0 ];
# then
# :
# else
# echo "i2c-dev" >> /etc/modules
# fi
#
# cat /boot/config.txt | grep dtparam=i2c1=on | grep -v "#"
# if [ $? = 0 ];
# then
# :
# else
# echo "dtparam=i2c1=on" >> /boot/config.txt
# fi
#
# cat /boot/config.txt | grep dtparam=i2c_arm=on | grep -v "#"
# if [ $? = 0 ];
# then
# :
# else
# echo "dtparam=i2c_arm=on" >> /boot/config.txt
# fi
#
# if [ ! -d /var/smartpi/db ];
# then mkdir -p /var/smartpi/db
# fi
#
# if [ ! -d /var/smartpi/www ];
# then mkdir -p /var/smartpi/www
# fi
#
# cp $(BUILDPATH)/bin/* /usr/local/bin
# cp $(BUILDPATH)/config/smartpi.conf /etc/smartpi
# cp -r $(BUILDPATH)/public_html/* /var/smartpi/www