book-summaries/Makefile.in

112 lines
3.2 KiB
Makefile
Raw Normal View History

2021-11-06 08:07:12 +01:00
SRC ?= haskelltut
2022-05-08 05:40:45 +02:00
# Let's allow different implementations to be tested.
BINPIC ?= pic
BINREFER ?= refer
BINSOELIM ?= soelim
BINPRECONV ?= preconv
BINEQN ?= eqn
BINGHIGHLIGHT ?= ./bin/ghighlight
BINBUSGRAP ?= ./bin/busgrap.pl
BINGRAP ?= grap
BINROFF ?= groff
export BINPIC BINREFER BINSOELIM BINPRECONV BINEQN BINGHIGHLIGHT BINBUSGRAP BINGRAP BINROFF
2021-11-06 08:07:12 +01:00
ODIR ?= .
BIBLIOGRAPHY ?= bibliography
2022-05-08 05:40:45 +02:00
BIBLIOGRAPHY_PROCESSED ?= /tmp/bib
2021-11-06 08:07:12 +01:00
ALLSRC = $(shell find . -name "*.ms")
SOELIM_OPTS ?=
2022-05-08 05:40:45 +02:00
SOELIM = $(BINSOELIM) $(SOELIM_OPTS)
# Custom script, currently to replace unbreakable spaces by \SP.
CUSTOM_OPTS ?=
CUSTOM ?= ./bin/custom $(CUSTOM_OPTS)
#CUSTOM_BIS_OPTS ?=
#CUSTOM_BIS ?= ./bin/utf8-to-ms.sh $(CUSTOM_BIS_OPTS)
2021-11-06 08:07:12 +01:00
PRECONV_OPTS ?= -e utf-8
2022-05-08 05:40:45 +02:00
PRECONV = $(BINPRECONV) $(PRECONV_OPTS)
2021-11-06 08:07:12 +01:00
EQN_OPTS ?= -Tpdf
2022-05-08 05:40:45 +02:00
EQN = $(BINEQN) $(EQN_OPTS)
2021-11-06 08:07:12 +01: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 ';'
#
2022-05-08 05:40:45 +02:00
CODE_FONT_FAMILY ?= C
GH_INTRO := .b1;.nr DI 0;.DS I;.fam $(CODE_FONT_FAMILY)
2021-11-06 08:07:12 +01:00
GH_OUTRO := .fam;.DE;.b2
#
export GH_INTRO
export GH_OUTRO
#
# SHOPTS: cmd line parameter given to source-highlight
SHOPTS = --outlang-def=.source-highlight_groff-output-definition
export SHOPTS
# ghighlight brings `source-highlight` to troff
GHIGHLIGHT_OPTS ?=
2022-05-08 05:40:45 +02:00
GHIGHLIGHT = $(BINGHIGHLIGHT) $(GHIGHLIGHT_OPTS)
# BUSGRAP brings pie charts to troff
BUSGRAP_OPTS ?=
BUSGRAP = $(BINBUSGRAP) $(BUSGRAP_OPTS)
2021-11-06 08:07:12 +01:00
GRAP_OPTS ?=
2022-05-08 05:40:45 +02:00
GRAP = $(BINGRAP) $(GRAP_OPTS)
2021-11-06 08:07:12 +01:00
PIC_OPTS ?= -Tpdf
2022-05-08 05:40:45 +02:00
PIC = $(BINPIC) $(PIC_OPTS)
2021-11-06 08:07:12 +01:00
# -P => move ponctuation after reference
# -S => label and bracket-label options
# -e => accumulate (use a reference section)
# -p bib => bibliography file
2022-05-08 05:40:45 +02:00
REFER_OPTS ?= -PS -e -p $(BIBLIOGRAPHY_PROCESSED)
REFER = $(BINREFER) $(REFER_OPTS)
2021-11-06 08:07:12 +01:00
# -k => iconv conversion (did it ever worked?)
# -ms => ms macro
# -U => unsafe (because of PDF inclusion)
# -Tpdf => output device is PDF
# -mspdf => include PDF (so, images converted in PDF) in the document
# NOTE: a custom troffrc (configuration file) is necessary on OpenBSD
# to have correctly justified paragraphs. Otherwise, the default
# configuration removes this possibility, for bullshit reasons. Sad.
# -M dir => path to custom troffrc
# TODO: no change with or without the following options -P -e
# This has to be inverstigated: how to make PDFs look nice in browsers?
# -P -e => provide "-e" to gropdf to embed fonts
2022-05-08 05:40:45 +02:00
ROFF_OPTS ?= -ms -t -Tpdf -U -mspdf -mpdfmark -M ./bin -P -e
ROFF = $(BINROFF) $(ROFF_OPTS)
2021-11-06 08:07:12 +01:00
2022-05-08 05:40:45 +02:00
$(BIBLIOGRAPHY_PROCESSED): $(BIBLIOGRAPHY)
@# Let's process the bibliography file
@echo "Let's process the bibliography file"
$(PRECONV) < $(BIBLIOGRAPHY) > $(BIBLIOGRAPHY_PROCESSED)
$(SRC).pdf: $(BIBLIOGRAPHY_PROCESSED)
sleep 0.1
2022-01-19 19:09:59 +01:00
$(SOELIM) < $(SRC).ms |\
2022-05-08 05:40:45 +02:00
$(CUSTOM) |\
$(BUSGRAP) |\
2021-11-06 08:07:12 +01:00
$(PRECONV) |\
2022-05-08 05:40:45 +02:00
$(REFER) |\
2021-11-06 08:07:12 +01:00
$(EQN) |\
$(GHIGHLIGHT) |\
$(GRAP) |\
$(PIC) |\
2022-05-08 05:40:45 +02:00
$(PRECONV) |\
$(ROFF) > $(ODIR)/$@
2021-11-06 08:07:12 +01:00
# 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:
2022-05-08 05:40:45 +02:00
find . | entr gmake $(SRC).pdf