From: fennecdjay Date: Wed, 19 Jun 2019 23:09:20 +0000 (+0200) Subject: :art: Make docs no longer a submodule X-Git-Tag: nightly~2430 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=a606dc8dd3b8f22c37e7c3f01ab600fa665ba406;p=gwion.git :art: Make docs no longer a submodule --- diff --git a/Makefile b/Makefile index 20b3fde9..cd7ed00a 100644 --- a/Makefile +++ b/Makefile @@ -109,3 +109,5 @@ test: include $(wildcard .d/*.d) include util/target.mk include util/intl.mk +include docs/config.mk +include docs.mk diff --git a/docs.mk b/docs.mk new file mode 100644 index 00000000..1dd0e686 --- /dev/null +++ b/docs.mk @@ -0,0 +1,61 @@ +mdr_list = $(shell find -regextype posix-egrep -regex '.*.mdr$$') +md_list = $(mdr_list:.mdr=.md) + +_docserver_launch = $(DOCTOOL) -q serve & echo $$! > .server_pid +_docserver_kill = [ -f .server_pid ] && (kill $$(cat .server_pid); rm .server_pid) || true + +_mdr_wait=$$(inotifywait -q -r docs --format "%w%f" | tail -n1) + +doc-run: + @bash -c "trap 'trap - SIGINT SIGTERM ERR; $(MAKE) -s doc-clean; exit 1' SIGINT SIGTERM ERR; $(MAKE) -s doc-watch" + +doc-watch: $(md_list) + @$(call _docserver_launch) + @while true; do file=$(call _mdr_wait); echo $$file | grep '\.mdr$$' && mdr $$file; done + +doc-serve: + @(call _docserver_launch) + +doc-clean: + -@$(call _docserver_kill) + @rm -rf *.gw vlog log $(md_list) .tmp_list .mdr_list site + +doc-build: $(md_list) + $(DOCTOOL) build + +doc-deploy: $(md_list) + @$(DOCTOOL) gh-deploy + @$(MAKE) -s doc-clean + +.PHONY: mdr_loop watch serve clean run + +.SUFFIXES: .mdr .md +.mdr.md: + $(info compiling $<) + @mdr $< ||: + +ifeq ($(VALGRIND), NO_VALGRIND) +VALGRIND = +VALGRIND_OPT = +endif + +include config.mk + +.SUFFIXES: .gw .test +.gw.test: + @${VALGRIND} ${VALGRIND_OPT} gwion $< &> log + @[ -t 1 ] && $(call _interm) || $(call _noterm) + +define _test_check + for a in $(CONTAINS); do grep "$$a" log >/dev/null; done && valgrind_parse vlog +endef + +_interm_status=echo -e "$(INTERM_OK)" || echo -e "$(INTERM_NOT_OK)" +_interm=(cat log; $(call _test_check) && $(call _interm_status)) + +_noterm_log=sed 's/$$/\/' log +_noterm_status=echo -e "$(NOTERM_OK)" || echo -e "$(NOTERM_NOT_OK)" +_noterm_header=echo '

' +_noterm_test=$(call _test_check) && $(call _noterm_status) +_noterm_footer=echo '

' +_noterm=($(call _noterm_header); $(call _noterm_log); $(call _noterm_test); $(call _noterm_footer))