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