SRC ?= graphs ODIR ?= . BIBLIOGRAPHY ?= bibliography ALLSRC = $(shell find .) SOELIM_OPTS ?= SOELIM = soelim $(SOELIM_OPTS) PRECONV_OPTS ?= -e utf-8 PRECONV = preconv $(PRECONV_OPTS) EQN_OPTS ?= -Tpdf EQN = eqn $(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 ';' # GH_INTRO := .nr DI 0;.DS I;.fam C;.b1;.sp -0.1i GH_OUTRO := .sp -0.2i;.b2;.fam;.DE # 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 = ./bin/ghighlight $(GHIGHLIGHT_OPTS) GRAP_OPTS ?= GRAP = grap $(GRAP_OPTS) PIC_OPTS ?= -Tpdf 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 # -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 GROFF_OPTS ?= -ms -t -Tpdf -U -mspdf -mpdfmark -M ./bin -P -e GROFF = groff $(GROFF_OPTS) $(SRC).pdf: $(SOELIM) < $(SRC).ms |\ ./bin/utf8-to-ms.sh |\ $(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" -or -name "*.d" | entr gmake -B $(SRC).pdf find . | entr gmake -B $(SRC).pdf