NAME = icite SHELL = bash PWD = $(shell pwd) VERS = $(shell ltxfileinfo -v $(NAME).dtx|sed -e 's/^v//') LOCAL = $(shell kpsewhich --var-value TEXMFLOCAL) UTREE = $(shell kpsewhich --var-value TEXMFHOME) exts := md bib ins dtx html extsi := tex findopts := $(foreach ext,$(exts),-or -iname "*.$(ext)") findoptsi := $(foreach ext,$(extsi),-or -iname "*.$(ext)") all: $(NAME).pdf # test -e README.md || exit 0 $(NAME).pdf: $(NAME).dtx lualatex --shell-escape --recorder --interaction=batchmode $(NAME).dtx >/dev/null biber $(NAME) >/dev/null lualatex --shell-escape --recorder --interaction=batchmode $(NAME).dtx >/dev/null if [ -f $(NAME).glo ]; then makeindex -q -s gglo.ist -o $(NAME).gls $(NAME).glo; fi if [ -f $(NAME).idx ]; then makeindex -q -s gind.ist -o $(NAME).ind $(NAME).idx; fi if [ -f loccit.idx ]; then texindy -M icite.xdy loccit.idx >/dev/null; fi if [ -f primary.idx ]; then texindy -M icite.xdy primary.idx >/dev/null; fi lualatex --shell-escape --recorder --interaction=nonstopmode $(NAME).dtx > /dev/null lualatex --shell-escape --recorder --interaction=nonstopmode $(NAME).dtx > /dev/null if [ ! -d $(PWD)/TMP ]; then mkdir $(PWD)/TMP; fi cp $(PWD)/samples/*.bib $(PWD)/TMP lualatex --output-dir=$(PWD)/TMP --shell-escape samples/icite-biblatex.tex lualatex --output-dir=$(PWD)/TMP --shell-escape samples/icite-biblatex.tex texindy $(PWD)/TMP/pr-sources.idx biber $(PWD)/TMP/icite-biblatex lualatex --output-dir=$(PWD)/TMP --shell-escape samples/icite-biblatex.tex lualatex --output-dir=$(PWD)/TMP --shell-escape samples/icite-biblatex.tex lualatex --output-dir=$(PWD)/TMP --shell-escape samples/icite-nobiblatex.tex lualatex --output-dir=$(PWD)/TMP --shell-escape samples/icite-nobiblatex.tex texindy $(PWD)/TMP/pr-sources.idx lualatex --output-dir=$(PWD)/TMP --shell-escape samples/icite-nobiblatex.tex lualatex --output-dir=$(PWD)/TMP --shell-escape samples/icite-nobiblatex.tex mv TMP/*.pdf samples/ samples: if [ ! -d $(PWD)/TMP ]; then mkdir $(PWD)/TMP; fi cp $(PWD)/samples/*.bib $(PWD)/TMP lualatex --output-dir=$(PWD)/TMP --shell-escape samples/icite-biblatex.tex lualatex --output-dir=$(PWD)/TMP --shell-escape samples/icite-biblatex.tex texindy $(PWD)/TMP/pr-sources.idx biber $(PWD)/TMP/icite-biblatex lualatex --output-dir=$(PWD)/TMP --shell-escape samples/icite-biblatex.tex lualatex --output-dir=$(PWD)/TMP --shell-escape samples/icite-biblatex.tex lualatex --output-dir=$(PWD)/TMP --shell-escape samples/icite-nobiblatex.tex lualatex --output-dir=$(PWD)/TMP --shell-escape samples/icite-nobiblatex.tex texindy $(PWD)/TMP/pr-sources.idx lualatex --output-dir=$(PWD)/TMP --shell-escape samples/icite-nobiblatex.tex lualatex --output-dir=$(PWD)/TMP --shell-escape samples/icite-nobiblatex.tex mv TMP/*.pdf samples/ lualatex: lualatex --shell-escape --recorder --interaction=batchmode $(NAME).dtx >/dev/null clean: lualatex rm -f $(NAME).bib $(PWD)/TMP/*.bib rm -rf .backup find -iname "*~" -or -iname "*.pdf" | xargs rm -rf find ./* -type f -iname "Makefile" $(findopts) > ls-R find ./* -type f -iname "*.tex" | grep '/samples/' >> ls-R rsync -avPr --files-from=ls-R . .backup rm -rf * cp -p -r .backup/* . rm -rf .backup pandoc -s README.md -o about.html distclean: clean uninst inst: uninst all mkdir -p $(UTREE)/{tex,source,doc}/latex/$(NAME) cp $(NAME).dtx $(UTREE)/source/latex/$(NAME) cp $(NAME).sty $(UTREE)/tex/latex/$(NAME) cp $(NAME).pdf $(UTREE)/doc/latex/$(NAME) local: uninst lualatex $(NAME).ins mkdir -p $(UTREE)/{tex,source,doc}/latex/$(NAME) cp $(NAME).sty $(UTREE)/tex/latex/$(NAME) uninst: rm -rf $(UTREE)/{tex,source,doc}/latex/$(NAME) install: all sudo mkdir -p $(LOCAL)/{tex,source,doc}/latex/$(NAME) sudo cp $(NAME).dtx $(LOCAL)/source/latex/$(NAME) sudo cp $(NAME).sty $(LOCAL)/tex/latex/$(NAME) sudo cp $(NAME).pdf $(LOCAL)/doc/latex/$(NAME) uninstall: rm -rf $(LOCAL)/{tex,source,doc}/latex/$(NAME) zip: all ln -sf . $(NAME) zip -Drq $(PWD)/$(NAME)-$(VERS).zip $(NAME)/{samples,README.md,$(NAME).{pdf,dtx,ins}} rm $(NAME) package: distclean all mkdir $(NAME)/ cp Makefile README.md $(NAME).{dtx,ins,pdf} $(NAME)/ cp -r samples/ $(NAME)/ mkdir -p tex/latex/$(NAME)/ cp $(NAME).sty tex/latex/$(NAME)/ mkdir -p doc/latex/$(NAME)/ cp $(NAME).pdf doc/latex/$(NAME)/ cp -r samples/ doc/latex/$(NAME)/ mkdir -p source/latex/$(NAME)/ cp Makefile README.md $(NAME).{dtx,ins} source/latex/$(NAME)/ zip -r $(NAME).tds.zip tex doc source rm -rf tex/ source/ doc/ tar czf $(NAME)-$(VERS).tar.gz $(NAME).tds.zip $(NAME)/ rm -rf $(NAME)/ .PHONY: all lualatex clean distclean inst local uninst install uninstall zip package samples