summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile28
1 files changed, 21 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index d1e54aa..565aea4 100644
--- a/Makefile
+++ b/Makefile
@@ -14,6 +14,7 @@ SCRAPBOOK_MARKDOWN := scrapbook.md
DISSERTATION_LATEX := dissertation.latex
DISSERTATION_LATEX_NO_REFERENCES := dissertation-no-references.latex
DISSERTATION_WORDCOUNT_FILE := .dissertation.wc
+DISSERTATION_NO_REFERENCES_WORDCOUNT_FILE := .dissertation-no-references.wc
DISSERTATION_PDF := dissertation.pdf
DISSERTATION_PDF_NO_REFERENCES := dissertation-no-references.pdf
LOG_PDF := log.pdf
@@ -21,6 +22,13 @@ SCRAPBOOK_PDF := scrapbook.pdf
chapter_markdown_file = chapter$(chapter_index).md
chapter_wordcount_file = .chapter$(chapter_index).wc
+chapter_wordcount = $(shell cat $(chapter_wordcount_file))
+chapter_wordcounts = $(foreach chapter_index,$(CHAPTER_INDICES),$(chapter_wordcount))
+chapter_wordcounts_sum = $$(( $(addsuffix " +",$(chapter_wordcounts)) 0 ))
+dissertation_wordcount = $(shell cat $(DISSERTATION_WORDCOUNT_FILE))
+dissertation_no_references_wordcount = $(shell cat $(DISSERTATION_NO_REFERENCES_WORDCOUNT_FILE))
+footnotes_wordcount = $$(( $(dissertation_no_references_wordcount) - $(chapter_wordcounts_sum) ))
+references_wordcount = $$(( $(dissertation_wordcount) - $(dissertation_no_references_wordcount) ))
chapter_title = $(shell head -n 1 $(chapter_markdown_file) | cut -c4-)
all: log scrapbook dissertation wordcount
@@ -100,21 +108,27 @@ $(DISSERTATION_MARKDOWN): $(DISSERTATION_FRONTMATTER) $(CHAPTER_MARKDOWN_FILES)
.SILENT: wordcount
.PHONY: wordcount
-wordcount: $(CHAPTER_WORDCOUNT_FILES) $(DISSERTATION_WORDCOUNT_FILE)
+wordcount: $(CHAPTER_WORDCOUNT_FILES) $(DISSERTATION_WORDCOUNT_FILE) $(DISSERTATION_NO_REFERENCES_WORDCOUNT_FILE)
$(foreach chapter_index,$(CHAPTER_INDICES), \
- echo "$(chapter_title): $(shell cat $(chapter_wordcount_file))"; \
+ echo "$(chapter_title): $(chapter_wordcount)"; \
)
- echo "Footnotes: ???"
- echo "References: ???"
- echo "Total: $(shell cat $(DISSERTATION_WORDCOUNT_FILE))"
+ echo "Footnotes: $(footnotes_wordcount)"
+ echo "--------------------------------"
+ echo "Total: $(dissertation_no_references_wordcount)"
+ echo "--------------------------------"
+ echo "(References: $(references_wordcount))"
$(CHAPTER_WORDCOUNT_FILE_PATTERN): $(CHAPTER_MARKDOWN_FILE_PATTERN) $(WORDCOUNT_FILTER)
pandoc --lua-filter $(WORDCOUNT_FILTER) $< > $@
-$(DISSERTATION_WORDCOUNT_FILE): $(DISSERTATION_PDF_NO_REFERENCES) $(WORDCOUNT_FILTER) $(DISSERTATION_MARKDOWN)
- echo "$(shell pdfgrep -o '\w+' $(DISSERTATION_PDF_NO_REFERENCES) | wc -w) ($(shell pandoc --lua-filter $(WORDCOUNT_FILTER) $(DISSERTATION_MARKDOWN)) + footnotes)" \
+$(DISSERTATION_WORDCOUNT_FILE): $(DISSERTATION_PDF)
+ pdfgrep -o '\w+' $(DISSERTATION_PDF) | wc -w \
> $(DISSERTATION_WORDCOUNT_FILE)
+$(DISSERTATION_NO_REFERENCES_WORDCOUNT_FILE): $(DISSERTATION_PDF_NO_REFERENCES)
+ pdfgrep -o '\w+' $(DISSERTATION_PDF_NO_REFERENCES) | wc -w \
+ > $(DISSERTATION_NO_REFERENCES_WORDCOUNT_FILE)
+
$(DISSERTATION_PDF_NO_REFERENCES): $(DISSERTATION_LATEX_NO_REFERENCES)
pandoc \
--standalone \