2017-12-05 18:35:01 +01:00
SHELL := /bin/bash --login
2013-04-26 21:01:39 +02:00
# You can set these variables from the command line.
2017-07-10 15:54:05 +02:00
UGLIFYJS ?= node_modules/.bin/uglifyjs
2017-06-21 22:26:00 +02:00
BABEL ?= node_modules/.bin/babel
2017-06-13 21:07:42 +02:00
BOURBON_TEMPLATES = ./node_modules/bourbon/app/assets/stylesheets/
2017-06-13 12:22:02 +02:00
BUILDDIR = ./docs
BUNDLE ?= ./.bundle/bin/bundle
2017-06-21 22:26:00 +02:00
CHROMIUM ?= ./node_modules/.bin/run-headless-chromium
CLEANCSS ?= ./node_modules/clean-css-cli/bin/cleancss --skip-rebase
ESLINT ?= ./node_modules/.bin/eslint
2017-06-13 12:22:02 +02:00
HTTPSERVE ?= ./node_modules/.bin/http-server
2017-12-05 18:46:22 +01:00
HTTPSERVE_PORT ?= 8000
2017-06-13 12:22:02 +02:00
PAPER =
PO2JSON ?= ./node_modules/.bin/po2json
2017-06-21 22:26:00 +02:00
RJS ?= ./node_modules/.bin/r.js
2017-06-13 12:22:02 +02:00
SASS ?= ./.bundle/bin/sass
SPHINXBUILD ?= ./bin/sphinx-build
2017-07-12 22:51:56 +02:00
SED ?= sed
2017-06-13 12:22:02 +02:00
SPHINXOPTS =
2014-03-17 21:37:40 +01:00
2017-12-05 18:35:01 +01:00
# In the case user wishes to use RVM
USE_RVM ?= false
RVM_RUBY_VERSION ?= 2.4.2
i f e q ( $( USE_RVM ) , t r u e )
RVM_USE = rvm use $( RVM_RUBY_VERSION)
e n d i f
2013-04-26 21:01:39 +02:00
# Internal variables.
ALLSPHINXOPTS = -d $( BUILDDIR) /doctrees $( PAPEROPT_$( PAPER) ) $( SPHINXOPTS) ./docs/source
2016-03-29 08:56:13 +02:00
.PHONY : all
2016-09-23 15:41:12 +02:00
all : dev dist
2016-03-29 08:56:13 +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."
2017-02-16 12:56:40 +01:00
@echo " clean Remove downloaded the stamp-* guard files as well as all NPM and Ruby packages."
2015-09-25 21:39:47 +02:00
@echo " css Generate CSS from the Sass 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-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."
2015-02-05 15:57:39 +01:00
########################################################################
## Miscellaneous
2015-09-25 21:39:47 +02:00
.PHONY : serve
2017-06-13 12:22:02 +02:00
serve : dev
2017-12-05 18:46:22 +01:00
$( HTTPSERVE) -p $( HTTPSERVE_PORT) -c-1
2017-06-13 12:22:02 +02:00
.PHONY : serve_bg
serve_bg : dev
2017-12-05 18:46:22 +01:00
$( HTTPSERVE) -p $( HTTPSERVE_PORT) -c-1 -s &
2013-06-01 13:17:52 +02:00
2014-04-18 17:47:47 +02:00
########################################################################
## Translation machinery
2018-01-29 16:33:30 +01:00
GETTEXT = xgettext --language= "JavaScript" --keyword= __ --keyword= ___ --from-code= UTF-8 --output= locale/converse.pot dist/converse-no-dependencies.js --package-name= Converse.js --copyright-holder= "Jan-Carel Brand" --package-version= 3.3.2 -c
2016-02-08 09:58:57 +01:00
2015-09-25 21:39:47 +02:00
.PHONY : pot
2017-09-23 23:29:50 +02:00
pot : dist /converse -no -dependencies .js
2017-08-23 11:56:40 +02:00
$( GETTEXT) 2>& 1 > /dev/null; 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 :
2018-01-05 12:47:50 +01:00
find ./locale -maxdepth 1 -mindepth 1 -type d -exec $( PO2JSON) -f jed1.x -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 :
2017-07-22 22:18:55 +02:00
$( SED) -ri s/Version:\ [ 0-9] \+ \. [ 0-9] \+ \. [ 0-9] \+ /Version:\ $( VERSION) / COPYRIGHT
2017-07-12 22:51:56 +02:00
$( SED) -ri s/Version:\ [ 0-9] \+ \. [ 0-9] \+ \. [ 0-9] \+ /Version:\ $( VERSION) / src/start.frag
$( SED) -ri s/Project-Id-Version:\ Converse\. js\ [ 0-9] \+ \. [ 0-9] \+ \. [ 0-9] \+ /Project-Id-Version:\ Converse.js\ $( VERSION) / locale/converse.pot
$( SED) -ri s/\" version\" :\ \" [ 0-9] \+ \. [ 0-9] \+ \. [ 0-9] \+ \" /\" version\" :\ \" $( VERSION) \" / package.json
$( SED) -ri s/--package-version= [ 0-9] \+ \. [ 0-9] \+ \. [ 0-9] \+ /--package-version= $( VERSION) / Makefile
$( SED) -ri s/v[ 0-9] \+ \. [ 0-9] \+ \. [ 0-9] \+ \. zip/v$( VERSION) \. zip/ index.html
$( SED) -ri s/v[ 0-9] \+ \. [ 0-9] \+ \. [ 0-9] \+ \. tar\. gz/v$( VERSION) \. tar\. gz/ index.html
$( SED) -ri s/version\ = \ \' [ 0-9] \+ \. [ 0-9] \+ \. [ 0-9] \+ \' /version\ = \ \' $( VERSION) \' / docs/source/conf.py
$( SED) -ri s/release\ = \ \' [ 0-9] \+ \. [ 0-9] \+ \. [ 0-9] \+ \' /release\ = \ \' $( VERSION) \' / docs/source/conf.py
$( SED) -ri "s/(Unreleased)/`date +%Y-%m-%d`/" 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
2017-08-09 16:05:49 +02:00
npm install && touch stamp-npm
2014-03-14 19:27:44 +01:00
2016-02-27 16:57:30 +01:00
stamp-bundler : Gemfile
2015-04-26 09:38:23 +02:00
mkdir -p .bundle
2017-12-05 18:35:01 +01:00
$( RVM_USE)
2015-04-26 09:38:23 +02:00
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 :
2017-07-15 07:58:30 +02:00
-rm -f stamp-npm stamp-bundler package-lock.json
2017-02-16 11:59:28 +01:00
-rm -rf node_modules .bundle
2013-04-26 21:01:39 +02:00
2015-09-25 21:39:47 +02:00
.PHONY : dev
2017-02-16 12:56:40 +01:00
dev : stamp -bundler stamp -npm
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
2017-06-13 21:07:42 +02:00
css : sass /*.scss css /converse .css css /converse .min .css css /mobile .min .css css /theme .min .css css /converse -muc -embedded .min .css css /inverse .css css /inverse .min .css
2018-01-29 17:05:23 +01:00
css/inverse.css :: dev sass sass /*
2017-06-13 21:07:42 +02:00
$( SASS) -I $( BOURBON_TEMPLATES) sass/inverse/inverse.scss css/inverse.css
css/inverse.min.css :: css /inverse .css
$( CLEANCSS) css/inverse.css > css/inverse.min.css
2017-01-16 22:15:07 +01:00
2018-01-29 17:05:23 +01:00
css/converse-muc-embedded.css :: dev sass /*
2017-06-13 21:07:42 +02:00
$( SASS) -I $( BOURBON_TEMPLATES) sass/_muc_embedded.scss css/converse-muc-embedded.css
2017-01-16 22:15:07 +01:00
2018-01-29 17:05:23 +01:00
css/converse-muc-embedded.min.css :: dev sass css /converse -muc -embedded .css
2017-01-16 22:15:07 +01:00
$( CLEANCSS) css/converse-muc-embedded.css > css/converse-muc-embedded.min.css
2015-04-26 09:38:23 +02:00
2018-01-29 17:05:23 +01:00
css/converse.css :: dev sass /*
2017-06-13 21:17:00 +02:00
$( SASS) -I $( BOURBON_TEMPLATES) sass/converse/converse.scss css/converse.css
2015-10-16 16:12:10 +02:00
2017-06-13 21:07:42 +02:00
css/converse.min.css :: css /converse .css
2016-09-23 13:37:18 +02:00
$( CLEANCSS) css/converse.css > css/converse.min.css
2017-02-16 14:42:50 +01:00
css/theme.min.css :: stamp -npm css /theme .css
2016-10-19 10:51:21 +02:00
$( CLEANCSS) css/theme.css > css/theme.min.css
2017-06-14 11:14:42 +02:00
css/mobile.min.css :: stamp -npm sass /*
2016-10-19 10:51:21 +02:00
$( CLEANCSS) css/mobile.css > css/mobile.min.css
2015-09-25 21:39:47 +02:00
.PHONY : watch
2018-01-29 17:05:23 +01:00
watch : dev
2017-07-15 11:03:22 +02:00
$( SASS) --watch -I ./node_modules/bourbon/app/assets/stylesheets/ sass/converse/converse.scss:css/converse.css sass/_muc_embedded.scss:css/converse-muc-embedded.css sass/inverse/inverse.scss:css/inverse.css
2014-04-18 17:39:45 +02:00
2017-06-21 22:26:00 +02:00
.PHONY : watchjs
watchjs : stamp -npm
2017-07-10 14:07:46 +02:00
$( BABEL) --source-maps --watch= ./src --out-dir= ./builds
2017-09-27 00:33:58 +02:00
transpile : stamp -npm src
2017-11-17 11:02:55 +01:00
$( BABEL) --source-maps --out-dir= ./builds ./src
$( BABEL) --source-maps --out-dir= ./builds ./node_modules/backbone.vdomview/backbone.vdomview.js
touch transpile
2017-06-21 22:26:00 +02:00
2016-02-28 10:00:22 +01:00
BUILDS = dist/converse.js \
dist/converse.min.js \
2017-12-22 22:23:08 +01:00
dist/converse-headless.js \
dist/converse-headless.min.js \
2017-07-10 15:54:05 +02:00
dist/converse-muc-embedded.js \
dist/converse-muc-embedded.min.js \
2016-02-28 10:00:22 +01:00
dist/converse-no-dependencies.min.js \
dist/converse-no-dependencies.js
2017-12-04 12:29:46 +01:00
# dist/converse-esnext.js \
# dist/converse-esnext.min.js \
2017-11-03 08:45:47 +01:00
dist/converse.js : transpile src node_modules
2017-02-27 08:42:17 +01:00
$( RJS) -o src/build.js include = converse out = dist/converse.js optimize = none
2017-11-03 08:45:47 +01:00
dist/converse.min.js : transpile src node_modules
2017-08-09 18:43:05 +02:00
$( RJS) -o src/build.js include = converse out = dist/converse.min.js
2017-12-22 22:23:08 +01:00
dist/converse-headless.js : transpile src node_modules
$( RJS) -o src/build.js paths.converse= src/headless include = converse out = dist/converse-headless.js optimize = none
dist/converse-headless.min.js : transpile src node_modules
$( RJS) -o src/build.js paths.converse= src/headless include = converse out = dist/converse-headless.min.js
2017-11-03 08:45:47 +01:00
dist/converse-esnext.js : src node_modules
2017-07-10 14:07:46 +02:00
$( RJS) -o src/build-esnext.js include = converse out = dist/converse-esnext.js optimize = none
2017-11-03 08:45:47 +01:00
dist/converse-esnext.min.js : src node_modules
2017-08-09 18:43:05 +02:00
$( RJS) -o src/build-esnext.js include = converse out = dist/converse-esnext.min.js
2017-11-03 08:45:47 +01:00
dist/converse-no-dependencies.js : transpile src node_modules
2017-09-23 23:29:50 +02:00
$( RJS) -o src/build-no-dependencies.js optimize = none out = dist/converse-no-dependencies.js
2017-11-03 08:45:47 +01:00
dist/converse-no-dependencies.min.js : transpile src node_modules
2017-08-09 18:43:05 +02:00
$( RJS) -o src/build-no-dependencies.js out = dist/converse-no-dependencies.min.js
2017-11-03 08:45:47 +01:00
dist/converse-muc-embedded.js : transpile src node_modules
2017-04-21 16:32:28 +02:00
$( RJS) -o src/build.js paths.converse= src/converse-embedded include = converse out = dist/converse-muc-embedded.js optimize = none
2017-11-03 08:45:47 +01:00
dist/converse-muc-embedded.min.js : transpile src node_modules
2017-08-09 18:43:05 +02:00
$( RJS) -o src/build.js paths.converse= src/converse-embedded include = converse out = dist/converse-muc-embedded.min.js
2016-02-27 16:57:30 +01:00
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
2017-11-03 08:45:47 +01:00
build :: dev css transpile $( BUILDS )
2014-08-04 22:37:35 +02:00
2014-04-18 17:39:45 +02:00
########################################################################
## Tests
2017-01-26 15:49:02 +01:00
.PHONY : eslint
eslint : stamp -npm
2017-06-21 22:26:00 +02:00
$( ESLINT) src/
$( ESLINT) spec/
2017-01-26 15:49:02 +01:00
2016-05-23 21:21:42 +02:00
.PHONY : check
2017-04-05 11:01:31 +02:00
check : eslint
2018-01-15 19:21:13 +01:00
LOG_CR_VERBOSITY = INFO $( CHROMIUM) --no-sandbox http://localhost:$( HTTPSERVE_PORT) /tests.html
2014-04-18 17:39:45 +02:00
########################################################################
## 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. "