SRC ?= haskelltut # 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 ODIR ?= . BIBLIOGRAPHY ?= bibliography BIBLIOGRAPHY_PROCESSED ?= /tmp/bib ALLSRC = $(shell find . -name "*.ms") SOELIM_OPTS ?= 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) PRECONV_OPTS ?= -e utf-8 PRECONV = $(BINPRECONV) $(PRECONV_OPTS) EQN_OPTS ?= -Tpdf EQN = $(BINEQN) $(EQN_OPTS) # 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 ';' # CODE_FONT_FAMILY ?= C GH_INTRO := .b1;.nr DI 0;.DS I;.fam $(CODE_FONT_FAMILY) 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 ?= GHIGHLIGHT = $(BINGHIGHLIGHT) $(GHIGHLIGHT_OPTS) # BUSGRAP brings pie charts to troff BUSGRAP_OPTS ?= BUSGRAP = $(BINBUSGRAP) $(BUSGRAP_OPTS) GRAP_OPTS ?= GRAP = $(BINGRAP) $(GRAP_OPTS) PIC_OPTS ?= -Tpdf PIC = $(BINPIC) $(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_PROCESSED) REFER = $(BINREFER) $(REFER_OPTS) # -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 ROFF_OPTS ?= -ms -t -Tpdf -U -mspdf -mpdfmark -M ./bin -P -e ROFF = $(BINROFF) $(ROFF_OPTS) $(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 $(SOELIM) < $(SRC).ms |\ $(CUSTOM) |\ $(BUSGRAP) |\ $(PRECONV) |\ $(REFER) |\ $(EQN) |\ $(GHIGHLIGHT) |\ $(GRAP) |\ $(PIC) |\ $(PRECONV) |\ $(ROFF) > $(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 . | entr gmake $(SRC).pdf