| 1 |
# n.b. This Makefile is for development convenience only. It is not |
| 2 |
# required to build or install Fountain Mode. |
| 3 |
|
| 4 |
.POSIX: |
| 5 |
PROG = fountain-mode |
| 6 |
LISP_FILE = ${PROG}.el |
| 7 |
DEPS = seq package-lint |
| 8 |
NEWS_FILE = NEWS.md |
| 9 |
DOCS_DIR = doc |
| 10 |
TEXI_FILE = ${DOCS_DIR}/${PROG}.texi |
| 11 |
INFO_FILE = ${DOCS_DIR}/${PROG}.info |
| 12 |
CSS_FILE = ${DOCS_DIR}/style.css |
| 13 |
HTML_DIR = ${DOCS_DIR}/html |
| •14 |
GENERATED_DOCS = ${INFO_FILE} |
| 15 |
GENERATED_DOCS += ${DOCS_DIR}/dir |
| 16 |
GENERATED_DOCS += ${DOCS_DIR}/*.epub ${DOCS_DIR}/*.pdf ${HTML_DIR}/*.html |
| 17 |
GENERATED_DOCS += ${DOCS_DIR}/*.aux ${DOCS_DIR}/*.fn ${DOCS_DIR}/*.log |
| 18 |
GENERATED_DOCS += ${DOCS_DIR}/*.toc ${DOCS_DIR}/*.vr |
| 19 |
VERS = ${shell grep -oE -m1 'Version:[ 0-9.]+' ${LISP_FILE} | tr -d :} |
| 20 |
TAG = ${shell echo ${VERS} | sed -E 's/Version:? ([0-9.]+)/v\1/'} |
| 21 |
INIT = \ |
| 22 |
(progn (require (quote package)) \ |
| 23 |
(push (cons "melpa" "https://melpa.org/packages/") package-archives) \ |
| 24 |
(package-initialize) \ |
| 25 |
(dolist (pkg (quote (${DEPS}))) \ |
| 26 |
(unless (package-installed-p pkg) \ |
| 27 |
(unless (assoc pkg package-archive-contents) \ |
| 28 |
(package-refresh-contents)) \ |
| 29 |
(package-install pkg)))) |
| 30 |
|
| 31 |
all: clean check compile manuals |
| 32 |
|
| 33 |
check: |
| 34 |
@emacs -Q --eval '${INIT}' --batch -f package-lint-batch-and-exit ${LISP_FILE} |
| 35 |
|
| 36 |
compile: |
| 37 |
@emacs -Q --eval '${INIT}' -L . --batch -f batch-byte-compile ${LISP_FILE} |
| 38 |
|
| 39 |
manuals: info-manual html-manual epub-manual pdf-manual |
| 40 |
|
| 41 |
info-manual: |
| 42 |
makeinfo --output ${INFO_FILE} ${TEXI_FILE} |
| 43 |
install-info ${INFO_FILE} ${DOCS_DIR}/dir |
| 44 |
|
| 45 |
html-manual: |
| 46 |
texi2any --html --css-include=${CSS_FILE} --output ${HTML_DIR} ${TEXI_FILE} |
| 47 |
|
| 48 |
epub-manual: |
| 49 |
texi2any --epub3 --output ${DOCS_DIR}/${PROG}.epub ${TEXI_FILE} |
| 50 |
|
| 51 |
pdf-manual: |
| 52 |
texi2pdf --clean --output ${DOCS_DIR}/${PROG}.pdf ${TEXI_FILE} |
| 53 |
|
| 54 |
tag-release: check compile |
| 55 |
printf '%s\n' '/^## master/ s/master/${VERS}/' . w | ed -s ${NEWS_FILE} |
| 56 |
git commit -m 'Add ${VERS} to ${NEWS_FILE}' ${NEWS_FILE} |
| 57 |
awk '/^## Version/ { v ++1 } v == 1' ${NEWS_FILE} \ |
| 58 |
| sed 's/^## //' | tr -d \` \ |
| 59 |
| git tag -F - ${TAG} |
| 60 |
|
| 61 |
clean: |
| 62 |
rm -f ${PROG}.elc |
| •63 |
rm -rf ${GENERATED_DOCS} |