From 78e39b37db563f9c3356db0fa70829efb82b21c6 Mon Sep 17 00:00:00 2001 From: Kevin Stevens Date: Wed, 28 Dec 2022 19:13:58 -0600 Subject: [PATCH] Improve shell compatibility The SHELL variable was causing very confusing differences in backslash escaping when running in different environments (e.g. Ubuntu vs Alpine Linux) due to differences in default shells. When it's not defined, Make uses /bin/sh by default, ensuring that escaping is performed more-or-less consistently. I also switched echo to printf, both for consistency with other parts of the Makefile and [to further improve cross-environment consistency](https://unix.stackexchange.com/a/65819). --- Makefile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 99662d1..270fa77 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,6 @@ PLOT := $(patsubst %.gp,%.tex,$(wildcard data/*.gp)) DEPS := rev.tex code/fmt.tex abstract.txt $(CODE) $(FIGS) $(ODGS) $(PLOT) LTEX := --latex-args="-synctex=1 -shell-escape" BTEX := --bibtex-args="-min-crossrefs=99" -SHELL:= $(shell echo $$SHELL) all: $(DEPS) ## generate a pdf @TEXINPUTS="sty:" bin/latexrun $(LTEX) $(BTEX) $(MAIN) @@ -49,11 +48,11 @@ data/%.pdf: data/%.py ## generate plot python3 $^ draft: $(DEPS) ## generate pdf with a draft info - echo -e '\\newcommand*{\\DRAFT}{}' >> rev.tex + @printf '\\newcommand*{\\DRAFT}{}' >> rev.tex @TEXINPUTS="sty:" bin/latexrun $(BTEX) $(MAIN) watermark: $(DEPS) ## generate pdf with a watermark - echo -e '\\usepackage[firstpage]{draftwatermark}' >> rev.tex + @printf '\\usepackage[firstpage]{draftwatermark}' >> rev.tex @TEXINPUTS="sty:" bin/latexrun $(BTEX) $(MAIN) spell: ## run a spell check