xmpp.chapril.org-conversejs/Makefile

226 lines
9.0 KiB
Makefile
Raw Normal View History

2013-04-26 21:01:39 +02:00
# You can set these variables from the command line.
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
ESLINT ?= ./node_modules/.bin/eslint
PAPER =
PHANTOMJS ?= ./node_modules/.bin/phantomjs
RJS ?= ./node_modules/.bin/r.js
PO2JSON ?= ./node_modules/.bin/po2json
SASS ?= ./.bundle/bin/sass
CLEANCSS ?= ./node_modules/clean-css-cli/bin/cleancss --skip-rebase
2015-10-25 18:49:35 +01:00
SPHINXBUILD ?= ./bin/sphinx-build
SPHINXOPTS =
2013-04-26 21:01:39 +02:00
# Internal variables.
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) ./docs/source
.PHONY: all
all: dev dist
.PHONY: help
2013-04-26 21:01:39 +02:00
help:
@echo "Please use \`make <target>' where <target> is one of the following:"
@echo ""
@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."
@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."
@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."
########################################################################
## Miscellaneous
.PHONY: serve
serve: stamp-npm
2016-02-15 16:06:36 +01:00
$(HTTPSERVE) -p 8000 -c -1
########################################################################
## Translation machinery
2017-04-23 19:02:44 +02:00
GETTEXT = xgettext --keyword=__ --keyword=___ --from-code=UTF-8 --output=locale/converse.pot src/*.js --package-name=Converse.js --copyright-holder="Jan-Carel Brand" --package-version=3.0.2 -c
.PHONY: pot
pot:
$(GETTEXT) --language="javascript" 2>&1 > /dev/null; test $$? -eq 0 && exit 0 || $(GETTEXT) --language="python" && exit $$?;
2013-04-26 21:01:39 +02:00
.PHONY: po
po:
find ./locale -maxdepth 1 -mindepth 1 -type d -exec msgmerge {}/LC_MESSAGES/converse.po ./locale/converse.pot -U \;
.PHONY: po2json
2013-09-15 22:16:16 +02:00
po2json:
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
########################################################################
## Release management
.PHONY: release
release:
2017-03-05 10:45:18 +01: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)\"/ bower.json
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`)/" docs/CHANGES.md
2014-08-25 14:39:32 +02:00
make pot
make po
make po2json
2014-08-04 23:09:14 +02:00
make build
########################################################################
## Install dependencies
stamp-npm: package.json
npm install
touch stamp-npm
stamp-bundler: Gemfile
mkdir -p .bundle
gem install --user bundler --bindir .bundle/bin
$(BUNDLE) install --path .bundle --binstubs .bundle/bin
touch stamp-bundler
.PHONY: clean
clean:
2017-02-16 12:56:40 +01:00
-rm -f stamp-npm stamp-bundler
-rm -rf node_modules .bundle
2013-04-26 21:01:39 +02:00
.PHONY: dev
2017-02-16 12:56:40 +01:00
dev: stamp-bundler stamp-npm
2014-05-07 22:36:45 +02:00
########################################################################
## Builds
.PHONY: css
2017-01-16 22:15:07 +01: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
2017-02-16 12:56:40 +01:00
css/converse-muc-embedded.css:: stamp-bundler sass
$(SASS) -I ./node_modules/bourbon/app/assets/stylesheets/ sass/_muc_embedded.scss css/converse-muc-embedded.css
2017-01-16 22:15:07 +01:00
2017-02-16 12:56:40 +01:00
css/converse-muc-embedded.min.css:: stamp-bundler 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
2017-02-16 12:56:40 +01:00
css/converse.css:: stamp-bundler sass
$(SASS) -I ./node_modules/bourbon/app/assets/stylesheets/ sass/converse.scss css/converse.css
2017-02-16 14:42:50 +01:00
css/converse.min.css:: stamp-npm sass
$(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-02-16 14:42:50 +01:00
css/mobile.min.css:: stamp-npm sass
2016-10-19 10:51:21 +02:00
$(CLEANCSS) css/mobile.css > css/mobile.min.css
.PHONY: watch
watch: stamp-bundler
$(SASS) --watch -I ./node_modules/bourbon/app/assets/stylesheets/ sass/converse.scss:css/converse.css sass/_muc_embedded.scss:css/converse-muc-embedded.css
BUILDS = dist/converse.js \
dist/converse.min.js \
dist/converse-mobile.js \
dist/converse-mobile.min.js \
dist/converse-muc-embedded.js \
dist/converse-muc-embedded.min.js \
dist/converse-no-jquery.js \
dist/converse-no-jquery.min.js \
dist/converse-no-dependencies.min.js \
dist/converse-no-dependencies.js
2017-02-16 12:56:40 +01:00
dist/converse.min.js: src locale node_modules *.js
$(RJS) -o src/build.js include=converse out=dist/converse.min.js
2017-02-16 12:56:40 +01:00
dist/converse.js: src locale node_modules *.js
$(RJS) -o src/build.js include=converse out=dist/converse.js optimize=none
dist/converse-no-jquery.min.js: src locale node_modules *.js
$(RJS) -o src/build.js include=converse wrap.endFile=end-no-jquery.frag exclude=jquery exclude=jquery.noconflict out=dist/converse-no-jquery.min.js
dist/converse-no-jquery.js: src locale node_modules *.js
$(RJS) -o src/build.js include=converse wrap.endFile=end-no-jquery.frag exclude=jquery exclude=jquery.noconflict out=dist/converse-no-jquery.js optimize=none
2017-02-16 12:56:40 +01:00
dist/converse-no-dependencies.min.js: src locale node_modules *.js
$(RJS) -o src/build-no-dependencies.js
2017-02-16 12:56:40 +01:00
dist/converse-no-dependencies.js: src locale node_modules *.js
$(RJS) -o src/build-no-dependencies.js optimize=none out=dist/converse-no-dependencies.js
2017-02-16 12:56:40 +01:00
dist/converse-mobile.min.js: src locale node_modules *.js
2017-02-27 11:09:15 +01:00
$(RJS) -o src/build.js paths.converse=src/converse-mobile include=converse out=dist/converse-mobile.min.js
2017-02-16 12:56:40 +01:00
dist/converse-mobile.js: src locale node_modules *.js
2017-02-27 11:09:15 +01:00
$(RJS) -o src/build.js paths.converse=src/converse-mobile include=converse out=dist/converse-mobile.js optimize=none
dist/converse-muc-embedded.min.js: src locale node_modules *.js
$(RJS) -o src/build.js paths.converse=src/converse-embedded include=converse out=dist/converse-muc-embedded.min.js
dist/converse-muc-embedded.js: src locale node_modules *.js
$(RJS) -o src/build.js paths.converse=src/converse-embedded include=converse out=dist/converse-muc-embedded.js optimize=none
.PHONY: jsmin
jsmin: $(BUILDS)
.PHONY: dist
dist:: build
.PHONY: build
2017-04-04 19:13:37 +02:00
build:: dev css
$(GRUNT) json
make jsmin
2014-08-04 22:37:35 +02:00
########################################################################
## Tests
.PHONY: eslint
eslint: stamp-npm
$(ESLINT) src/
$(ESLINT) spec/
2016-05-23 21:21:42 +02:00
.PHONY: check
2017-04-05 11:01:31 +02:00
check: eslint
$(PHANTOMJS) tests/run-jasmine2.js tests.html
########################################################################
## Documentation
.PHONY: html
2013-04-26 21:01:39 +02:00
html:
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."
.PHONY: html
2016-02-26 17:33:16 +01:00
doc: html
.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."
.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."
.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."