10
2
Fork 0
has-writeup/Makefile

28 lines
963 B
Makefile
Raw Normal View History

2020-05-26 07:35:57 +00:00
.PHONY: all clean genreadme
DOCS_ALL=$(wildcard **/**/README.md)
2020-05-26 09:55:24 +00:00
WRITEUP_PDF=writeup.pdf
2020-05-26 07:35:57 +00:00
2020-05-26 09:55:24 +00:00
all: README.md $(WRITEUP_PDF)
2020-05-26 07:35:57 +00:00
clean:
2020-05-26 09:55:24 +00:00
$(RM) -r $(WRITEUP_PDF) build/
2020-05-26 07:35:57 +00:00
README.md: $(DOCS_ALL)
@echo "GEN README.md"
2020-05-26 07:36:40 +00:00
@(printf "# BLAHAJ Hack-a-Sat 2020 Writeups\n\n"; for file in $(DOCS_ALL); do \
2020-05-26 07:35:57 +00:00
printf -- "- [%s](%s)\n" "$$(dirname $$file)" "$$(dirname $$file)"; done) > README.md
2020-05-26 09:55:24 +00:00
2020-05-28 02:22:09 +00:00
$(WRITEUP_PDF): $(DOCS_ALL) fonts.tex misc.tex top.md
2020-05-26 09:55:24 +00:00
@echo "GEN writeup.md"
@mkdir build/ 2>/dev/null || true
@find . -mindepth 3 -iname '*.png' -exec cp {} build/ \;
2020-05-26 10:27:26 +00:00
@find . -mindepth 3 -iname '*.py' -exec cp {} build/ \;
2020-05-28 02:22:09 +00:00
@cp fonts.tex misc.tex jork.png build/
2020-05-26 10:39:51 +00:00
@for md in top.md $(DOCS_ALL); do cat $$md; printf "\n\n\\\\newpage\n\n"; done > build/writeup.md
2020-05-26 09:55:24 +00:00
@echo "PDF writeup.pdf"
2020-05-26 10:39:51 +00:00
@cd build && \
pandoc --filter pandoc-include-code --toc --toc-depth 1 -f markdown-implicit_figures \
-i writeup.md --pdf-engine=lualatex -o writeup.pdf
2020-05-26 09:55:24 +00:00
@cp build/writeup.pdf $@