57 lines
1.7 KiB
Makefile
57 lines
1.7 KiB
Makefile
# Makefile for nmdc-webfrontend
|
|
|
|
BINNAME=nmdc-webfrontend
|
|
|
|
VERSION=1.2.3
|
|
|
|
GOFLAGS=-a \
|
|
-ldflags "-s -w -X main.VERSION=$(BINNAME)/$(VERSION)" \
|
|
-gcflags "-trimpath ${GOPATH}" \
|
|
-asmflags "-trimpath ${GOPATH}"
|
|
|
|
SOURCES=client/ Gopkg.lock Gopkg.toml Makefile Config.go main.go nmdc-webfrontend.conf.SAMPLE
|
|
|
|
.PHONY: all deps clean clean-deps
|
|
|
|
all: $(BINNAME)-$(VERSION)-win32.7z $(BINNAME)-$(VERSION)-linux64.tar.xz $(BINNAME)-$(VERSION)-src.tar.xz
|
|
|
|
deps:
|
|
npm i
|
|
go get -u github.com/jteeuwen/go-bindata/...
|
|
go get -u github.com/golang/dep/cmd/dep
|
|
dep ensure
|
|
|
|
clean:
|
|
rm -f ./$(BINNAME)
|
|
rm -f ./$(BINNAME).exe
|
|
rm -fr ./clientpack
|
|
rm -f ./bindata.go
|
|
|
|
clean-deps:
|
|
rm -fr ./vendor
|
|
rm -fr ./node_modules
|
|
|
|
bindata.go: client client/*
|
|
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
|
|
html-minifier --collapse-whitespace -o clientpack/index.min.htm clientpack/index.htm
|
|
mv clientpack/index.min.htm clientpack/index.htm
|
|
go-bindata -nomemcopy -nometadata -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 --owner=0 --group=0
|
|
|
|
$(BINNAME)-$(VERSION)-src.tar.xz: $(SOURCES)
|
|
XZ_OPT='-9' tar caf "$(BINNAME)-$(VERSION)-src.tar.xz" $(SOURCES) --owner=0 --group=0
|