summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile43
1 files changed, 39 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index 96b3118..260873b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,4 @@
+MAKE="make"
INSTALL="install"
TAR="tar"
GREP="grep"
@@ -6,9 +7,11 @@ NPM="npm"
DESTDIR="./dist"
PKG_VERSION := $( $(GREP) -Po '(?<="version": ")[^"]*' )
TMPDIR := $(shell mktemp -d)
+# default modules
+MODULES="php"
-all: builddirs npm_dependencies swig htmlmin min-css min-js copy-img copy-php
-
+all: builddirs npm_dependencies swig htmlmin min-css min-js copy-img submodules
+
swig:
$(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
@@ -20,7 +23,13 @@ htmlmin:
$(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
+ mkdir -p $(DESTDIR)/ $(DESTDIR)/img
+ifneq (,$(findstring php,$(MODULES)))
+ mkdir -p $(DESTDIR)/classes $(DESTDIR)/includes
+endif
+ifneq (,$(findstring moe,$(MODULES)))
+ mkdir -p $(DESTDIR)/moe/{css,fonts,includes,js,login,panel/css/font,panel/css/images,register,templates}
+endif
min-css:
$(NODE) ./node_modules/.bin/cleancss --s0 ./static/css/pomf.css > $(CURDIR)/build/pomf.min.css
@@ -36,7 +45,18 @@ copy-img:
cp -vT ./static/img/favicon.ico $(CURDIR)/build/favicon.ico
copy-php:
+ifneq ($(wildcard $(CURDIR)/php/.),)
cp -rv ./php/* $(CURDIR)/build/
+else
+ $(error The php submodule was not found)
+endif
+
+copy-moe:
+ifneq ($(wildcard $(CURDIR)/moe/.),)
+ cp -rv $(CURDIR)/moe $(CURDIR)/build/moe
+else
+ $(error The moe submodule was not found)
+endif
install: installdirs
cp -rv $(CURDIR)/build/* $(DESTDIR)/
@@ -59,4 +79,19 @@ npm_dependencies:
$(NPM) install
builddirs:
- mkdir -p $(CURDIR)/build $(CURDIR)/build/img $(CURDIR)/build/classes $(CURDIR)/build/includes
+ mkdir -p $(CURDIR)/build $(CURDIR)/build/img
+ifneq (,$(findstring php,$(MODULES)))
+ mkdir -p $(CURDIR)/build/classes $(CURDIR)/build/includes
+endif
+ifneq (,$(findstring moe,$(MODULES)))
+ mkdir -p $(CURDIR)/build/moe/{css,fonts,includes,js,login,panel/css/font,panel/css/images,register,templates}
+endif
+
+submodules:
+ $(info The following modules will be enabled: $(MODULES))
+ifneq (,$(findstring php,$(MODULES)))
+ $(MAKE) copy-php
+endif
+ifneq (,$(findstring moe,$(MODULES)))
+ $(MAKE) copy-moe
+endif