diff options
| author | Austin <austi_gillm935@ahapps.anoka.k12.mn.us> | 2016-06-29 03:53:42 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-06-29 03:53:42 +0200 |
| commit | 54c0ea7c9cc26f42196f50fd9f5ce2027840fae0 (patch) | |
| tree | feecf53ee3b85d7791d10b127bdce397d6e0c690 | |
| parent | 45b5dcc6f46c184863548a103e3a1d19de68b927 (diff) | |
| parent | 4e16303887a65cf010983afa784036549362d254 (diff) | |
Merge pull request #42 from ileyd/patch-6, Closes #39
Added submodule support to Makefile
| -rw-r--r-- | Makefile | 53 | ||||
| -rw-r--r-- | README.md | 19 |
2 files changed, 61 insertions, 11 deletions
@@ -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,23 +23,40 @@ 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 + $(NODE) $(CURDIR)/node_modules/.bin/cleancss --s0 $(CURDIR)/static/css/pomf.css > $(CURDIR)/build/pomf.min.css min-js: 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 + $(NODE) $(CURDIR)/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 + cp -v $(CURDIR)/static/img/*.png $(CURDIR)/build/img/ + cp -vT $(CURDIR)/static/img/favicon.ico $(CURDIR)/build/favicon.ico copy-php: - cp -rv ./php/* $(CURDIR)/build/ +ifneq ($(wildcard $(CURDIR)/php/.),) + cp -rv $(CURDIR)/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 @@ -39,12 +39,27 @@ Node, or NPM. So we'll just assume you already have them all running well. ### Compiling -Assuming you already have Node and NPM working, compilation is easy. Use the -following shell code: +First you must get a copy of the pomf code. To do so, clone this git repo. +If you have no desire for any submodules, which includes the PHP backend, simply run +```bash +git clone https://github.com/pomf/pomf +``` +else, run ```bash git clone --recursive https://github.com/pomf/pomf +``` +to automatically fetch all of the submodules as well + +Assuming you already have Node and NPM working, compilation is easy. If you would like any additional submodules, or to exclude the default PHP submodule, use the `MODULES="..."` variable. + +Run the following commands to do so. +```bash cd pomf/ make +# alternatively +make MODULES="" # compile no submodules; exclude the default php backend module +make MODULES="php moe" # compile the php and moe submodules +# make install ``` OR |
