all: build/draft.html build/draft.css build/draft.js build/logo.svg build/favicon.png
.PHONY: all

clean: 
	@ rm --recursive --force temp
.PHONY: clean

clear: clean
	@ rm --recursive --force build
.PHONY: clear

build/draft.html: source/data/phonology_and_orthography.json source/data/personal_pronouns.json source/data/word_functions.json source/data/timeforms.json source/data/adpositions.json source/data/correlatives.json source/data/x.json source/logic/server/misc.php source/logic/server/data.php source/logic/server/settings.php source/logic/server/table.php source/logic/server/sql.php source/content/draft.html.php source/content/meta.html.php source/content/introduction.html.php source/content/preface.html.php source/content/key_parameters.html.php source/content/toc.html.php source/content/basics.html.php source/content/phonology_and_orthography.html.php source/content/grammar.html.php source/content/personal_pronouns.html.php source/content/correlatives.html.php source/content/conjugation.html.php source/content/infinite_verbforms.html.php source/content/tempora_and_modi.html.php source/content/declension.html.php source/content/attributes.html.php source/content/sentence_structure.html.php source/content/vocabulary.html.php source/content/principles.html.php source/content/word_functions.html.php source/content/adpositions.html.php source/content/pronouns.html.php source/content/dictionary.html.php
	@ echo -e '-- composing document ...'
	@ mkdir --parents build
	@ php source/content/draft.html.php > build/draft.html

build/draft.js: source/logic/client/tools.js source/logic/client/table.js source/logic/client/toc.js source/logic/client/main.js
	@ echo -e '-- composing client-logic ...'
	@ mkdir --parents build
	@ cat source/logic/client/tools.js source/logic/client/table.js source/logic/client/toc.js source/logic/client/main.js > build/draft.js

build/logo.svg: source/media/logo.svg
	@ echo -e '-- copying logo ...'
	@ mkdir --parents build
	@ cp --recursive source/media/logo.svg build/logo.svg

build/favicon.png: source/media/folksprak_16x16.png
	@ echo -e '-- copying favicon ...'
	@ mkdir --parents build
	@ cp --recursive source/media/folksprak_16x16.png build/favicon.png

build/draft.css: source/style/functions.less source/style/theme.less source/style/common.less source/style/concrete.less
	@ echo -e '-- compiling style ...'
	@ mkdir --parents temp
	@ cat source/style/functions.less source/style/theme.less source/style/common.less source/style/concrete.less > temp/draft.less
	@ mkdir --parents build
	@ lessc temp/draft.less > build/draft.css