From 68785bd19cfecd28ef124c4917a9ec6ced19e30e Mon Sep 17 00:00:00 2001 From: David Date: Sun, 24 Jan 2021 13:33:03 +0100 Subject: [PATCH] make template rule aware of STYLE variable --- Makefile | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index a1a49e0..591c0fd 100644 --- a/Makefile +++ b/Makefile @@ -26,10 +26,27 @@ TEMPLATEPDF = $(addsuffix .pdf,$(TEMPLATEBASE)) MANUAL_BASE = $(basename $(MANUAL)) MANUALPDF = $(addsuffix .pdf,$(MANUAL_BASE)) - +# redefine the template rule depending on whether the user has specified STYLE +# or not. +ifdef STYLE + # in this case user has specified STYLE +else + STYLE = casual +endif template: $(TEMPLATE) $(TEMPLATEBIB) - # build default template - latexmk -pdflua -bibtex -quiet "$<" + if [[ $(strip $(STYLE)) == "casual" ]]; then + # build template in default style + latexmk -pdflua -bibtex -quiet "$<" + else + # build template in style $(STYLE). This assumes that casual is the default. + sedstring="s/moderncvstyle{casual}/moderncvstyle{$(STYLE)}/g" + sed -i $$sedstring $(TEMPLATE) + # build template in specified style + latexmk -pdflua -bibtex -quiet "$<" + # reset template to default value + sedstring="s/moderncvstyle{$(STYLE)}/moderncvstyle{casual}/g" + sed -i $$sedstring $(TEMPLATE) + fi templates: $(TEMPLATE) $(TEMPLATEBIB)