# To build from a checkout:
#    make
#    make beastie-gray-tug2025.bbl
#    make
#    rm beastie-gray-tug2025.pdf
#    make
#
# This file is part of Beastie <https://purl.org/nxg/dist/beastie>
# SPDX-FileCopyrightText: 2025 Norman Gray <https://nxg.me.uk>
# SPDX-License-Identifier: BSD-2-Clause

FN=beastie-gray-tug2025
# the current bundle...
BUNDLE_NO=5
DIST=$(FN)-$(BUNDLE_NO)

#BIBTEX=bibtex
BIBTEX=../../../beastie

$(FN).pdf: $(FN).tex $(FN).bbl
	lualatex $(FN)

$(FN).bbl: $(FN).aux $(FN).bib
	$(BIBTEX) $(FN)

# a dummy .aux file, for running from a checkout
$(FN).aux:
	printf '\\citation{beebe93}\n\\bibdata{$(FN)}\n\\bibstyle{tugboat}\n' >$@

# bundle, for submission
bundle: $(FN).pdf
	if test -e $(DIST) -o -f $(DIST).zip; then \
	  echo "Bundle $(DIST) already exists!" >&2; false; else :; fi
	mkdir $(DIST)
	for e in tex pdf bib; do cp $(FN).$$e $(DIST); done
	cp Makefile $(DIST)
	hg log -r. --template '$(FN), submission version $(BUNDLE_NO), {date|rfc3339date} (revision {node|short})\n' >$(DIST)/README.txt
	zip -r $(DIST).zip $(DIST)
