diff options
Diffstat (limited to 'macros/latex/contrib/synthslant/Makefile')
-rw-r--r-- | macros/latex/contrib/synthslant/Makefile | 133 |
1 files changed, 81 insertions, 52 deletions
diff --git a/macros/latex/contrib/synthslant/Makefile b/macros/latex/contrib/synthslant/Makefile index d8de419230..8ef77a6982 100644 --- a/macros/latex/contrib/synthslant/Makefile +++ b/macros/latex/contrib/synthslant/Makefile @@ -19,8 +19,9 @@ DVIPS := dvips DVIPS_FLAGS := -d1 # debug \special{} -LATEX := /usr/bin/env max_print_line=2147483647 pdflatex -LATEX_FLAGS := -file-line-error -halt-on-error -interaction=nonstopmode +LATEX_PROPER := pdflatex +LATEX := /usr/bin/env max_print_line=2147483647 $(LATEX_PROPER) +LATEX_FLAGS := -file-line-error -halt-on-error -interaction=nonstopmode -output-directory=. LATEX_RERUN_TRIGGER := '^Package rerunfilecheck Warning: File [^ ]* has changed' LATEX_WARNING := '^LaTeX (|[A-Za-z0-9_]* )Warning:' @@ -33,18 +34,9 @@ METAPOST := mpost METAPOST_FLAGS := -file-line-error -interaction=nonstopmode -tex=latex -SPELLCHECK := aspell -SPELLCHECK_FLAGS := \ - --add-tex-command='citenum p' --add-tex-command='code p' \ - --add-tex-command='Cref p' --add-tex-command='cref p' \ - --add-tex-command='cs p' \ - --add-tex-command='DescribeEnv p' --add-tex-command='DescribeMacro p' \ - --add-tex-command='marg p' --add-tex-command='meta p' \ - --add-tex-command='oarg p' \ - --lang=en_US --mode=tex - - -SOURCE_FILES := LICENSE Makefile synthslant.dtx synthslant.ins +PROJECT_NAME := synthslant +SOURCE_FILES := LICENSE Makefile README.md synthslant.dtx synthslant.ins +DOCUMENTATION_FILES := synthslant-gauge.pdf synthslant.pdf @@ -57,7 +49,7 @@ sty: synthslant.sty .PHONY: pdf -pdf: doc gauge +pdf: doc gauge test .PHONY: doc @@ -68,19 +60,42 @@ doc: synthslant.pdf gauge: synthslant-gauge.pdf -.PHONY: cpio -cpio: - cd ..; \ - echo $(addprefix synthslant/,$(SOURCE_FILES)) | \ - cpio -o | \ - gzip > "synthslant-$$(date +%Y-%m-%d).cpio.gz" +.PHONY: test +test: synthslant-minimal-test.pdf + + +export TEMPORARY_DIRECTORY + + +.PHONY: dist +dist: + $(eval TEMPORARY_DIRECTORY := $(shell mktemp -d)) + trap '$(RM) -r $(TEMPORARY_DIRECTORY); exit 1' HUP INT QUIT TERM; $(MAKE) __dist + $(RM) -r $(TEMPORARY_DIRECTORY) + + +.PHONY: __dist +__dist: LATEX_FLAGS += -interaction=batchmode +__dist: $(DOCUMENTATION_FILES) + test -d '$(TEMPORARY_DIRECTORY)' + test -w '$(TEMPORARY_DIRECTORY)' + mkdir $(TEMPORARY_DIRECTORY)/$(PROJECT_NAME) + cp $(SOURCE_FILES) $(TEMPORARY_DIRECTORY)/$(PROJECT_NAME) + mkdir $(TEMPORARY_DIRECTORY)/$(PROJECT_NAME)/docs + cp $(DOCUMENTATION_FILES) $(TEMPORARY_DIRECTORY)/$(PROJECT_NAME)/docs + tar czf $(PROJECT_NAME).tar.gz -C $(TEMPORARY_DIRECTORY) $(PROJECT_NAME) -.PHONY: tar -tar: - cd ..; \ - tar czf "synthslant-$$(date +%Y-%m-%d).tar.gz" \ - $(addprefix synthslant/,$(SOURCE_FILES)) +.PHONY: distcheck +distcheck: LATEX_FLAGS += -interaction=batchmode +distcheck: dist + $(eval TEMPORARY_DIRECTORY := $(shell mktemp -d)) + test -d '$(TEMPORARY_DIRECTORY)' + test -w '$(TEMPORARY_DIRECTORY)' + tar xzf $(PROJECT_NAME).tar.gz -C $(TEMPORARY_DIRECTORY) + $(MAKE) --directory=$(TEMPORARY_DIRECTORY)/$(PROJECT_NAME) LATEX_FLAGS='$(LATEX_FLAGS)' all + $(RM) -r $(TEMPORARY_DIRECTORY) + @printf '\n\ndistcheck passed.\n' .PHONY: clean @@ -91,6 +106,7 @@ clean: $(RM) mptextmp.* mpxerr.tex $(RM) README README.html RELEASE-HOWTO RELEASE-HOWTO.html $(RM) compare-with-the-gimp.eps compare-with-the-gimp.png + $(RM) $(PROJECT_NAME).tar.gz .PHONY: mostlyclean @@ -99,35 +115,27 @@ mostlyclean: clean .PHONY: maintainer-clean maintainer-clean: mostlyclean - $(RM) ./*.base64 ./*.ist ./*.mp ./*.sty ./*.tex + $(RM) ./*.base64 ./*.gst ./*.ist ./*.mp ./*.sty ./*.tex .PHONY: perf perf: synthslant-gauge.tex synthslant.sty - perf stat --repeat=10 -- $(LATEX) $(LATEX_FLAGS) -interaction batchmode -draftmode $< + perf stat --repeat=10 -- $(LATEX) $(LATEX_FLAGS) -interaction=batchmode -draftmode $< .PHONY: tool-check tool-check: - @printf '*** LATEX = "%s"\n' '$(LATEX)' - $(LATEX) --version + @printf '*** LATEX_PROPER = "%s"\n' '$(LATEX_PROPER)' + $(LATEX_PROPER) --version + @printf '\n\n*** BibTeX\n' + bibtex --version @printf '\n\n*** MAKEINDEX = "%s"\n' '$(MAKEINDEX)' - $(MAKEINDEX) < /dev/null + $(MAKEINDEX) < /dev/null @printf '\n\n*** METAPOST = "%s"\n' '$(METAPOST)' $(METAPOST) --version @printf '\n*** BASE64 = "%s"\n' '$(BASE64)' $(BASE64) --version - @printf '\n\nTool check passed.\n' - - -.PHONY: spell-check -spell-check: - @sed -e '\#<DISABLE-SPELL-CHECK/>#d' \ - -e '\#<DISABLE-SPELL-CHECK>#,\#</DISABLE-SPELL-CHECK>#d' < synthslant.dtx | \ - sed -e 's/^ *%%*//' | \ - sed -e 's/\\-//g' -e 's/|[^|]*|/ /g' | \ - $(SPELLCHECK) $(SPELLCHECK_FLAGS) list | \ - sort | uniq | fmt | sed -e 's/ / /g' + @printf '\n\ntool check passed.\n' .PHONY: update-docs @@ -142,8 +150,12 @@ all: Make everything there is to make. This is the .DEFAULT_GOAL. clean: Remove some products. -cpio: In the parent directory create a cpio(1) archive of the - project source files whose name is time-stamped. +dist: Create a tar file of the project source files and the PDF + documentation files. The archive is in the form and has a + name that CTAN prefers. + +distcheck: Create a tar file of the project source files, unpack it in + a different location and build all targets. doc: Build "synthslant.pdf" the Syntslant documentation. @@ -160,15 +172,22 @@ pdf: Build doc: and gauge:. sty: Only extract "synthslant.sty" from "synthslant.dtx". This operation requires LaTeX (-> $(LATEX)) and nothing else. -tar: In the parent directory create a tar(1) file of the project - source files whose name is time-stamped. +test: Run some tests. Currently only compiles a minimal document + to check whether "synthslant.sty" contains all the necessary + \RequirePackage directives. tool-check: Check whether some of the required tools to build the project are available. +update-docs: Copy the documentation files into the "docs" + sub-directory. + Selected Implicit Rules ----------------------- +%: %.html + Convert HTML to plain text. Requires w3m(1). + %.dvi %.pdf: %.dtx Run LaTeX or pdfLaTeX (-> $(LATEX)) on dtx source until a fix-point is reached. @@ -177,6 +196,9 @@ Selected Implicit Rules Run LaTeX or pdfLaTeX (-> $(LATEX)) on tex file until a fix-point is reached. +%.html: %.md + Convert markdown to HTML. Requires markdown(1). + %.mx.pdf: %.dvi Convert dvi to pdf via dvipdfmx (-> $(DVIPDFMX)). @@ -187,9 +209,9 @@ Selected Implicit Rules Some Explicit Rules ------------------- README.html: - Convert "README.md" to html. Requires markdown(1). + Convert "README.md" to html. -README: Convert "README.html" to plain text. Requires w3m(1). +README: Convert "README.html" to plain text. endef @@ -205,8 +227,8 @@ help: define MAKE_INDEX_AND_GLOSSARY sed -e '/@/d' < $*.idx > ,$*.idx; mv ,$*.idx $*.idx; \ -$(MAKEINDEX) $(MAKEINDEX_FLAGS) -s synthslant.ist -t $*.ilg -o $*.ind $*.idx; \ -$(MAKEINDEX) $(MAKEINDEX_FLAGS) -s gglo.ist -t $*.glg -o $*.gls $*.glo +$(MAKEINDEX) $(MAKEINDEX_FLAGS) -s $*.ist -t $*.ilg -o $*.ind $*.idx; \ +$(MAKEINDEX) $(MAKEINDEX_FLAGS) -s $*.gst -t $*.glg -o $*.gls $*.glo endef define GREP_LATEX_WARNINGS @@ -250,7 +272,13 @@ endef %.mps: %.mp - $(METAPOST) -s 'outputtemplate="%j.mps"' $(METAPOST_FLAGS) $< + $(METAPOST) -s 'outputtemplate="%j.mps"' $(METAPOST_FLAGS) $< || { \ + printf '=== $*.log ===\n'; \ + cat $*.log; \ + printf '\n\n=== mpxerr.log ===\n'; \ + cat mpxerr.log; \ + false; \ + } 1>&2 %.eps: %.png @@ -265,7 +293,8 @@ endef -synthslant.sty synthslant.ist synthslant-gauge.tex \ +synthslant.sty synthslant.ist \ +synthslant-gauge.tex synthslant-minimal-test.tex \ compare-with-the-gimp.png.base64 shear-transform.mp title.mp: \ synthslant.ins synthslant.dtx $(LATEX) $(LATEX_FLAGS) $< |