go-paste/Makefile
2017-05-22 11:13:47 -06:00

44 lines
1.3 KiB
Makefile

ROUTE_ASSET=routes/bindata_assetfs.go
ROUTE_FILES=public/index.html public/app.js public/paste.sh public/style.css
SOURCE=./*.go routes/*.go
BINARY=paste
all: $(BINARY)
clean:
rm -f $(BINARY) $(ROUTE_ASSET) $(ROUTE_FILES)
fmt: $(SOURCE) $(SCHEMA_ASSET) $(ROUTE_ASSET)
find . -type f -name "*.go" -printf "%h\n"|sort -u|xargs go fmt
go tool vet -composites=false .
$(BINARY): $(SOURCE) $(ROUTE_ASSET)
go build
$(ROUTE_ASSET): $(ROUTE_FILES)
export PATH=$$GOPATH/bin:$$PATH; cd routes; go-bindata-assetfs -pkg routes -prefix ../ ../public/
public/index.html: assets/index.html assets/ui/*
cd assets; \
(sed '/INSERT_TEMPLATES/Q' index.html; \
for f in ui/*.html; \
do echo "<script id='$$f' type='text/ng-template'>"; \
html-minifier --minify-css --collapse-whitespace $$f; \
echo '</script>'; \
done; \
sed '1,/INSERT_TEMPLATES/d;/REMOVE_ASSET_START/,/REMOVE_ASSET_END/d' index.html) \
| html-minifier --minify-css --collapse-whitespace > ../public/index.html
public/app.js: assets/lib.js assets/app.js
cat assets/lib.js assets/app.js | uglifyjs > public/app.js
public/paste.sh: assets/paste.sh
cp assets/paste.sh public/paste.sh
public/style.css: assets/*.css
cleancss assets/*.css > public/style.css
deploy:
cd debian && make && make deploy
.PHONEY: clean deploy fmt