summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorileyd <akpu1@inventati.org>2016-06-28 23:10:10 +0200
committerGitHub <noreply@github.com>2016-06-28 23:10:10 +0200
commit88cfdb49b4f0a293f792ef35406abdafb084fdcb (patch)
tree99c0be4c95eb0b977fe2004188e2a34958201ed6 /Makefile
parente01670d1bb7204051e076069f50fd68d55e8c92c (diff)
parent186b9bf0aed3638845544c1dad9f54297cc23413 (diff)
Merge pull request #2 from pomf/master
e;
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile75
1 files changed, 53 insertions, 22 deletions
diff --git a/Makefile b/Makefile
index 2addcd5..96b3118 100644
--- a/Makefile
+++ b/Makefile
@@ -1,31 +1,62 @@
-all: mkdirs swig htmlmin min-css min-js copy
+INSTALL="install"
+TAR="tar"
+GREP="grep"
+NODE="node"
+NPM="npm"
+DESTDIR="./dist"
+PKG_VERSION := $( $(GREP) -Po '(?<="version": ")[^"]*' )
+TMPDIR := $(shell mktemp -d)
+
+all: builddirs npm_dependencies swig htmlmin min-css min-js copy-img copy-php
swig:
- @node node_modules/swig/bin/swig.js render -j dist.json templates/faq.swig > dist/faq.html
- @node node_modules/swig/bin/swig.js render -j dist.json templates/index.swig > dist/index.html
- @node node_modules/swig/bin/swig.js render -j dist.json templates/tools.swig > dist/tools.html
+ $(NODE) node_modules/swig/bin/swig.js render -j dist.json templates/faq.swig > $(CURDIR)/build/faq.html
+ $(NODE) node_modules/swig/bin/swig.js render -j dist.json templates/index.swig > $(CURDIR)/build/index.html
+ $(NODE) node_modules/swig/bin/swig.js render -j dist.json templates/tools.swig > $(CURDIR)/build/tools.html
htmlmin:
- @node node_modules/htmlmin/bin/htmlmin dist/index.html -o dist/index.html
- @node node_modules/htmlmin/bin/htmlmin dist/faq.html -o dist/faq.html
- @node node_modules/htmlmin/bin/htmlmin dist/tools.html -o dist/tools.html
-
-
-mkdirs:
- @mkdir -p ./dist/img
+ $(NODE) node_modules/htmlmin/bin/htmlmin $(CURDIR)/build/index.html -o $(CURDIR)/build/index.html
+ $(NODE) node_modules/htmlmin/bin/htmlmin $(CURDIR)/build/faq.html -o $(CURDIR)/build/faq.html
+ $(NODE) node_modules/htmlmin/bin/htmlmin $(CURDIR)/build/tools.html -o $(CURDIR)/build/tools.html
+installdirs:
+ mkdir -p $(DESTDIR)/ $(DESTDIR)/img $(DESTDIR)/classes $(DESTDIR)/includes
+
min-css:
- @node ./node_modules/.bin/cleancss --s0 ./static/css/pomf.css > ./dist/pomf.min.css
+ $(NODE) ./node_modules/.bin/cleancss --s0 ./static/css/pomf.css > $(CURDIR)/build/pomf.min.css
min-js:
- @echo "// @source https://github.com/pomf/pomf/tree/master/static/js" >> ./dist/pomf.min.js
- @echo "// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat" >> ./dist/pomf.min.js
- @node ./node_modules/.bin/uglifyjs --screw-ie8 ./static/js/app.js >> ./dist/pomf.min.js
- @echo "// @license-end" >> ./dist/pomf.min.js
-
-copy:
- @cp -r ./php/* ./dist/
- @cp ./static/img/*.png ./dist/img
- @cp ./static/img/favicon.ico ./dist/favicon.ico
-
+ echo "// @source https://github.com/pomf/pomf/tree/master/static/js" > $(CURDIR)/build/pomf.min.js
+ echo "// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat" >> $(CURDIR)/build/pomf.min.js
+ $(NODE) ./node_modules/.bin/uglifyjs --screw-ie8 ./static/js/app.js >> $(CURDIR)/build/pomf.min.js
+ echo "// @license-end" >> $(CURDIR)/build/pomf.min.js
+
+copy-img:
+ cp -v ./static/img/*.png $(CURDIR)/build/img/
+ cp -vT ./static/img/favicon.ico $(CURDIR)/build/favicon.ico
+
+copy-php:
+ cp -rv ./php/* $(CURDIR)/build/
+
+install: installdirs
+ cp -rv $(CURDIR)/build/* $(DESTDIR)/
+
+dist:
+ DESTDIR=$(TMPDIR)/pomf-$(PKGVERSION)
+ export DESTDIR
+ install
+ $(TAR) cJf pomf-$(PKG_VERSION).tar.xz $(DESTDIR)
+ rm -rf $(TMPDIR)
+
+clean:
+ rm -rvf $(CURDIR)/node_modules
+ rm -rvf $(CURDIR)/build
+
+uninstall:
+ rm -rvf $(DESTDIR)/
+
+npm_dependencies:
+ $(NPM) install
+builddirs:
+ mkdir -p $(CURDIR)/build $(CURDIR)/build/img $(CURDIR)/build/classes $(CURDIR)/build/includes