go-paste/Makefile

47 lines
1.3 KiB
Makefile
Raw Normal View History

ROUTE_ASSET=routes/bindata_assetfs.go
ROUTE_FILES=public/index.html public/app.js public/paste.sh public/style.css
2018-02-15 09:11:52 -07:00
VENDOR_FILES=$(wildcard vendor/*)
SOURCE=./*.go routes/*.go
BINARY=paste
all: $(BINARY)
clean:
rm -f $(BINARY) $(ROUTE_ASSET) $(ROUTE_FILES)
2018-02-15 08:01:35 -07:00
run: $(BINARY)
./$(BINARY) -vv serve
2017-05-22 11:13:47 -06:00
2018-02-15 09:11:52 -07:00
$(BINARY): $(SOURCE) $(ROUTE_ASSET) $(VENDOR_FILES)
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) \
2017-10-13 16:41:48 -06:00
| 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
2017-10-13 16:41:48 -06:00
public/paste.sh: assets/paste.sh
cp assets/paste.sh public/paste.sh
2017-10-13 16:41:48 -06:00
public/style.css: assets/*.css
cleancss assets/*.css > public/style.css
2018-02-15 09:11:52 -07:00
deploy: $(SOURCE) $(ROUTE_ASSET)
cd debian && make && make deploy
2018-02-15 08:01:35 -07:00
.PHONEY: clean deploy run