]> Nishi Git Mirror - gwion.git/commitdiff
:wrench: Improve doc build system
authorfennecdjay <astor.jeremie@wanadoo.fr>
Thu, 20 Jun 2019 19:45:05 +0000 (21:45 +0200)
committerfennecdjay <astor.jeremie@wanadoo.fr>
Thu, 20 Jun 2019 19:45:05 +0000 (21:45 +0200)
docs.mk
docs/config.mk.orig [new file with mode: 0644]

diff --git a/docs.mk b/docs.mk
index d8f73d624e9ff03f8553c2c04a92fbc91644e3ec..b767302d1c80e0169b137871f4eaa84bbdc05c9d 100644 (file)
--- a/docs.mk
+++ b/docs.mk
@@ -1,22 +1,26 @@
+ifeq (,$(wildcard docs/config.mk))
+$(shell cp docs/config.mk.orig docs/config.mk)
+endif
+include docs/config.mk
+
 mdr_list = $(shell find -regextype posix-egrep -regex '.*.mdr$$')
 md_list  = $(mdr_list:.mdr=.md)
 
-_docserver_launch = $(DOCTOOL) -q serve & echo $$! > .server_pid
+_docserver_config       = bash help/doc-config.sh > mkdocs.yml
+_docserver_serve = $(call _docserver_config); $(DOCTOOL) -q serve
+_docserver_launch = $(call _docserver_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}
-       @bash help/doc-config.sh > mkdocs.yml
        @$(call _docserver_launch)
        @while true; do file=$(call _mdr_wait); echo $$file | grep '\.mdr$$' && mdr $$file; done
 
 doc-serve: $(md_list)
-       @bash help/doc-config.sh > mkdocs.yml
-       @$(DOCTOOL) -q serve
+       @$(call _docserver_serve)
 
 doc-clean:
        -@$(call _docserver_kill)
@@ -36,13 +40,6 @@ doc-deploy: $(md_list)
        $(info compiling $<)
        @mdr $< ||:
 
-ifeq ($(VALGRIND), NO_VALGRIND)
-VALGRIND     =
-VALGRIND_OPT =
-endif
-
-include config.mk
-
 .SUFFIXES: .gw .test
 .gw.test:
        @${VALGRIND} ${VALGRIND_OPT} gwion $< &> log
@@ -57,27 +54,7 @@ _interm=(cat log; $(call _test_check) && $(call _interm_status))
 
 _noterm_log=sed 's/$$/\<br\/>/' log
 _noterm_status=echo -e "$(NOTERM_OK)" || echo -e "$(NOTERM_NOT_OK)"
-#_noterm_header=echo '<blockquote><p style=$(CSS)>'
-_noterm_header=echo '<p style=$(CSS)>'
 _noterm_test=$(call _test_check) && $(call _noterm_status)
+_noterm_header=echo '<p style=$(CSS)>'
 _noterm_footer=echo '</p>'
 _noterm=($(call _noterm_header); $(call _noterm_log); $(call _noterm_test); $(call _noterm_footer))
-DOCTOOL ?= mkdocs
-
-# output box css
-BACKGROUND    = background-color:\#f2f2f2;
-BORDER        = border: 5px solid \#546e7a;
-PADDING       = padding: 10px;
-MARGIN        = margin-right: 20%; margin-left: 20%;
-BORDER_RADIUS = -moz-border-radius: 15px; -webkit-border-radius: 15px;
-CSS           = "$(BACKGROUND) $(BORDER) $(PADDING) $(MARGIN) $(BORDER_RADIUS)"
-
-VALGRIND     ?= valgrind
-VALGRIND_LOG ?= vlog
-VALGRIND_OPT += --leak-check=yes --log-file=${VALGRIND_LOG}
-
-INTERM_OK       = \033[32mOK\033[0m
-INTERM_NOT_OK   = \033[31mNOT OK\033[0m
-
-NOTERM_OK= &\#10004;
-NOTERM_NOT_OK= &\#10008;
diff --git a/docs/config.mk.orig b/docs/config.mk.orig
new file mode 100644 (file)
index 0000000..9cecde9
--- /dev/null
@@ -0,0 +1,32 @@
+# tool to build the doc
+DOCTOOL = mkdocs -q
+DOCBUILD = build
+DOCSERVE = serve
+
+# output box css
+BACKGROUND    = background-color:\#f2f2f2;
+BORDER        = border: 5px solid \#546e7a;
+PADDING       = padding: 10px;
+MARGIN        = margin-right: 20%; margin-left: 20%;
+BORDER_RADIUS = -moz-border-radius: 15px; -webkit-border-radius: 15px;
+CSS           = "$(BACKGROUND) $(BORDER) $(PADDING) $(MARGIN) $(BORDER_RADIUS)"
+
+# output box status
+NOTERM_OK= &\#10004;
+NOTERM_NOT_OK= &\#10008;
+
+# terminal status
+INTERM_OK       = \033[32mOK\033[0m
+INTERM_NOT_OK   = \033[31mNOT OK\033[0m
+
+# valgrind
+VALGRIND     ?= valgrind
+VALGRIND_LOG ?= vlog
+VALGRIND_OPT += --leak-check=yes --log-file=${VALGRIND_LOG}
+
+## ensure no valgrind if requested
+ifeq ($(VALGRIND), NO_VALGRIND)
+VALGRIND     =
+VALGRIND_OPT =
+endif
+