2013-04-26 21:01:39 +02:00
# You can set these variables from the command line.
2014-12-13 00:14:11 +01:00
BOWER ?= node_modules/.bin/bower
2015-02-05 15:57:39 +01:00
BUILDDIR = ./docs
2015-10-25 18:49:35 +01:00
BUNDLE ?= ./.bundle/bin/bundle
GRUNT ?= ./node_modules/.bin/grunt
HTTPSERVE ?= ./node_modules/.bin/http-server
JSHINT ?= ./node_modules/.bin/jshint
2015-02-05 15:57:39 +01:00
PAPER =
2015-01-18 19:10:22 +01:00
PHANTOMJS ?= ./node_modules/.bin/phantomjs
2016-02-26 18:28:18 +01:00
RJS ?= ./node_modules/.bin/r.js
2015-02-05 15:57:39 +01:00
PO2JSON ?= ./node_modules/.bin/po2json
2015-04-26 09:38:23 +02:00
SASS ?= ./.bundle/bin/sass
2015-10-25 18:49:35 +01:00
SPHINXBUILD ?= ./bin/sphinx-build
SPHINXOPTS =
2014-03-17 21:37:40 +01:00
2013-04-26 21:01:39 +02:00
# Internal variables.
ALLSPHINXOPTS = -d $( BUILDDIR) /doctrees $( PAPEROPT_$( PAPER) ) $( SPHINXOPTS) ./docs/source
2015-10-25 18:49:35 +01:00
SOURCES = $( wildcard *.js) $( wildcard spec/*.js) $( wildcard src/*.js)
JSHINTEXCEPTIONS = $( GENERATED) \
src/otr.js \
src/crypto.js \
src/build-no-jquery.js \
2016-02-26 19:23:23 +01:00
src/build-no-dependencies.js \
2015-10-25 18:49:35 +01:00
src/build.js \
src/bigint.js
CHECKSOURCES = $( filter-out $( JSHINTEXCEPTIONS) ,$( SOURCES) )
2013-04-26 21:01:39 +02:00
2015-09-25 21:39:47 +02:00
.PHONY : help
2013-04-26 21:01:39 +02:00
help :
2015-04-26 09:38:23 +02:00
@echo "Please use \`make <target>' where <target> is one of the following:"
@echo ""
2015-09-25 21:39:47 +02:00
@echo " all A synonym for 'make dev'."
@echo " build Create minified builds of converse.js and all its dependencies."
@echo " changes Make an overview of all changed/added/deprecated items added to the documentation."
@echo " clean Remove downloaded the stamp-* guard files as well as all NPM, bower and Ruby packages."
@echo " css Generate CSS from the Sass files."
@echo " cssmin Minify the CSS files."
@echo " dev Set up the development environment. To force a fresh start, run 'make clean' first."
@echo " epub Export the documentation to epub."
@echo " html Make standalone HTML files of the documentation."
2016-02-26 17:33:16 +01:00
@echo " doc Same as " doc". Make standalone HTML files of the documentation."
2015-09-25 21:39:47 +02:00
@echo " linkcheck Check all documentation external links for integrity."
@echo " po Generate gettext PO files for each i18n language."
@echo " po2json Generate JSON files from the language PO files."
@echo " pot Generate a gettext POT file to be used for translations."
@echo " release Prepare a new release of converse.js. E.g. make release VERSION=0.9.5"
@echo " serve Serve this directory via a webserver on port 8000."
@echo " stamp-bower Install bower dependencies and create the guard file stamp-bower which will prevent those dependencies from being installed again."
@echo " stamp-npm Install NPM dependencies and create the guard file stamp-npm which will prevent those dependencies from being installed again."
@echo " stamp-bundler Install Bundler (Ruby) dependencies and create the guard file stamp-bundler which will prevent those dependencies from being installed again."
@echo " watch Tells Sass to watch the .scss files for changes and then automatically update the CSS files."
.PHONY : all
2015-04-26 09:38:23 +02:00
all : dev
2015-02-05 15:57:39 +01:00
########################################################################
## Miscellaneous
2015-09-25 21:39:47 +02:00
.PHONY : serve
2015-04-26 09:38:23 +02:00
serve : stamp -npm
2016-02-15 16:06:36 +01:00
$( HTTPSERVE) -p 8000 -c -1
2013-06-01 13:17:52 +02:00
2014-04-18 17:47:47 +02:00
########################################################################
## Translation machinery
2016-02-08 09:58:57 +01:00
GETTEXT = xgettext --keyword= __ --keyword= ___ --from-code= UTF-8 --output= locale/converse.pot converse.js --package-name= Converse.js --copyright-holder= "Jan-Carel Brand" --package-version= 0.10.1 -c
2015-09-25 21:39:47 +02:00
.PHONY : pot
2014-04-18 17:47:47 +02:00
pot :
2016-02-08 09:58:57 +01:00
$( GETTEXT) --language= "javascript" 2>& 1 > /dev/null; test $$ ? -eq 0 && exit 0 || $( GETTEXT) --language= "python" && exit $$ ?;
2013-04-26 21:01:39 +02:00
2015-09-25 21:39:47 +02:00
.PHONY : po
2014-03-14 19:27:44 +01:00
po :
2013-09-12 11:14:45 +02:00
find ./locale -maxdepth 1 -mindepth 1 -type d -exec msgmerge { } /LC_MESSAGES/converse.po ./locale/converse.pot -U \;
2015-09-25 21:39:47 +02:00
.PHONY : po 2json
2013-09-15 22:16:16 +02:00
po2json :
2014-12-13 00:14:11 +01:00
find ./locale -maxdepth 1 -mindepth 1 -type d -exec $( PO2JSON) -p -f jed -d converse { } /LC_MESSAGES/converse.po { } /LC_MESSAGES/converse.json \;
2013-09-15 22:16:16 +02:00
2014-04-18 17:47:47 +02:00
########################################################################
## Release management
2015-09-25 21:39:47 +02:00
.PHONY : release
2013-10-08 09:11:04 +02:00
release :
2014-12-20 11:19:03 +01:00
sed -i s/Project-Id-Version:\ Converse\. js\ [ 0-9] \. [ 0-9] \. [ 0-9] /Project-Id-Version:\ Converse.js\ $( VERSION) / locale/converse.pot
2013-09-15 17:03:52 +02:00
sed -i s/\" version\" :\ \" [ 0-9] \. [ 0-9] \. [ 0-9] \" /\" version\" :\ \" $( VERSION) \" / bower.json
sed -i s/\" version\" :\ \" [ 0-9] \. [ 0-9] \. [ 0-9] \" /\" version\" :\ \" $( VERSION) \" / package.json
2016-02-06 10:23:50 +01:00
sed -i s/--package-version= [ 0-9] \. [ 0-9] \. [ 0-9] /--package-version= $( VERSION) / Makefile
2013-09-15 17:03:52 +02:00
sed -i s/v[ 0-9] \. [ 0-9] \. [ 0-9] \. zip/v$( VERSION) \. zip/ index.html
sed -i s/v[ 0-9] \. [ 0-9] \. [ 0-9] \. tar\. gz/v$( VERSION) \. tar\. gz/ index.html
sed -i s/version\ = \ \' [ 0-9] \. [ 0-9] \. [ 0-9] \' /version\ = \ \' $( VERSION) \' / docs/source/conf.py
sed -i s/release\ = \ \' [ 0-9] \. [ 0-9] \. [ 0-9] \' /release\ = \ \' $( VERSION) \' / docs/source/conf.py
2015-11-05 12:17:40 +01:00
sed -i "s/(Unreleased)/(`date +%Y-%m-%d`)/" docs/CHANGES.md
2014-08-25 14:39:32 +02:00
make pot
make po
2014-12-20 11:19:03 +01:00
make po2json
2014-08-04 23:09:14 +02:00
make build
2013-05-09 23:16:23 +02:00
2014-04-18 17:39:45 +02:00
########################################################################
## Install dependencies
stamp-npm : package .json
2014-03-14 19:27:44 +01:00
npm install
2014-04-18 17:39:45 +02:00
touch stamp-npm
2014-03-14 19:27:44 +01:00
2014-04-18 17:39:45 +02:00
stamp-bower : stamp -npm bower .json
$( BOWER) install
touch stamp-bower
2016-02-27 16:57:30 +01:00
stamp-bundler : Gemfile
2015-04-26 09:38:23 +02:00
mkdir -p .bundle
gem install --user bundler --bindir .bundle/bin
$( BUNDLE) install --path .bundle --binstubs .bundle/bin
touch stamp-bundler
2015-09-25 21:39:47 +02:00
.PHONY : clean
2016-02-27 16:57:30 +01:00
clean :
-rm -f stamp-npm stamp-bower stamp-bundler
-rm -rf node_modules components .bundle
2013-04-26 21:01:39 +02:00
2015-09-25 21:39:47 +02:00
.PHONY : dev
2016-02-27 16:57:30 +01:00
dev : stamp -bower stamp -bundler build
2014-04-18 17:39:45 +02:00
2014-05-07 22:36:45 +02:00
########################################################################
## Builds
2015-09-25 21:39:47 +02:00
.PHONY : css
2016-02-27 16:57:30 +01:00
css : css /converse .css
2015-04-26 09:38:23 +02:00
2016-02-27 16:57:30 +01:00
css/converse.css :: stamp -bundler stamp -bower sass
2015-09-25 21:39:47 +02:00
$( SASS) -I ./components/bourbon/app/assets/stylesheets/ sass/converse.scss css/converse.css
2015-10-16 16:12:10 +02:00
2015-09-25 21:39:47 +02:00
.PHONY : watch
watch : stamp -bundler
2015-06-27 08:50:16 +02:00
$( SASS) --watch -I ./components/bourbon/app/assets/stylesheets/ sass/converse.scss:css/converse.css
2014-04-18 17:39:45 +02:00
2016-02-28 10:00:22 +01:00
BUILDS = dist/converse.js \
dist/converse.min.js \
dist/converse.nojquery.js \
dist/converse.nojquery.min.js \
dist/converse-no-dependencies.min.js \
dist/converse-no-dependencies.js
dist/converse.min.js : stamp -bower src locale components *.js
2016-02-27 16:57:30 +01:00
$( RJS) -o src/build.js
2016-02-28 10:00:22 +01:00
dist/converse.js : stamp -bower src locale components *.js
$( RJS) -o src/build.js optimize = none out = dist/converse.js
dist/converse.nojquery.min.js : stamp -bower src locale components *.js
2016-02-27 16:57:30 +01:00
$( RJS) -o src/build-no-jquery.js
2016-02-28 10:00:22 +01:00
dist/converse.nojquery.js : stamp -bower src locale components *.js
$( RJS) -o src/build-no-jquery.js optimize = none out = dist/converse.nojquery.js
dist/converse-no-dependencies.min.js : stamp -bower src locale components *.js
2016-02-27 16:57:30 +01:00
$( RJS) -o src/build-no-dependencies.js
2016-02-28 10:00:22 +01:00
dist/converse-no-dependencies.js : stamp -bower src locale components *.js
$( RJS) -o src/build-no-dependencies.js optimize = none out = dist/converse-no-dependencies.js
2016-02-27 16:57:30 +01:00
2015-09-25 21:39:47 +02:00
.PHONY : jsmin
2016-02-27 16:57:30 +01:00
jsmin : $( BUILDS )
2015-02-05 15:57:39 +01:00
2016-02-27 16:57:30 +01:00
.PHONY : cssmin
2015-04-26 11:57:42 +02:00
cssmin : stamp -npm
2015-02-05 15:57:39 +01:00
$( GRUNT) cssmin
2016-02-28 10:00:22 +01:00
.PHONY : dist
dist :: build
2016-02-26 18:28:18 +01:00
2015-09-25 21:39:47 +02:00
.PHONY : build
2015-04-26 11:57:42 +02:00
build :: stamp -npm
2015-01-18 19:10:22 +01:00
$( GRUNT) jst
2016-02-27 16:57:30 +01:00
$( GRUNT) cssmin
2016-02-28 09:25:08 +01:00
$( GRUNT) json
2016-02-27 16:57:30 +01:00
make jsmin
2014-08-04 22:37:35 +02:00
2014-04-18 17:39:45 +02:00
########################################################################
## Tests
2015-10-25 18:49:35 +01:00
.PHONY : jshint
2016-02-27 16:57:30 +01:00
jshint : stamp -bower
2015-10-25 18:49:35 +01:00
$( JSHINT) --config jshintrc $( CHECKSOURCES)
2015-09-25 21:39:47 +02:00
.PHONY : watch
2016-02-27 16:57:30 +01:00
check : stamp -bower jshint
2014-04-18 17:39:45 +02:00
$( PHANTOMJS) node_modules/phantom-jasmine/lib/run_jasmine_test.coffee tests.html
########################################################################
## Documentation
2015-09-25 21:39:47 +02:00
.PHONY : html
2013-04-26 21:01:39 +02:00
html :
2014-12-07 10:48:32 +01:00
rm -rf $( BUILDDIR) /html
2013-04-26 21:01:39 +02:00
$( SPHINXBUILD) -b html $( ALLSPHINXOPTS) $( BUILDDIR) /html
@echo
@echo " Build finished. The HTML pages are in $( BUILDDIR) /html. "
2016-02-26 18:28:18 +01:00
.PHONY : html
2016-02-26 17:33:16 +01:00
doc : html
2015-09-25 21:39:47 +02:00
.PHONY : epub
2013-04-26 21:01:39 +02:00
epub :
$( SPHINXBUILD) -b epub $( ALLSPHINXOPTS) $( BUILDDIR) /epub
@echo
@echo " Build finished. The epub file is in $( BUILDDIR) /epub. "
2015-09-25 21:39:47 +02:00
.PHONY : changes
2013-04-26 21:01:39 +02:00
changes :
$( SPHINXBUILD) -b changes $( ALLSPHINXOPTS) $( BUILDDIR) /changes
@echo
@echo " The overview file is in $( BUILDDIR) /changes. "
2015-09-25 21:39:47 +02:00
.PHONY : linkcheck
2013-04-26 21:01:39 +02:00
linkcheck :
$( SPHINXBUILD) -b linkcheck $( ALLSPHINXOPTS) $( BUILDDIR) /linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
" or in $( BUILDDIR) /linkcheck/output.txt. "