2017-10-27 11:06:45 +00:00
|
|
|
# Makefile for nmdc-webfrontend
|
|
|
|
|
|
|
|
BINNAME=nmdc-webfrontend
|
|
|
|
|
|
|
|
VERSION=1.2.2
|
|
|
|
|
|
|
|
GOFLAGS=-a \
|
|
|
|
-ldflags "-s -w -X main.VERSION=$(BINNAME)/$(VERSION)" \
|
|
|
|
-gcflags "-trimpath ${GOPATH}" \
|
|
|
|
-asmflags "-trimpath ${GOPATH}"
|
|
|
|
|
|
|
|
SOURCES=client/ clientpack.php Config.go main.go nmdc-webfrontend.conf.SAMPLE
|
|
|
|
|
|
|
|
.PHONY: all deps clean
|
|
|
|
|
|
|
|
all: $(BINNAME)-$(VERSION)-win32.7z $(BINNAME)-$(VERSION)-linux64.tar.xz $(BINNAME)-$(VERSION)-src.tar.xz
|
|
|
|
#./build.sh -v ${VERSION}
|
|
|
|
|
|
|
|
deps:
|
|
|
|
apt install php-cli p7zip
|
|
|
|
npm install -g less uglify-js less-plugin-clean-css html-minifier
|
|
|
|
go get github.com/googollee/go-socket.io
|
|
|
|
go get code.ivysaur.me/libnmdc
|
|
|
|
go get -u github.com/jteeuwen/go-bindata/...
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f ./$(BINNAME)
|
|
|
|
rm -f ./$(BINNAME).exe
|
|
|
|
rm -fr ./clientpack
|
|
|
|
rm -f ./bindata.go
|
|
|
|
|
|
|
|
bindata.go: client client/*
|
|
|
|
rm -fr ./clientpack
|
2017-10-27 11:21:20 +00:00
|
|
|
cp -r ./client ./clientpack
|
|
|
|
sed -i -re 's~//IIFEMODE:~~g' clientpack/dcwebui.js
|
|
|
|
uglifyjs clientpack/dcwebui.js -o clientpack/dcwebui.min.js -c -m
|
|
|
|
lessc --clean-css clientpack/dcwebui.css clientpack/dcwebui.min.css
|
|
|
|
#php ./clientpack.php
|
|
|
|
./minipack clientpack/index.htm css dcwebui.css clientpack/dcwebui.min.css
|
|
|
|
./minipack clientpack/index.htm js dcwebui.js clientpack/dcwebui.min.js
|
|
|
|
./minipack clientpack/index.htm js socket.io-1.7.2.js clientpack/socket.io-1.7.2.js
|
|
|
|
html-minifier --collapse-whitespace -o clientpack/index.min.htm clientpack/index.htm
|
|
|
|
mv clientpack/index.min.htm clientpack/index.htm
|
|
|
|
rm ./clientpack/*.js
|
|
|
|
rm ./clientpack/*.css
|
2017-10-27 11:06:45 +00:00
|
|
|
go-bindata -nomemcopy -prefix clientpack clientpack
|
|
|
|
|
|
|
|
$(BINNAME).exe: bindata.go *.go
|
|
|
|
GOARCH=386 GOOS=windows go build $(GOFLAGS) -o $(BINNAME).exe
|
|
|
|
|
|
|
|
$(BINNAME): bindata.go *.go
|
|
|
|
GOARCH=amd64 GOOS=linux go build $(GOFLAGS) -o $(BINNAME)
|
|
|
|
|
|
|
|
$(BINNAME)-$(VERSION)-win32.7z: $(BINNAME).exe nmdc-webfrontend.conf.SAMPLE
|
|
|
|
7z a -mx9 "$(BINNAME)-$(VERSION)-win32.7z" $(BINNAME).exe nmdc-webfrontend.conf.SAMPLE
|
|
|
|
|
|
|
|
$(BINNAME)-$(VERSION)-linux64.tar.xz: $(BINNAME) nmdc-webfrontend.conf.SAMPLE
|
|
|
|
XZ_OPT='-9' tar caf "$(BINNAME)-$(VERSION)-linux64.tar.xz" $(BINNAME) nmdc-webfrontend.conf.SAMPLE
|
|
|
|
|
|
|
|
$(BINNAME)-$(VERSION)-src.tar.xz: $(SOURCES)
|
|
|
|
XZ_OPT='-9' tar caf "$(BINNAME)-$(VERSION)-src.tar.xz" $(SOURCES) --owner=0 --group=0
|