From dce260a58394f9cecdf03f7725c2f070ff892ec6 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Wed, 11 Aug 2021 20:37:16 +0300 Subject: [PATCH] generalized doc generation... Signed-off-by: Alex A. Naanou --- Makefile | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 2bc2e71..6bcc1be 100644 --- a/Makefile +++ b/Makefile @@ -7,11 +7,6 @@ TEX := lualatex #---------------------------------------------------------------------- - -%.pdf: %.tex - $(TEX) $< > /dev/null - - # Generate docs from latex package/class... # # - keep lines starting with \def\@[A-Z]\+ @@ -27,18 +22,33 @@ TEX := lualatex # in both the repo and in installed form. # NOTE: this is evolving as need arises, when this gets too complicated # we'll split it out into it's own script. -# -# XXX need to do this without repeating the recipe... -#%.tex: %.sty -%.tex: %.cls - cat $< \ +texToDoc = \ + @echo "texToDoc: $1 -> $2"; \ + cat $1 \ | egrep '(^%%|^\\\\def\\\\$*@[A-Z]+)' \ | sed 's/^\(\\\\def\\\\\)$*@/%%\\1/'\ | sed 's/%%%%%% \(.*\)/%%\\\\subsubsection{\1}/' \ | sed 's/%%%%% \(.*\)/%%\\\\subsection{\1}/' \ | sed 's/%%%% \(.*\)/%%\\\\section{\1}/' \ | sed 's/%%\s\+>>\s\+\(.*\)/%%\\\\begin{verbatim} \1 \\\\end{verbatim}/' \ - | cut -c 3- - > $@ + | cut -c 3- - > $2 + + +#---------------------------------------------------------------------- + + +%.pdf: %.tex + $(TEX) $< > /dev/null + + +%.tex: %.sty + $(call texToDoc,$<,$@) + + +%.tex: %.cls + $(call texToDoc,$<,$@) + + #---------------------------------------------------------------------- # XXX install... (see: ./tmp/Makefile)