@@ 36,12 36,16 @@ draft: $(paper).pdf
clean:
rm -rf $(paper).{pdf,html,odt,docx}
-$(refs): bib.keys $(library)
+$(refs): bib.keys $(library) extractbib.py
ifeq ($(library),)
@echo "No library specified, skipping generation of new bibliography"
else
- $(python) extractbib.py bib.keys $(library) $(refs)
+# if the content of bib.keys hasn't changed and the bibtex output exists, then
+# don't bother running the extraction program; otherwise
+# update the md5sum and extract
+ (md5sum --check --status bib.keys.md5 && [ -f $(refs) ] ) || \
+ (md5sum bib.keys > bib.keys.md5 && $(python) extractbib.py bib.keys $(library) $(refs))
endif
-bib.keys: $(paper).md $(library)
- egrep '@[-:_a-zA-Z0-9.]*' $(paper).md -oh --color=never | sort -u | sed 's/@//g' > bib.keys
+bib.keys: $(paper).md $(library) $(deps)
+ egrep '@[-:_a-zA-Z0-9.]*' $(paper).md $(deps) -oh --color=never | sort -u | sed 's/@//g' > bib.keys