# makefile to process RTF documents using RefDB citations/bibliographies

# the following section contains variable settings generated by
# the refdbnd script. Feel free to change the bibliography style
# if you have to resubmit your paper! Change the other values with
# care

# the switch for processing a doctype document with refdb. Available are
# 'db31' (all DocBook SGML versions), 'db31x' (DocBook XML),
# 'db50x' (DocBook XML V5), 'teix' (TEI P4), and 'tei5x' (TEI P5)
doctypeswitch = <doctypeswitch>

# the root element of your document. This is usually one of 'set', 'book',
# or 'article' for all DocBook variants, and 'TEI.2' for TEI
pubtype = <pubtype>

# the base name of your document
basename = <basename>

# the extension of your document
extension = <extension>

# the bibliography style to be used
stylename = <style>

# the character encoding to be used
encoding = <encoding>

# the RefDB-generated CSS file
cssfile=${stylename:.=}.css

# the CSS file the (x)html output should link to
customcssfile=<cssfile>

# the database that contains the references
database = <database>

# the script that does the actual document transformation to the output formats
transformscript = <transformscript>

# the command line option to invoke the appropriate bibliography style
stylearg = -S $(stylename)

all: $(basename).refdb.rtf

bib: $(basename).bib.$(extension)

clean:
	rm -f *.err
	rm -f $(basename).bib.$(extension)
	rm -f $(basename).id.xml
	rm -f $(basename).refdb.rtf

$(basename).refdb.rtf: $(basename).$(extension) $(basename).bib.$(extension)
	$(transformscript) -b $(basename).bib.$(extension) $(basename).$(extension) > $(basename).refdb.rtf

$(basename).bib.$(extension): $(basename).$(extension)
	runbib $(fodriveropt) $(htmldriveropt) $(xhtmldriveropt) -d $(database) -G $(customcssfile) $(stylearg) -t $(doctypeswitch) -E $(encoding) $(basename).$(extension)
