| 1 |
# Prepare the CTAN submission for all three packages. |
| 2 |
|
| 3 |
PACKAGES = memoize advice collargs |
| 4 |
|
| 5 |
all: ctan/memoize.zip |
| 6 |
$(MAKE) -f Makefile.advice ctan/advice.zip |
| 7 |
$(MAKE) -f Makefile.collargs ctan/collargs.zip |
| 8 |
@echo "Don't forget to run the tests!" |
| 9 |
|
| 10 |
# Prepare the CTAN submission. |
| 11 |
|
| 12 |
PACKAGE = memoize |
| 13 |
VERSION = 1.4.1 |
| 14 |
YEAR = 2024 |
| 15 |
MONTH = 12 |
| 16 |
DAY = 02 |
| 17 |
|
| 18 |
FORMAT = generic |
| 19 |
|
| 20 |
COMMON = memoize nomemoize memoizable |
| 21 |
PLAIN = memoize-extract-one.tex |
| 22 |
GENERIC = memoizable.code.tex |
| 23 |
LATEX = memoize-biblatex.code.tex memoize-beamer.code.tex |
| 24 |
SOURCE = memoize.edtx memoize.ins |
| 25 |
|
| 26 |
SCRIPTS := memoize-extract memoize-clean |
| 27 |
man-src := $(SCRIPTS:%=doc/%.1.md) |
| 28 |
MAN := $(SCRIPTS:%=%.1) $(SCRIPTS:%=%.pl.1) $(SCRIPTS:%=%.py.1) |
| 29 |
MAN := $(MAN:%=doc/%) |
| 30 |
SCRIPTS := $(SCRIPTS:%=%.pl) $(SCRIPTS:%=%.py) |
| 31 |
|
| 32 |
%.pl.1: %.1 |
| 33 |
echo .so man1/$*.1 > $@ # link to .1 man page |
| 34 |
%.py.1: %.1 |
| 35 |
echo .so man1/$*.1 > $@ # link to .1 man page |
| 36 |
|
| 37 |
README = doc/README.memoize.md |
| 38 |
INSTALL = INSTALL.md |
| 39 |
CHANGELOG = CHANGELOG.md |
| 40 |
MAKEFILE = Makefile Makefile.package Makefile.runtimes Makefile.advice Makefile.collargs |
| 41 |
LICENCE = LICENCE |
| 42 |
|
| 43 |
PACKAGES.edtx = $(PACKAGES:%=%.edtx) |
| 44 |
PACKAGES.dtx = $(PACKAGES:%=%.dtx) |
| 45 |
PACKAGES.ins = $(PACKAGES:%=%.ins) |
| 46 |
|
| 47 |
codedoc-source = memoize-code.tex \ |
| 48 |
memoize-code.sty memoize-doc-common.sty \ |
| 49 |
memoize-code.latexmkrc |
| 50 |
|
| 51 |
manual-source = memoize-doc.tex \ |
| 52 |
memoize-doc.sty memoize-doc-common.sty yadoc.sty \ |
| 53 |
memoize-doc.mst memoize-doc.latexmkrc |
| 54 |
|
| 55 |
PDF = memoize-doc.pdf memoize-code.pdf |
| 56 |
|
| 57 |
codedoc-source := $(codedoc-source:%=doc/%) |
| 58 |
manual-source := $(manual-source:%=doc/%) |
| 59 |
pdf := $(PDF:%=doc/%) |
| 60 |
DOC = $(codedoc-source) $(manual-source) $(pdf) $(man-src) \ |
| 61 |
doc/examples-src.zip doc/examples.zip |
| 62 |
|
| 63 |
doc/examples-src.zip: $(examples-src) |
| 64 |
$(MAKE) -C doc/examples examples-src.zip |
| 65 |
|
| 66 |
doc/examples.zip: $(examples-src) |
| 67 |
$(MAKE) -C doc/examples examples.zip |
| 68 |
|
| 69 |
ctan/$(PACKAGE).zip: |
| 70 |
$(TDS-BEGIN) |
| 71 |
$(TDS-END) |
| 72 |
$(CTAN-BEGIN) |
| 73 |
$(CTAN-END) |
| 74 |
|
| 75 |
%.py.dtx: %.py |
| 76 |
edtx2dtx -s -c '#' -B '^__version__' -E '^# Local Variables:' $< \ |
| 77 |
| sed -e '/^% Local Variables:/Q' > $@ |
| 78 |
|
| 79 |
%.pl.dtx: %.pl |
| 80 |
edtx2dtx -s -c '#' -B '^my \$$PROG' -E '^# Local Variables:' $< \ |
| 81 |
| sed -e '/^% Local Variables:/Q' > $@ |
| 82 |
|
| 83 |
doc/memoize-code.pdf: $(codedoc-source) \ |
| 84 |
$(PACKAGES.dtx) $(PACKAGES.ins) $(SCRIPTS:%=%.dtx) |
| 85 |
|
| 86 |
doc/memoize-doc.pdf: $(manual-source) $(PACKAGES.edtx) doc/examples.zip |
| 87 |
|
| 88 |
%.pdf: %.tex |
| 89 |
latexmk -r $*.latexmkrc $(LATEXMK) $< |
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
# Maintenance |
| 94 |
|
| 95 |
test.tex = $(wildcard test*.tex) |
| 96 |
|
| 97 |
.PHONY: all force clean versions-show |
| 98 |
|
| 99 |
.PRECIOUS: %.1 |
| 100 |
|
| 101 |
clean: # clean this directory |
| 102 |
memoize-clean.py -a $(test.tex:%.tex=-p %.) $(test.tex:%.tex=-p %.memo.dir/) |
| 103 |
latexmk -C -f $(test.tex) _region_ |
| 104 |
|
| 105 |
version: |
| 106 |
$(MAKE) -f Makefile.collargs version |
| 107 |
$(MAKE) -f Makefile.advice version |
| 108 |
$(call EDIT-VERSION-LATEX,memoize.edtx,memoize) |
| 109 |
$(call EDIT-VERSION-LATEX,memoize.edtx,nomemoize) |
| 110 |
$(call EDIT-VERSION-LATEX,memoize.edtx,memoizable) |
| 111 |
$(call EDIT-VERSION-CONTEXT,memoize.edtx) |
| 112 |
$(call EDIT-VERSION-PLAIN,memoize.edtx,memoize) |
| 113 |
$(call EDIT-VERSION-PLAIN,memoize.edtx,nomemoize) |
| 114 |
$(call EDIT-VERSION-PLAIN,memoize.edtx,memoizable) |
| 115 |
$(call EDIT-VERSION-PERL,memoize-extract.pl) |
| 116 |
$(call EDIT-VERSION-PERL,memoize-clean.pl) |
| 117 |
$(call EDIT-VERSION-PYTHON,memoize-extract.py) |
| 118 |
$(call EDIT-VERSION-PYTHON,memoize-clean.py) |
| 119 |
$(call EDIT-VERSION-MAN,doc/memoize-extract.1.md) |
| 120 |
$(call EDIT-VERSION-MAN,doc/memoize-clean.1.md) |
| 121 |
$(call EDIT-DATE-CHANGELOG,CHANGELOG.md) |
| 122 |
$(call EDIT-VERSION-LATEX,doc/memoize-doc.tex,memoize) |
| 123 |
$(call EDIT-VERSION-LATEX,doc/memoize-code.tex,memoize) |
| 124 |
define COLOR_VERSION |
| 125 |
grep -E --color '[0-9]{4}[/-][0-9]{1,2}[/-][0-9]{1,2}|v?[0-9]\.[0-9]\.[0-9]([-a-z]*)|(January|February|March|April|May|June|July|August|September|October|November|December) [0-9]+, [0-9]{4}' |
| 126 |
endef |
| 127 |
|
| 128 |
versions-show: |
| 129 |
@grep -E '\\ProvidesPackage|^%<context>%D\s*(version|date)=' $(PACKAGES.edtx) $(pdf:%.pdf=%.tex) | ${COLOR_VERSION} |
| 130 |
@grep __version__ *.py | ${COLOR_VERSION} |
| 131 |
@grep VERSION *.pl | ${COLOR_VERSION} |
| 132 |
@grep -E '^(footer|date):' doc/memoize-*.md | ${COLOR_VERSION} |
| 133 |
@${COLOR_VERSION} CHANGELOG.md doc/CHANGELOG.advice.md doc/CHANGELOG.collargs.md |
| 134 |
|
| 135 |
include Makefile.package |
| 136 |
include Makefile.runtimes |
| 137 |
|
| 138 |
VERSION-MAN = of Memoize v$(VERSION) |
| 139 |
|
| 140 |
.PHONY: all-runtimes link-all-runtimes install-all-runtimes unlink-all-runtimes test examples |
| 141 |
|
| 142 |
all-runtimes: runtimes |
| 143 |
$(MAKE) -f Makefile.advice runtimes |
| 144 |
$(MAKE) -f Makefile.collargs runtimes |
| 145 |
|
| 146 |
link-all-runtimes: link-runtimes |
| 147 |
$(MAKE) -f Makefile.advice link-runtimes |
| 148 |
$(MAKE) -f Makefile.collargs link-runtimes |
| 149 |
|
| 150 |
install-all-runtimes: install-runtimes |
| 151 |
$(MAKE) -f Makefile.advice install-runtimes |
| 152 |
$(MAKE) -f Makefile.collargs install-runtimes |
| 153 |
|
| 154 |
uninstall-all-runtimes: uninstall-runtimes |
| 155 |
$(MAKE) -f Makefile.advice uninstall-runtimes |
| 156 |
$(MAKE) -f Makefile.collargs uninstall-runtimes |
| 157 |
|
| 158 |
test: |
| 159 |
cd testing && ./MakeTests.py |