book-summaries/Makefile

73 lines
1.7 KiB
Makefile
Raw Normal View History

2021-10-08 21:50:16 +02:00
SRC ?= haskelltut
2021-10-08 21:50:16 +02:00
ODIR ?= .
2021-10-08 21:50:16 +02:00
BIBLIOGRAPHY ?= bibliography
ALLSRC = $(shell find . -name "*.ms")
2021-10-08 21:50:16 +02:00
SOELIM_OPTS ?=
SOELIM = soelim $(SOELIM_OPTS)
2021-10-09 18:33:55 +02:00
SPECHAR = ./bin/utf8-to-ms.sh
2021-10-05 04:49:30 +02:00
2021-10-08 21:50:16 +02:00
PRECONV_OPTS ?= -e utf-8
PRECONV = preconv $(PRECONV_OPTS)
2021-10-08 21:50:16 +02:00
EQN_OPTS ?= -Tpdf
EQN = eqn $(EQN_OPTS)
2021-10-08 21:50:16 +02:00
# source-highlight stuff
# GH_INTRO: instructions before each source code provided by source-highlight
# GH_OUTRO: ------------ after ---- ------ ---- -------- -- ----------------
# GH_INTRO/GH_OUTRO: values are separated by ';'
2021-10-08 21:50:16 +02:00
#
GH_INTRO := .b1;.nr DI 0;.DS I;.fam C
GH_OUTRO := .fam;.DE;.b2
2021-10-08 21:50:16 +02:00
#
export GH_INTRO
export GH_OUTRO
2021-10-08 21:50:16 +02:00
#
# SHOPTS: cmd line parameter given to source-highlight
SHOPTS = --outlang-def=./.source-highlight_groff-output-definition
export SHOPTS
2021-10-08 21:50:16 +02:00
# ghighlight brings `source-highlight` to troff
GHIGHLIGHT_OPTS ?=
GHIGHLIGHT = ghighlight $(GHIGHLIGHT_OPTS)
GRAP_OPTS ?=
GRAP = grap $(GRAP_OPTS)
2021-10-08 21:50:16 +02:00
PIC_OPTS ?=
PIC = pic $(PIC_OPTS)
# -P => move ponctuation after reference
# -S => label and bracket-label options
# -e => accumulate (use a reference section)
# -p bib => bibliography file
REFER_OPTS ?= -PS -e -p $(BIBLIOGRAPHY)
REFER = refer $(REFER_OPTS)
# -k => iconv conversion (did it ever worked?)
# -ms => ms macro
# -Tpdf => output device is PDF
GROFF_OPTS ?= -ms -t -Tpdf
GROFF = groff $(GROFF_OPTS)
$(SRC).pdf:
cat $(SRC).ms |\
$(SOELIM) |\
$(SPECHAR) |\
$(PRECONV) |\
$(EQN) |\
$(GHIGHLIGHT) |\
$(GRAP) |\
$(PIC) |\
$(REFER) |\
$(GROFF) > $(ODIR)/$@
# Keep options in memory for the recursive 'make' call
export SOELIM_OPTS PRECONV_OPTS EQN_OPTS GHIGHLIGHT_OPTS GRAP_OPTS PIC_OPTS REFER_OPTS
serve:
find . -name "*.ms" | entr gmake -B $(SRC).pdf