2017-10-27 11:06:45 +00:00
|
|
|
# Makefile for nmdc-webfrontend
|
|
|
|
|
|
|
|
BINNAME=nmdc-webfrontend
|
|
|
|
|
2017-10-28 00:32:29 +00:00
|
|
|
VERSION=1.2.3
|
2017-10-27 11:06:45 +00:00
|
|
|
|
|
|
|
GOFLAGS=-a \
|
|
|
|
-ldflags "-s -w -X main.VERSION=$(BINNAME)/$(VERSION)" \
|
|
|
|
-gcflags "-trimpath ${GOPATH}" \
|
|
|
|
-asmflags "-trimpath ${GOPATH}"
|
|
|
|
|
2017-10-27 23:48:55 +00:00
|
|
|
SOURCES=client/ Gopkg.lock Gopkg.toml Makefile Config.go main.go nmdc-webfrontend.conf.SAMPLE
|
2017-10-27 11:06:45 +00:00
|
|
|
|
|
|
|
.PHONY: all deps clean
|
|
|
|
|
|
|
|
all: $(BINNAME)-$(VERSION)-win32.7z $(BINNAME)-$(VERSION)-linux64.tar.xz $(BINNAME)-$(VERSION)-src.tar.xz
|
|
|
|
|
|
|
|
deps:
|
|
|
|
npm install -g less uglify-js less-plugin-clean-css html-minifier
|
|
|
|
go get -u github.com/jteeuwen/go-bindata/...
|
2017-10-27 23:48:55 +00:00
|
|
|
go get -u github.com/golang/dep/cmd/dep
|
|
|
|
dep ensure
|
2017-10-27 11:06:45 +00:00
|
|
|
|
|
|
|
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
|
2017-10-27 22:40:09 +00:00
|
|
|
( echo ';(function() {' ; cat clientpack/dcwebui.js ; echo '})();' ) | uglifyjs -o clientpack/dcwebui.min.js -c -m --ie8
|
2017-10-27 11:21:20 +00:00
|
|
|
lessc --clean-css clientpack/dcwebui.css clientpack/dcwebui.min.css
|
2017-10-27 22:32:51 +00:00
|
|
|
cat clientpack/index.htm \
|
2017-10-27 22:51:23 +00:00
|
|
|
| sed -e '/dcwebui.css/{i <style>' -e 'r clientpack/dcwebui.min.css' -e 'a </style>' -e 'd}' \
|
|
|
|
| sed -e '/dcwebui.js/{i <script>' -e 'r clientpack/dcwebui.min.js' -e 'a </script>' -e 'd}' \
|
|
|
|
| sed -e '/socket.io-1.7.2.js/{i <script>' -e 'r clientpack/socket.io-1.7.2.js' -e 'a </script>' -e 'd}' \
|
2017-10-27 22:32:51 +00:00
|
|
|
> clientpack/index.packed.htm
|
|
|
|
mv clientpack/index.packed.htm clientpack/index.htm
|
2017-10-27 11:21:20 +00:00
|
|
|
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-28 00:27:07 +00:00
|
|
|
go-bindata -nomemcopy -nometadata -prefix clientpack clientpack
|
2017-10-27 11:06:45 +00:00
|
|
|
|
|
|
|
$(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
|