mirror of
https://github.com/schollz/cowyo.git
synced 2023-08-10 21:13:00 +03:00
Updated Makefile
This commit is contained in:
parent
0d2252223d
commit
c10c7b16e2
63
Makefile
63
Makefile
@ -1,51 +1,46 @@
|
||||
ADDRESS = cowyo.com
|
||||
PORT = 8003
|
||||
SOURCEDIR=.
|
||||
SOURCES := $(shell find $(SOURCEDIR) -name '*.go')
|
||||
|
||||
CUR_DIR = $(shell bash -c 'pwd')
|
||||
USERCUR = $(shell bash -c 'whoami')
|
||||
BINARY=cowyo
|
||||
|
||||
make:
|
||||
go build
|
||||
VERSION=1.1
|
||||
BUILD_TIME=`date +%FT%T%z`
|
||||
BUILD=`git rev-parse HEAD`
|
||||
|
||||
install:
|
||||
rm -rf jinstall
|
||||
mkdir jinstall
|
||||
cp install/cowyo.nginx jinstall/cowyo.nginx
|
||||
sed -i 's/PORT/$(PORT)/g' jinstall/cowyo.nginx
|
||||
sed -i 's/ADDRESS/$(ADDRESS)/g' jinstall/cowyo.nginx
|
||||
sed -i 's^CUR_DIR^$(CUR_DIR)^g' jinstall/cowyo.nginx
|
||||
cp install/cowyo.init jinstall/cowyo.init
|
||||
sed -i 's/EXT_ADDRESS/$(ADDRESS)/g' jinstall/cowyo.init
|
||||
sed -i 's^CUR_DIR^$(CUR_DIR)^g' jinstall/cowyo.init
|
||||
sed -i 's^USERCUR^$(USERCUR)^g' jinstall/cowyo.init
|
||||
sed -i 's^PORT^$(PORT)^g' jinstall/cowyo.init
|
||||
cp jinstall/cowyo.init /etc/init.d/cowyo.init
|
||||
chmod +x /etc/init.d/cowyo.init
|
||||
cp jinstall/cowyo.nginx /etc/nginx/sites-available/cowyo.nginx
|
||||
ln -fs /etc/nginx/sites-available/cowyo.nginx /etc/nginx/sites-enabled/cowyo.nginx
|
||||
/etc/init.d/nginx reload
|
||||
/etc/init.d/nginx restart
|
||||
/etc/init.d/cowyo.init restart
|
||||
rm -rf jinstall
|
||||
LDFLAGS=-ldflags "-X main.VersionNum=${VERSION} -X main.Build=${BUILD} -X main.BuildTime=${BUILD_TIME}"
|
||||
|
||||
.DEFAULT_GOAL: $(BINARY)
|
||||
|
||||
$(BINARY): $(SOURCES)
|
||||
go get github.com/boltdb/bolt
|
||||
go get github.com/gin-gonic/contrib/sessions
|
||||
go get github.com/gin-gonic/gin
|
||||
go get github.com/gorilla/websocket
|
||||
go get github.com/microcosm-cc/bluemonday
|
||||
go get github.com/russross/blackfriday
|
||||
go get github.com/sergi/go-diff/diffmatchpatch
|
||||
go build ${LDFLAGS} -o ${BINARY} ${SOURCES}
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
if [ -f ${BINARY} ] ; then rm ${BINARY} ; fi
|
||||
rm -rf binaries
|
||||
|
||||
.PHONY: binaries
|
||||
binaries:
|
||||
rm -rf binaries
|
||||
rm -f cowyo
|
||||
mkdir binaries
|
||||
env GOOS=linux GOARCH=amd64 go build -o cowyo -v *.go
|
||||
env GOOS=linux GOARCH=amd64 go build ${LDFLAGS} -o ${BINARY} ${SOURCES}
|
||||
zip -9 -r cowyo-linux-64bit.zip cowyo static/* templates/*
|
||||
rm -f cowyo
|
||||
env GOOS=windows GOARCH=amd64 go build -o cowyo.exe -v *.go
|
||||
env GOOS=windows GOARCH=amd64 go build ${LDFLAGS} -o ${BINARY} ${SOURCES}
|
||||
zip -9 -r cowyo-windows-64bit.zip cowyo.exe static/* templates/*
|
||||
rm -f cowyo.exe
|
||||
env GOOS=linux GOARCH=arm go build -o cowyo -v *.go
|
||||
env GOOS=linux GOARCH=arm go build ${LDFLAGS} -o ${BINARY} ${SOURCES}
|
||||
zip -9 -r cowyo-raspberrypi.zip cowyo static/* templates/*
|
||||
rm -f cowyo
|
||||
env GOOS=darwin GOARCH=amd64 go build -o cowyo -v *.go
|
||||
env GOOS=darwin GOARCH=amd64 go build ${LDFLAGS} -o ${BINARY} ${SOURCES}
|
||||
zip -9 -r cowyo-macosx-64bit.zip cowyo static/* templates/*
|
||||
rm -f cowyo
|
||||
mv *.zip binaries/
|
||||
|
||||
|
||||
.PHONY: install
|
||||
.PHONY: binaries
|
||||
|
Loading…
Reference in New Issue
Block a user