msc-iksinski/Makefile

44 lines
1.3 KiB
Makefile
Raw Normal View History

2019-12-02 20:49:08 +01:00
SHELL=/bin/bash
THESIS_ID=iksinski
all: $(THESIS_ID).pdf stats.txt
source-pack: $(THESIS_ID).zip
CONTENT_TEX_SOURCES=$(filter-out $(THESIS_ID).tex metadata.tex preamble.tex, $(wildcard *.tex))
CURRENT_DIR=$(shell pwd)
AUTOZOIL_DIR?=/opt/autozoil
AUTOZOIL_LOCALE=pl_PL
CONTENT_TEX_SOURCES_WITH_DIR := $(addprefix $(CURRENT_DIR)/, $(CONTENT_TEX_SOURCES))
SCOREFILES=$(shell perl extract-score-files.pl $(CONTENT_TEX_SOURCES))
clean_latex_stuff=rm -rf *.aux *.nav *.toc *.log *.out *.blg *.bbl autozoil.xml $(THESIS_ID).pdf $(THESIS_ID).zip
stats.txt: $(THESIS_ID).pdf helpers/stats.sh
bash helpers/stats.sh $< > $@
cat $@
$(THESIS_ID).pdf: $(THESIS_ID).tex preamble.tex metadata.tex $(CONTENT_TEX_SOURCES) bibliography.bib $(SCOREFILES)
pdflatex -halt-on-error $<
bibtex $(THESIS_ID)
pdflatex -halt-on-error $<
pdflatex -halt-on-error $<
scores/%.txt:
mkdir -p scores
curl "https://gonito.net/api/txt/score/"$* -o $@
autozoil.xml: $(CONTENT_TEX_SOURCES)
cd $(AUTOZOIL_DIR) && set -o pipefail && ./autozoil --locale $(AUTOZOIL_LOCALE) $(CONTENT_TEX_SOURCES_WITH_DIR) --format xml --alt-log-file $(CURRENT_DIR)/$(THESIS_ID).log > $(CURRENT_DIR)/autozoil.xml
$(THESIS_ID).zip:
$(clean_latex_stuff)
rm -rf *~
zip -r $@ . -x '*.git*' '*.zip'
clean:
$(clean_latex_stuff)