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-11-11 22:09:52 +00:00
|
|
|
.PHONY: all dist deps clean clean-deps
|
2017-10-27 11:06:45 +00:00
|
|
|
|
2017-11-11 22:09:52 +00:00
|
|
|
all: $(BINNAME) $(BINNAME).exe
|
|
|
|
|
|
|
|
dist: $(BINNAME)-$(VERSION)-win32.7z $(BINNAME)-$(VERSION)-linux64.tar.xz $(BINNAME)-$(VERSION)-src.zip
|
2017-10-27 11:06:45 +00:00
|
|
|
|
|
|
|
deps:
|
2017-11-10 09:53:14 +00:00
|
|
|
npm i
|
2017-10-27 11:06:45 +00:00
|
|
|
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
|
2017-11-11 21:39:05 +00:00
|
|
|
$(GOPATH)/bin/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
|
2017-11-11 21:35:46 +00:00
|
|
|
|
|
|
|
clean-deps:
|
|
|
|
rm -fr ./vendor
|
|
|
|
rm -fr ./node_modules
|
2017-10-27 11:06:45 +00:00
|
|
|
|
|
|
|
bindata.go: client client/*
|
2017-11-11 21:38:47 +00:00
|
|
|
mkdir -p clientpack
|
|
|
|
cp client/favicon.ico client/apple-touch-icon.png clientpack/
|
2017-11-10 07:45:31 +00:00
|
|
|
npm run webpack
|
|
|
|
cat client/index.htm \
|
|
|
|
| sed -e '/bundle.js/{i <script>' -e 'r clientpack/bundle.min.js' -e 'a </script>' -e 'd}' \
|
|
|
|
> 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
|
2017-11-11 21:38:35 +00:00
|
|
|
rm clientpack/bundle.min.js
|
2017-11-11 21:39:05 +00:00
|
|
|
$(GOPATH)/bin/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
|
2017-10-28 01:15:23 +00:00
|
|
|
XZ_OPT='-9' tar caf "$(BINNAME)-$(VERSION)-linux64.tar.xz" $(BINNAME) nmdc-webfrontend.conf.SAMPLE --owner=0 --group=0
|
2017-10-27 11:06:45 +00:00
|
|
|
|
2017-11-11 21:36:42 +00:00
|
|
|
$(BINNAME)-$(VERSION)-src.zip:
|
|
|
|
hg archive "$(BINNAME)-$(VERSION)-src.zip" || git archive -o "$(BINNAME)-$(VERSION)-src.zip" HEAD
|