| 1 |
# Makefile for urlbst |
| 2 |
|
| 3 |
# BSTSTYLES are the standard styles that we distribute |
| 4 |
BSTSTYLES=plainurl.bst unsrturl.bst alphaurl.bst abbrvurl.bst |
| 5 |
# TESTSTYLES are a couple of extra ones that we explicitly test |
| 6 |
TESTSTYLES=mlaurl.bst amsalphaurl.bst |
| 7 |
|
| 8 |
MAINTAINER_FILES= Makefile configure |
| 9 |
GENERATED=urlbst urlbst.tex urlbst.pdf urlbst.html README VERSION $(BSTSTYLES) |
| 10 |
# distribute generated files |
| 11 |
# ...plus the configure files |
| 12 |
# ...plus the configured files |
| 13 |
DISTRIBS=$(GENERATED) \ |
| 14 |
configure configure.ac \ |
| 15 |
urlbst.in urlbst.bib Makefile.in \ |
| 16 |
LICENCE-gpl-2.0.txt LICENCE-lppl.txt |
| 17 |
|
| 18 |
|
| 19 |
prefix=@prefix@ |
| 20 |
exec_prefix=@exec_prefix@ |
| 21 |
bindir=@bindir@ |
| 22 |
DIST=urlbst-@PACKAGE_VERSION@ |
| 23 |
|
| 24 |
# On OS X, the following avoids extended attributes being included |
| 25 |
TAR=COPYFILE_DISABLE=1 tar |
| 26 |
#TAR=tar |
| 27 |
|
| 28 |
### Implicit rules |
| 29 |
|
| 30 |
# Don't include --inlinelinks when generating %url.bst here, as we |
| 31 |
# do want the links visible when generating the documentation, and it's |
| 32 |
# probably abetter default in any case. |
| 33 |
%url.bst: urlbst |
| 34 |
export BSTINPUTS=test: ; \ |
| 35 |
if test -z "`kpsewhich ${@:url.bst=.bst}`"; then \ |
| 36 |
echo "Can't locate ${@:url.bst=.bst}"; \ |
| 37 |
else \ |
| 38 |
./urlbst --eprint --doi --pubmed --hyperref `kpsewhich ${@:url.bst=.bst}` $@; \ |
| 39 |
fi |
| 40 |
|
| 41 |
# Incomplete TeX support |
| 42 |
%.ps: %.dvi |
| 43 |
dvips -o $@ $< |
| 44 |
%.bbl: %.tex plainurl.bst |
| 45 |
pdflatex $< |
| 46 |
if ! test -f $@ || grep -q 'Citation.*undefined' ${<:.tex=.log}; then \ |
| 47 |
bibtex ${<:.tex=}; \ |
| 48 |
pdflatex $<; \ |
| 49 |
rm ${<:.tex=.pdf}; \ |
| 50 |
fi |
| 51 |
%.pdf: %.tex %.bbl |
| 52 |
pdflatex $< |
| 53 |
%.dvi: %.tex %.bbl |
| 54 |
latex $< |
| 55 |
%.gz: % |
| 56 |
gzip --best -f $< |
| 57 |
|
| 58 |
.PRECIOUS: .bbl |
| 59 |
|
| 60 |
### Targets start here |
| 61 |
|
| 62 |
all: urlbst |
| 63 |
|
| 64 |
dist: $(DIST).tar.gz $(DIST).zip |
| 65 |
|
| 66 |
$(DIST).tar: $(DIST)/urlbst.in |
| 67 |
$(TAR) cf $@ $(DIST) |
| 68 |
|
| 69 |
$(DIST).zip: $(DIST)/urlbst.in |
| 70 |
zip -r $@ $(DIST) |
| 71 |
|
| 72 |
$(DIST)/urlbst.in: $(DISTRIBS) |
| 73 |
if test -d $(DIST); then rm -Rf $(DIST); fi && mkdir $(DIST) |
| 74 |
cp $(DISTRIBS) $(DIST) |
| 75 |
|
| 76 |
urlbst: urlbst.in config.status |
| 77 |
./config.status urlbst |
| 78 |
|
| 79 |
urlbst.tex: urlbst.tex.in hg.sed release-notes.tex |
| 80 |
sed -f hg.sed -e '/include:release-notes/r release-notes.tex' urlbst.tex.in >$@ |
| 81 |
|
| 82 |
urlbst.html: urlbst.html.in release-notes.html hg.sed |
| 83 |
sed -f hg.sed -e '/include:release-notes/r release-notes.html' urlbst.html.in >$@ |
| 84 |
|
| 85 |
Makefile: Makefile.in config.status |
| 86 |
./config.status Makefile |
| 87 |
|
| 88 |
README: README.md hg.sed |
| 89 |
rm -f $@ |
| 90 |
sed -f hg.sed README.md >$@ |
| 91 |
|
| 92 |
configure: configure.ac |
| 93 |
autoconf |
| 94 |
|
| 95 |
config.status: configure |
| 96 |
./configure |
| 97 |
|
| 98 |
hg.sed: Makefile .hg |
| 99 |
rm -f $@ |
| 100 |
{ echo 's,@PACKAGE_VERSION\@,@PACKAGE_VERSION@,g'; \ |
| 101 |
echo 's,@RELEASEDATE\@,@RELEASEDATE@,g'; \ |
| 102 |
echo 's/@COPYRIGHTYEARS\@/@COPYRIGHTYEARS@/'; \ |
| 103 |
echo 's,@REPOURL\@,@REPOURL@,g'; \ |
| 104 |
echo 's,@CTANURL\@,@CTANURL@,g'; \ |
| 105 |
hg parent --template 's/@HGIDENT\@/{node|short} ({latesttag}+{latesttagdistance}), {date|isodate}/\n'; \ |
| 106 |
} >hg.sed |
| 107 |
|
| 108 |
release-notes.tex: release-notes.html |
| 109 |
rm -f $@ |
| 110 |
xsltproc tools/release-notes-to-latex.xslt release-notes.html >[email protected] && mv [email protected] $@ |
| 111 |
|
| 112 |
# Version stamp file, included in the distribution for convenience, |
| 113 |
# so it's easy to see which version it is has been unpacked at CTAN. |
| 114 |
VERSION: Makefile.in |
| 115 |
echo $(DIST) >VERSION |
| 116 |
|
| 117 |
# Very simple install target -- hardly worth bothering, really.... |
| 118 |
install: urlbst |
| 119 |
cp urlbst $(bindir) |
| 120 |
|
| 121 |
# Very simple test target -- just check that we don't bomb converting |
| 122 |
# the standard styles |
| 123 |
check: $(BSTSTYLES) $(TESTSTYLES) |
| 124 |
for f in $(BSTSTYLES) $(TESTSTYLES); do \ |
| 125 |
ROOT=`echo $$f|sed s/\.bst$$//`; \ |
| 126 |
{ printf '\\relax\n'; \ |
| 127 |
sed -n 's/^.*\(test:[a-z0-9-]*\).*/\\citation{\1}/p' urlbst.bib; \ |
| 128 |
printf '\\bibdata{urlbst}\n'; \ |
| 129 |
printf '\\bibstyle{'"$$ROOT"'}\n'; } >test-$$ROOT.aux; \ |
| 130 |
echo "*** testing $$f"; \ |
| 131 |
bibtex test-$$ROOT; \ |
| 132 |
done |
| 133 |
|
| 134 |
# Brute-force test target, which finds all the system .bst files, |
| 135 |
# converts them, and runs BibTeX on them. It doesn't test the results |
| 136 |
# in any way -- you have to do that by eye. |
| 137 |
# |
| 138 |
# No, this is a hopelessly blunderbus approach. And in any case the |
| 139 |
# 'locate *.bst' doesn't work. At least the following would find only things |
| 140 |
# on the .bst search path. |
| 141 |
# BSTPATH=`kpsepath bst` |
| 142 |
# for d in `IFS=:; echo $BSTPATH`; do |
| 143 |
# dd=`expr "$d" : '!*\(.*[^/]\)/*$'` |
| 144 |
# echo dd=$dd |
| 145 |
# test -d "$dd" && find $dd -name \*.bst |
| 146 |
# done |
| 147 |
check-all: |
| 148 |
printf '\\relax\n'>check-all.mainaux |
| 149 |
sed -n 's/^.*{\(test:.*\),/\\citation{\1}/p' urlbst.bib>>check-all.mainaux |
| 150 |
for f in `locate '*.bst' | grep -v norman`; do T=`echo $$f|sed 's+.*/\(.*\)\.bst+\1url+'`;perl urlbst $$f $$T.bst; if test $$? = 0; then TF=test-$$T.aux; cp check-all.mainaux $$TF;printf '\\bibdata{urlbst}\n'>>$$TF; printf '\\bibstyle{$$T}\n'>>$$TF; else rm $$T.bst; fi done |
| 151 |
for f in `ls test-*.aux|sed s+.aux++`;do bibtex $$f;done |
| 152 |
rm check-all.mainaux |
| 153 |
|
| 154 |
# Tarball for unpacking in the webpage distribution directory |
| 155 |
webpage-tarball.tar: urlbst.pdf urlbst.html $(DIST).tar.gz $(DIST).zip |
| 156 |
mkdir webpage-tarball |
| 157 |
cp urlbst.pdf $(DIST).tar.gz $(DIST).zip webpage-tarball |
| 158 |
cp urlbst.html webpage-tarball/index.html |
| 159 |
cd webpage-tarball; $(TAR) cf ../webpage-tarball.tar * |
| 160 |
rm -Rf webpage-tarball |
| 161 |
|
| 162 |
tidy: |
| 163 |
rm -f webpage-tarball.tar |
| 164 |
rm -f *~ test-* |
| 165 |
rm -f *.aux *.bbl *.log *.blg *.dvi *.pdf |
| 166 |
rm -Rf urlbst.app |
| 167 |
|
| 168 |
clean: tidy |
| 169 |
rm -f *.bst |
| 170 |
rm -Rf config.status autom4te.cache prepare-roff.sed |
| 171 |
rm -Rf $(DIST).tar $(DIST).tar.gz $(DIST).zip $(DIST) |
| 172 |
rm -f $(GENERATED) |
| 173 |
|
| 174 |
maintainer-clean: clean |
| 175 |
rm -f $(MAINTAINER_FILES) |