| 1 |
TEXS = $(wildcard *.tex) |
| 2 |
MAIN = sample-use-sty |
| 3 |
|
| 4 |
.SILENT: distrib all |
| 5 |
|
| 6 |
|
| 7 |
all: $(MAIN).pdf software-biblatex.pdf |
| 8 |
|
| 9 |
biblatex-styles: stublist mkbiblatexstubs.sh |
| 10 |
bash mkbiblatexstubs.sh < stublist |
| 11 |
|
| 12 |
biblio.bib: ../swentry.org |
| 13 |
../bin/extract-bibtex.pl < $< > $@ |
| 14 |
|
| 15 |
swentries.tex: ../swentry.org |
| 16 |
../bin/export-org-to-latex $< |
| 17 |
../bin/extract-entries.pl < ../swentry.tex > $@ |
| 18 |
|
| 19 |
software-biblatex.pdf: software-biblatex.tex swentries.tex history.tex biblio.bib manual.bib |
| 20 |
pdflatex software-biblatex.tex > /dev/null |
| 21 |
bibtex software-biblatex |
| 22 |
pdflatex software-biblatex.tex > /dev/null |
| 23 |
pdflatex software-biblatex.tex > /dev/null |
| 24 |
|
| 25 |
sample-use-sty.pdf: biblio.bib sample-content.tex sample-use-sty.tex |
| 26 |
|
| 27 |
sample-use-sty.nohyperref.tex: sample-use-sty.tex |
| 28 |
grep -v hyperref $< > $@ |
| 29 |
|
| 30 |
sample-use-sty.nohyperref.pdf: biblio.bib sample-content.tex sample-use-sty.nohyperref.tex |
| 31 |
|
| 32 |
sample-use-sty.backref.pdf: biblio.bib sample-content.tex |
| 33 |
# test that backrefs work |
| 34 |
pdflatex -jobname sample-use-sty.backref "\PassOptionsToPackage{backref=true}{biblatex} \input{sample-use-sty.tex}" > /dev/null |
| 35 |
biber sample-use-sty.backref > /dev/null |
| 36 |
pdflatex -jobname sample-use-sty.backref "\PassOptionsToPackage{backref=true}{biblatex} \input{sample-use-sty.tex}" > /dev/null |
| 37 |
pdflatex -jobname sample-use-sty.backref "\PassOptionsToPackage{backref=true}{biblatex} \input{sample-use-sty.tex}" > /dev/null |
| 38 |
|
| 39 |
history.tex: |
| 40 |
git for-each-ref --format="\begin{release}{%(refname:short)}{%(taggerdate:short)} \item %(subject) \end{release}" refs/tags | grep bltx | tac > history.tex |
| 41 |
|
| 42 |
sample.tex : biblio.bib biblatex-styles |
| 43 |
|
| 44 |
%.pdf: %.tex |
| 45 |
ifeq (, $(shell PATH=$(PATH) which rubber)) |
| 46 |
echo "No rubber in $(PATH), falling back to basic pdflatex calls" |
| 47 |
pdflatex $< > /dev/null |
| 48 |
biber $* > /dev/null |
| 49 |
pdflatex $< > /dev/null |
| 50 |
pdflatex $< > /dev/null |
| 51 |
else |
| 52 |
rubber -m pdftex $< |
| 53 |
endif |
| 54 |
|
| 55 |
%.txt: %.pdf |
| 56 |
pdftotext $< |
| 57 |
|
| 58 |
test: sample-use-sty.txt sample-use-sty.nohyperref.txt sample-use-sty.backref.txt |
| 59 |
@echo "========================================" |
| 60 |
@echo "Running: Basic Functionality Tests" |
| 61 |
@echo "========================================" |
| 62 |
@echo "" |
| 63 |
@# check that we get the same results with and without hyperref |
| 64 |
@# normalize citations (hyperref changes [key] to [number], so we normalize both) |
| 65 |
@# and normalize whitespace to handle line wrapping differences |
| 66 |
@echo "Test: Hyperref vs Nohyperref Compatibility" |
| 67 |
@(sed 's/\[[^]]*\]/[CITATION]/g' sample-use-sty.txt | tr -s ' ' | sed 's/^[[:space:]]*//;s/[[:space:]]*$$//' > /tmp/test-with.txt && \ |
| 68 |
sed 's/\[[^]]*\]/[CITATION]/g' sample-use-sty.nohyperref.txt | tr -s ' ' | sed 's/^[[:space:]]*//;s/[[:space:]]*$$//' > /tmp/test-without.txt && \ |
| 69 |
diff /tmp/test-with.txt /tmp/test-without.txt > /dev/null 2>&1; \ |
| 70 |
if [ $$? -eq 0 ]; then \ |
| 71 |
printf " \033[0;32m✓ PASS\033[0m: Hyperref vs Nohyperref Compatibility\n"; \ |
| 72 |
else \ |
| 73 |
printf " \033[0;31m✗ FAIL\033[0m: Hyperref vs Nohyperref Compatibility\n"; \ |
| 74 |
echo " Differences found between hyperref and nohyperref outputs"; \ |
| 75 |
exit 1; \ |
| 76 |
fi) |
| 77 |
@echo "" |
| 78 |
@# check that backrefs work |
| 79 |
@echo "Test: Backref Functionality" |
| 80 |
@(grep "cited on page" sample-use-sty.backref.txt > /dev/null 2>&1; \ |
| 81 |
if [ $$? -eq 0 ]; then \ |
| 82 |
printf " \033[0;32m✓ PASS\033[0m: Backref Functionality\n"; \ |
| 83 |
else \ |
| 84 |
printf " \033[0;31m✗ FAIL\033[0m: Backref Functionality\n"; \ |
| 85 |
echo " Backref markers not found in output"; \ |
| 86 |
exit 1; \ |
| 87 |
fi) |
| 88 |
@echo "" |
| 89 |
@# run ultra-concise format tests |
| 90 |
@echo "========================================" |
| 91 |
@echo "Running: Ultra-Concise Format Tests" |
| 92 |
@echo "========================================" |
| 93 |
@cd tests && bash run-ultra-concise-tests.sh |
| 94 |
@echo "" |
| 95 |
@# run comprehensive bash test suite |
| 96 |
@echo "========================================" |
| 97 |
@echo "Running: Comprehensive Test Suite" |
| 98 |
@echo "========================================" |
| 99 |
@cd tests && bash run-all-tests.sh |
| 100 |
|
| 101 |
distrib: |
| 102 |
# remind maintainer to update version number in the documentation |
| 103 |
echo -n "Updated version number in software-biblatex.tex, date strings in software.* ? [y/N]" |
| 104 |
read ans; if [ ".$$ans" != ".y" ]; then echo "Please update this information and run make distrib again"; exit 1; fi |
| 105 |
# update history |
| 106 |
rm history.tex |
| 107 |
make software-biblatex.pdf |
| 108 |
make showcase-crossref.pdf |
| 109 |
rm -rf biblatex-software |
| 110 |
mkdir biblatex-software |
| 111 |
# copy all tracked files except tests/ directory and HOWTO-RELEASE.md |
| 112 |
# use -L to follow symlinks (converts Changes symlink to plain file) |
| 113 |
git ls-files | grep -v "^tests/" | grep -v "^HOWTO-RELEASE.md$$" | while read file; do \ |
| 114 |
if [ -e "$$file" ]; then \ |
| 115 |
mkdir -p biblatex-software/$$(dirname "$$file" 2>/dev/null || echo .); \ |
| 116 |
if [ -d "$$file" ]; then \ |
| 117 |
cp -rL "$$file" biblatex-software/; \ |
| 118 |
else \ |
| 119 |
cp -L "$$file" biblatex-software/"$$file"; \ |
| 120 |
fi; \ |
| 121 |
fi; \ |
| 122 |
done |
| 123 |
# explicitly include showcase-crossref.pdf if it exists (even if not yet tracked) |
| 124 |
if [ -f showcase-crossref.pdf ]; then \ |
| 125 |
cp -L showcase-crossref.pdf biblatex-software/; \ |
| 126 |
fi |
| 127 |
tar -czvf biblatex-software.tar.gz biblatex-software |
| 128 |
|
| 129 |
.PHONY: preserve restore clean distclean test |
| 130 |
|
| 131 |
clean: |
| 132 |
# preserve PDF files under version control |
| 133 |
mkdir -p .save |
| 134 |
mv `git ls-files | grep pdf` .save |
| 135 |
# clean up the rest |
| 136 |
make cleaninner |
| 137 |
# restore PDF files under version control |
| 138 |
mv .save/*.pdf . |
| 139 |
rmdir .save |
| 140 |
|
| 141 |
cleaninner: $(patsubst %,%/clean,$(TEXS)) |
| 142 |
rm -f *+sw.bbx *+sw.dbx *+sw.cbx *+sw.lbx *~ *.txt sample-use-sty.backref.* sample-use-sty.nohyperref.* |
| 143 |
|
| 144 |
%/clean: |
| 145 |
if [ -f $* ]; then rubber -m pdftex --clean $* ; fi |
| 146 |
|
| 147 |
distclean: clean |