1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
|
# BSTSTYLES are the standard styles that we distribute
BSTSTYLES=plainurl.bst unsrturl.bst alphaurl.bst abbrvurl.bst
# TESTSTYLES are a couple of extra ones that we explicitly test
TESTSTYLES=mlaurl.bst
MAINTAINER_FILES= Makefile configure
GENERATED=urlbst urlbst.tex urlbst.pdf urlbst.html README VERSION $(BSTSTYLES)
# distribute generated files
# ...plus the configure files
# ...plus the configured files
DISTRIBS=$(GENERATED) \
configure configure.ac \
urlbst.in urlbst.bib urlbst.tex.in urlbst.html.in Makefile.in
prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
DIST=urlbst-@PACKAGE_VERSION@
# On OS X, the following avoids extended attributes being included
TAR=COPYFILE_DISABLE=1 tar
#TAR=tar
### Implicit rules
# Don't include --inlinelinks when generating %url.bst here, as we
# do want the links visible when generating the documentation, and it's
# probably abetter default in any case.
%url.bst: urlbst
export BSTINPUTS=test: ; \
if test -z "`kpsewhich ${@:url.bst=.bst}`"; then \
echo "Can't locate ${@:url.bst=.bst}"; \
else \
./urlbst --eprint --doi --pubmed --hyperref `kpsewhich ${@:url.bst=.bst}` $@; \
fi
# Incomplete TeX support
%.ps: %.dvi
dvips -o $@ $<
%.bbl: %.tex plainurl.bst
pdflatex $<
if ! test -f $@ || grep -q 'Citation.*undefined' ${<:.tex=.log}; then \
bibtex ${<:.tex=}; \
pdflatex $<; \
rm ${<:.tex=.pdf}; \
fi
%.pdf: %.tex %.bbl
pdflatex $<
%.dvi: %.tex %.bbl
latex $<
%.gz: %
gzip --best -f $<
.PRECIOUS: .bbl
### Targets start here
all: urlbst
dist: $(DIST).tar.gz $(DIST).zip
$(DIST).tar: $(DIST)/urlbst.in
$(TAR) cf $@ $(DIST)
$(DIST).zip: $(DIST)/urlbst.in
zip -r $@ $(DIST)
$(DIST)/urlbst.in: $(DISTRIBS)
if test -d $(DIST); then rm -Rf $(DIST); fi && mkdir $(DIST)
cp $(DISTRIBS) $(DIST)
# The following appears not to work.
# Perhaps it has to be installed, rather than run from the .app bundle
# (but it doesn't give you any choice about where you install it,
# and I'm not going to put it in a system location)
#PLATYPUS=/Data/LocalApplications/Platypus-4.0/Platypus.app/Contents/Resources/platypus
PLATYPUS=/usr/local/bin/platypus
urlbst.app: urlbst
rm -Rf urlbst.app
$(PLATYPUS) -a urlbst -c "$$PWD/urlbst" -o 'Progress Bar' \
-p /usr/bin/perl -V @PACKAGE_VERSION@ -u Norman\ Gray -I uk.me.nxg.urlbst \
-D -R -N CALLED_FROM_PLATYPUS=1 $$PWD/urlbst.app
urlbst-app.zip: urlbst.app
zip -r urlbst-app.zip urlbst.app
#$(DIST).tar: $(DISTRIBS)
# sed '1s,.*,#! /usr/bin/env perl,' urlbst >tmp && mv tmp urlbst \
# && chmod +x urlbst
# rm -Rf $(DIST) $(DIST).tar
# mkdir $(DIST)
# cp $(DISTRIBS) $(DIST)
# tar cf $@ $(DIST)
# rm -Rf $(DIST)
urlbst: urlbst.in config.status
./config.status urlbst
urlbst.tex: urlbst.tex.in config.status
./config.status urlbst.tex
urlbst.html: urlbst.html.in config.status
./config.status urlbst.html
Makefile: Makefile.in config.status
./config.status Makefile
configure: configure.ac
autoconf
config.status: configure
./configure
# Version stamp file, included in the distribution for convenience,
# so it's easy to see which version it is has been unpacked at CTAN.
VERSION:
echo $(DIST) >VERSION
# The README is just a plain-text version of urlbst.html
README: urlbst.html prepare-roff.sed
xsltproc html2roff.xslt urlbst.html \
| sed -f prepare-roff.sed \
| nroff -Tutf8 -ms \
| sed '/XXXEND/,$$d' >README
# Write a roff file -- there comes a point where a string of -e ''
# commands is more confusing than is safe
# (plus trying to get '$a\' into that is mind-bending).
prepare-roff.sed:
rm -f $@
{ echo '$$a\'; echo '\'; echo 'XXXEND'; echo '/^ *$$/d'; echo 's/^ *//'; echo 's/^\.$$/\&./'; echo 's/^\. /\&. /'; } >$@
# Very simple install target -- hardly worth bothering, really....
install: urlbst
cp urlbst $(bindir)
# Very simple test target -- just check that we don't bomb converting
# the standard styles
test: $(BSTSTYLES) $(TESTSTYLES)
for f in $(BSTSTYLES) $(TESTSTYLES); do \
ROOT=`echo $$f|sed s/\.bst$$//`; \
printf '\\relax\n' > test-$$ROOT.aux; \
printf '\\citation{*}\n' >> test-$$ROOT.aux; \
printf '\\bibdata{urlbst}\n' >> test-$$ROOT.aux; \
printf '\\bibstyle{'"$$ROOT"'}\n' >> test-$$ROOT.aux; \
bibtex test-$$ROOT; \
done
# Brute-force test target, which finds all the system .bst files,
# converts them, and runs BibTeX on them. It doesn't test the results
# in any way -- you have to do that by eye.
#
# No, this is a hopelessly blunderbus approach. And in any case the
# 'locate *.bst' doesn't work. At least the following would find only things
# on the .bst search path.
# BSTPATH=`kpsepath bst`
# for d in `IFS=:; echo $BSTPATH`; do
# dd=`expr "$d" : '!*\(.*[^/]\)/*$'`
# echo dd=$dd
# test -d "$dd" && find $dd -name \*.bst
# done
test-all:
printf '\\relax\n'>test-all.mainaux
sed -n 's/^.*{\(test:.*\),/\\citation{\1}/p' urlbst.bib>>test-all.mainaux
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 test-all.mainaux $$TF;printf '\\bibdata{urlbst}\n'>>$$TF; printf '\\bibstyle{$$T}\n'>>$$TF; else rm $$T.bst; fi done
for f in `ls test-*.aux|sed s+.aux++`;do bibtex $$f;done
rm test-all.mainaux
# Tarball for unpacking in the webpage distribution directory
webpage-tarball.tar: urlbst.pdf urlbst.html $(DIST).tar.gz $(DIST).zip
mkdir webpage-tarball
cp urlbst.pdf $(DIST).tar.gz $(DIST).zip webpage-tarball
cp urlbst.html webpage-tarball/index.html
cd webpage-tarball; $(TAR) cf ../webpage-tarball.tar *
rm -Rf webpage-tarball
tidy:
rm -f webpage-tarball.tar
rm -f *~ test-*
rm -f *.aux *.bbl *.log *.blg *.dvi *.pdf
rm -Rf urlbst.app
clean: tidy
rm -f *.bst
rm -Rf config.status autom4te.cache prepare-roff.sed
rm -Rf $(DIST).tar $(DIST).tar.gz $(DIST).zip $(DIST)
rm -f $(GENERATED)
maintainer-clean: clean
rm -f $(MAINTAINER_FILES)
|