forked from schollz/find
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·57 lines (49 loc) · 1.89 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
SOURCEDIR=.
SOURCES := $(shell find $(SOURCEDIR) -name '*.go')
BINARY=findserver
VERSION=2.2
BUILD_TIME=`date +%FT%T%z`
BUILD=`git rev-parse HEAD`
LDFLAGS=-ldflags "-X main.VersionNum=${VERSION} -X main.Build=${BUILD} -X main.BuildTime=${BUILD_TIME}"
.DEFAULT_GOAL: $(BINARY)
$(BINARY): $(SOURCES)
go get -u -v github.com/boltdb/bolt
go get -u -v github.com/gin-gonic/contrib/sessions
go get -u -v github.com/gin-gonic/gin
go get -u -v github.com/stretchr/testify/assert
go get -u -v github.com/pquerna/ffjson/fflib/v1
go get -u -v github.com/schollz/org.eclipse.paho.mqtt.golang
go build ${LDFLAGS} -o ${BINARY} ${SOURCES}
.PHONY: install
install:
go install ${LDFLAGS} ./...
.PHONY: clean
clean:
if [ -f ${BINARY} ] ; then rm ${BINARY} ; fi
rm -rf builds
rm -rf find
rm -rf findserver*
.PHONY: binaries
binaries:
rm -rf builds
mkdir builds
# Build Windows
env GOOS=windows GOARCH=amd64 go build ${LDFLAGS} -o findserver.exe -v *.go
zip -r find_${VERSION}_windows_amd64.zip findserver.exe LICENSE ./templates/* ./data/.datagoeshere ./static/*
mv find_${VERSION}_windows_amd64.zip builds/
rm findserver.exe
# Build Linux
env GOOS=linux GOARCH=amd64 go build ${LDFLAGS} -o findserver -v *.go
zip -r find_${VERSION}_linux_amd64.zip findserver LICENSE ./templates/* ./data/.datagoeshere ./static/*
mv find_${VERSION}_linux_amd64.zip builds/
rm findserver
# Build OS X
env GOOS=darwin GOARCH=amd64 go build ${LDFLAGS} -o findserver -v *.go
zip -r find_${VERSION}_osx.zip findserver LICENSE ./templates/* ./data/.datagoeshere ./static/*
mv find_${VERSION}_osx.zip builds/
rm findserver
# Build Raspberry Pi / Chromebook
env GOOS=linux GOARCH=arm go build ${LDFLAGS} -o findserver -v *.go
zip -r find_${VERSION}_linux_arm.zip findserver LICENSE ./templates/* ./data/.datagoeshere ./static/*
mv find_${VERSION}_linux_arm.zip builds/
rm findserver