mirror of
https://github.com/schollz/cowyo.git
synced 2023-08-10 21:13:00 +03:00
Updated Makefile
Former-commit-id: 567e9474a209c2f18c45184a4b3ea27707b1f8da [formerly 2f0d76d8fcb47f48665a6d9e6dd3a7a62bdb8c3b] [formerly bc4797d56c793bb16baf2ab44dcf3f8d46b491e4 [formerly c10c7b16e2
]]
Former-commit-id: 9beec0c669e6fe5dad80e09d519ab076d3333202 [formerly 9f6e746719f5093312b7c33bae80d5476eabc82b]
Former-commit-id: b483ae83fd9623c758135d25f7c90eecdc88a6f4
This commit is contained in:
parent
9eb8d24c92
commit
14b820f0e4
73
Makefile
73
Makefile
@ -1,51 +1,46 @@
|
|||||||
ADDRESS = cowyo.com
|
SOURCEDIR=.
|
||||||
PORT = 8003
|
SOURCES := $(shell find $(SOURCEDIR) -name '*.go')
|
||||||
|
|
||||||
CUR_DIR = $(shell bash -c 'pwd')
|
BINARY=cowyo
|
||||||
USERCUR = $(shell bash -c 'whoami')
|
|
||||||
|
VERSION=1.1
|
||||||
make:
|
BUILD_TIME=`date +%FT%T%z`
|
||||||
go build
|
BUILD=`git rev-parse HEAD`
|
||||||
|
|
||||||
install:
|
LDFLAGS=-ldflags "-X main.VersionNum=${VERSION} -X main.Build=${BUILD} -X main.BuildTime=${BUILD_TIME}"
|
||||||
rm -rf jinstall
|
|
||||||
mkdir jinstall
|
.DEFAULT_GOAL: $(BINARY)
|
||||||
cp install/cowyo.nginx jinstall/cowyo.nginx
|
|
||||||
sed -i 's/PORT/$(PORT)/g' jinstall/cowyo.nginx
|
$(BINARY): $(SOURCES)
|
||||||
sed -i 's/ADDRESS/$(ADDRESS)/g' jinstall/cowyo.nginx
|
go get github.com/boltdb/bolt
|
||||||
sed -i 's^CUR_DIR^$(CUR_DIR)^g' jinstall/cowyo.nginx
|
go get github.com/gin-gonic/contrib/sessions
|
||||||
cp install/cowyo.init jinstall/cowyo.init
|
go get github.com/gin-gonic/gin
|
||||||
sed -i 's/EXT_ADDRESS/$(ADDRESS)/g' jinstall/cowyo.init
|
go get github.com/gorilla/websocket
|
||||||
sed -i 's^CUR_DIR^$(CUR_DIR)^g' jinstall/cowyo.init
|
go get github.com/microcosm-cc/bluemonday
|
||||||
sed -i 's^USERCUR^$(USERCUR)^g' jinstall/cowyo.init
|
go get github.com/russross/blackfriday
|
||||||
sed -i 's^PORT^$(PORT)^g' jinstall/cowyo.init
|
go get github.com/sergi/go-diff/diffmatchpatch
|
||||||
cp jinstall/cowyo.init /etc/init.d/cowyo.init
|
go build ${LDFLAGS} -o ${BINARY} ${SOURCES}
|
||||||
chmod +x /etc/init.d/cowyo.init
|
|
||||||
cp jinstall/cowyo.nginx /etc/nginx/sites-available/cowyo.nginx
|
.PHONY: clean
|
||||||
ln -fs /etc/nginx/sites-available/cowyo.nginx /etc/nginx/sites-enabled/cowyo.nginx
|
clean:
|
||||||
/etc/init.d/nginx reload
|
if [ -f ${BINARY} ] ; then rm ${BINARY} ; fi
|
||||||
/etc/init.d/nginx restart
|
rm -rf binaries
|
||||||
/etc/init.d/cowyo.init restart
|
|
||||||
rm -rf jinstall
|
.PHONY: binaries
|
||||||
|
binaries:
|
||||||
binaries:
|
|
||||||
rm -rf binaries
|
rm -rf binaries
|
||||||
rm -f cowyo
|
rm -f cowyo
|
||||||
mkdir binaries
|
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/*
|
zip -9 -r cowyo-linux-64bit.zip cowyo static/* templates/*
|
||||||
rm -f cowyo
|
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/*
|
zip -9 -r cowyo-windows-64bit.zip cowyo.exe static/* templates/*
|
||||||
rm -f cowyo.exe
|
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/*
|
zip -9 -r cowyo-raspberrypi.zip cowyo static/* templates/*
|
||||||
rm -f cowyo
|
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/*
|
zip -9 -r cowyo-macosx-64bit.zip cowyo static/* templates/*
|
||||||
rm -f cowyo
|
rm -f cowyo
|
||||||
mv *.zip binaries/
|
mv *.zip binaries/
|
||||||
|
|
||||||
|
|
||||||
.PHONY: install
|
|
||||||
.PHONY: binaries
|
|
||||||
|
1
main.go
1
main.go
@ -46,7 +46,6 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
VersionNum = "1.1"
|
|
||||||
// _, executableFile, _, _ := runtime.Caller(0) // get full path of this file
|
// _, executableFile, _, _ := runtime.Caller(0) // get full path of this file
|
||||||
cwd, _ := os.Getwd()
|
cwd, _ := os.Getwd()
|
||||||
databaseFile := path.Join(cwd, "data.db")
|
databaseFile := path.Join(cwd, "data.db")
|
||||||
|
Loading…
Reference in New Issue
Block a user