From d1fcf6fb400ef1dab7d988354b4ca48614e93420 Mon Sep 17 00:00:00 2001
From: Holden Rohrer
Date: Thu, 28 May 2020 16:57:49 -0400
Subject: made makefile more posix-y
---
Makefile | 65 +++++++++++++++++++++++++++++++++++++++++-----------------------
1 file changed, 42 insertions(+), 23 deletions(-)
diff --git a/Makefile b/Makefile
index 3a472ce..f55bb12 100644
--- a/Makefile
+++ b/Makefile
@@ -1,45 +1,64 @@
-ASSETS = imgs/made graph/depth_width.png graph/nearest_neighbor.png
-DIRS = imgs graph outputs
+.POSIX:
+.SUFFIXES: .tex .pdf
-$(shell mkdir -p $(DIRS))
+DIRS = outputs graph
+PDFS = poster/document.pdf report/document.pdf logbook/document.pdf
+pdfs: outputs/poster.pdf outputs/report.pdf outputs/logbook.pdf
+$(DIRS):
+ mkdir -p $@
-.PHONY: all png clean
-all: outputs/poster.pdf outputs/report.pdf outputs/logbook.pdf
+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:
- rm -rf $(DIRS) data/tables.tex
+ rm -rf imgs gen/tables.tex $(DIRS) data/tables.tex $(PDFS)
-.SECONDEXPANSION:
-
-imgs/made: python/data.py python/img.py
+imgs: python/data.py python/img.py
+ mkdir -p imgs
cd imgs && \
python3 ../python/img.py
- touch imgs/made
-graph/depth_width.png: python/data.py python/depwid.py
+graph/depth_width.png: python/data.py python/depwid.py graph
cd graph && python3 ../python/depwid.py
-graph/nearest_neighbor.png: python/data.py python/neighbor.py
+graph/nearest_neighbor.png: python/data.py python/neighbor.py graph
cd graph && python3 ../python/neighbor.py
-outputs/poster.png: outputs/poster.pdf
+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
-outputs/%.pdf: gen/tables.tex $$(wildcard %/*.tex) $(ASSETS)
- cd $* && pdftex document.tex >/dev/null
- rm $*/document.log
- mv $*/document.pdf $@
+$(PDFS): gen/tables.tex imgs graph/made
+
+.tex.pdf:
+ cd ${@D} && \
+ pdftex document.tex >/dev/null
+ rm ${@D}/document.log
+
+poster/document.pdf: poster/abstract.tex poster/analysis.tex poster/conclusion.tex poster/document.tex poster/format.tex poster/hypothesis.tex poster/imagesfive.tex poster/imagesfour.tex poster/imagesone.tex poster/imagesthree.tex poster/imagestwo.tex poster/materials.tex poster/methods.tex poster/notes.tex poster/palette.tex poster/research.tex poster/results.tex poster/vars.tex poster/voronoi.tex
-gen/%.tex: gen/make%.sh gen/%.orig.tex
- $<
+report/document.pdf: report/abstract.tex report/analysis.tex report/biblio.tex report/conclusion.tex report/document.tex report/format.tex report/graphs.tex report/intro.tex report/materials.tex report/pics.tex report/procedure.tex report/research.tex report/tables.tex
-outputs/poster.pdf: outputs/qr-source.png outputs/qr.png
-outputs/logbook.pdf outputs/report.pdf: generic.tex
+logbook/document.pdf: logbook/biblio.tex logbook/bulletnotes.tex logbook/conclusion.tex logbook/document.tex logbook/hypothesis.tex logbook/mats.tex logbook/methods.tex logbook/research.tex logbook/vars.tex
+
+gen/tables.tex: gen/maketables.sh gen/tables.orig.tex
+ gen/maketables.sh
+
+poster/document.pdf: outputs/qr-source.png outputs/qr.png
+logbook/document.pdf report/document.pdf: generic.tex
logbook/tables.tex poster/tables.tex: data/tables.tex
-outputs/qr.png:
+outputs/qr.png: outputs
qrencode https://hrhr.dev/report.pdf -o outputs/qr.png
-outputs/qr-source.png:
+outputs/qr-source.png: outputs
qrencode https://git.hrhr.dev/scifair -o outputs/qr-source.png
+
--
cgit