aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHolden Rohrer <hr@hrhr.dev>2020-05-28 17:57:59 -0400
committerHolden Rohrer <hr@hrhr.dev>2020-05-28 17:59:12 -0400
commitfd6f2bc4f1c97234b5d3d9989ea5fb4016969622 (patch)
treea7b4b48155f6164392f863eb002742a942a6904a
parent090dc2da6abd7dfcb9ab22559ccb684700148794 (diff)
generalized python/pdftex/gs and added dep checks
-rw-r--r--Makefile.orig20
-rwxr-xr-xconfigure12
2 files changed, 19 insertions, 13 deletions
diff --git a/Makefile.orig b/Makefile.orig
index 6d668ef..ed3c2d6 100644
--- a/Makefile.orig
+++ b/Makefile.orig
@@ -3,16 +3,12 @@
DIRS = outputs graph
PDFS = poster/document.pdf report/document.pdf logbook/document.pdf
+PYTHON = python3
+PDFTEX = pdftex
+GHOSTSCRIPT = gs
pdfs: outputs/poster.pdf outputs/report.pdf outputs/logbook.pdf
$(DIRS):
mkdir -p $@
-
-outputs/poster.pdf: poster/document.pdf outputs
- cp -f $< $@
-outputs/report.pdf: report/document.pdf outputs
- cp -f $< $@
-outputs/logbook.pdf: logbook/document.pdf outputs
- cp -f $< $@
png: outputs/poster.png
clean:
@@ -21,25 +17,25 @@ clean:
imgs: python/data.py python/img.py
mkdir -p imgs
cd imgs && \
- python3 ../python/img.py
+ $(PYTHON) ../python/img.py
graph/depth_width.png: python/data.py python/depwid.py graph
- cd graph && python3 ../python/depwid.py
+ cd graph && $(PYTHON) ../python/depwid.py
graph/nearest_neighbor.png: python/data.py python/neighbor.py graph
- cd graph && python3 ../python/neighbor.py
+ cd graph && $(PYTHON) ../python/neighbor.py
graph/made: graph/depth_width.png graph/nearest_neighbor.png graph
touch graph/made
outputs/poster.png: outputs/poster.pdf outputs
- gs -sDEVICE=pngalpha -r288 -o outputs/poster.png outputs/poster.pdf
+ $(GHOSTSCRIPT) -sDEVICE=pngalpha -r288 -o outputs/poster.png outputs/poster.pdf
$(PDFS): gen/tables.tex imgs graph/made
.tex.pdf:
cd ${@D} && \
- pdftex document.tex >/dev/null
+ $(PDFTEX) document.tex >/dev/null
rm ${@D}/document.log
gen/tables.tex: gen/maketables.sh gen/tables.orig.tex
diff --git a/configure b/configure
index 91ce029..0e08c74 100755
--- a/configure
+++ b/configure
@@ -1,8 +1,18 @@
#!/bin/sh
+python3 --version >/dev/null|| echo "Install python3" && exit 1
+pdftex --version >/dev/null|| echo "Install pdftex (TeXLive)" && exit 1
+make -v >/dev/null || echo "Install make" && exit 1
+python -c "import numpy" >/dev/null || echo "Install numpy" && exit 1
+python -c "import scipy" >/dev/null || echo "Install scipy" && exit 1
+python -c "import matplotlib" >/dev/null || echo "Install matplotlib" && exit 1
+gs --version >/dev/null || echo "Ghostscript not installed (no PNG poster)"
+
cp Makefile.orig Makefile
for tgt in */document.tex; do
DIR=$(dirname $tgt)
- ( echo; echo -n "${DIR}/document.pdf: ${DIR}/document.tex "; find $DIR \!\
+ ( echo -en "\n${DIR}/document.pdf: ${DIR}/document.tex "; find $DIR \!\
-type d \! -name "document.tex" -a -name "*.tex" -exec echo {} +; ) >> Makefile
+ echo -e "\noutputs/${DIR}.pdf: ${DIR}/document.pdf outputs\n\tcp -f $< \$@"\
+ >> Makefile
done