Makefile: rework.

This commit is contained in:
Karchnu 2021-10-08 21:50:16 +02:00
parent eb58586a8d
commit 4b8227d9fb
2 changed files with 65 additions and 52 deletions

101
Makefile
View File

@ -1,59 +1,72 @@
SRC = universe-from-nothing
BIBLIOGRAPHY = bibliography
SRC ?= haskelltut
ODIR ?= .
BIBLIOGRAPHY ?= bibliography
ALLSRC = $(shell find . -name "*.ms")
SOELIM_OPTS ?=
SOELIM = soelim $(SOELIM_OPTS)
SPECHAR = specialchar2ms.sh
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 := .b1;.nr DI 0;.DS I;.fam C
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 = ghighlight $(GHIGHLIGHT_OPTS)
GRAP_OPTS ?=
GRAP = grap $(GRAP_OPTS)
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_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_OPTS ?= -ms -t -Tpdf
GROFF = groff $(GROFF_OPTS)
EQN_OPTS = -Tpdf
EQN = eqn $(EQN_OPTS)
PRECONV_OPTS = -e utf-8
PRECONV = preconv $(PRECONV_OPTS)
SPECHAR = specialchar2ms.sh
# ghighlight brings `source-highlight` to troff
GHIGHLIGHT_OPTS =
GHIGHLIGHT = ghighlight $(GHIGHLIGHT_OPTS)
VIEWER_OPTS = -
VIEWER = zathura $(VIEWER_OPTS)
SOELIM_OPTS =
SOELIM = soelim $(SOELIM_OPTS)
GRAP_OPTS =
GRAP = grap $(GRAP_OPTS)
PIC_OPTS =
PIC = pic $(PIC_OPTS)
# GH_INTRO: instructions before each source code provided by source-highlight
# GH_OUTRO: ------------ after ---- ------ ---- -------- -- ----------------
# GH_INTRO/GH_OUTRO: values are separated by ';'
GH_INTRO := .b1;.nr DI 0;.DS I;.fam C
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
$(SRC).pdf:
cat $(SRC).ms | $(SOELIM) | $(EQN) | $(GHIGHLIGHT) | $(GRAP) | $(PIC) | $(REFER) | $(PRECONV) | $(SPECHAR) | $(GROFF) > $@
cat $(SRC).ms |\
$(SOELIM) |\
$(SPECHAR) |\
$(PRECONV) |\
$(EQN) |\
$(GHIGHLIGHT) |\
$(GRAP) |\
$(PIC) |\
$(REFER) |\
$(GROFF) > $(ODIR)/$@
include Makefile.custom
# 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

View File

@ -1,11 +1,11 @@
RAM=/tmp
# DOC: hstut rc
DOC ?= universefromnothing
SRC ?= universe-from-nothing
ODIR ?= /tmp
export ODIR SRC
include Makefile
upload:
scp $(RAM)/$(SRC).pdf tacos:/var/www/htdocs/t.karchnu.fr/doc/
run_universefromnothing:
cat $(SRC).ms | $(SOELIM) | $(EQN) | $(GHIGHLIGHT) | $(GRAP) | $(PIC) | $(REFER) | $(PRECONV) | $(SPECHAR) | $(GROFF) > $(RAM)/$(SRC).pdf
serve:
find . -name "*.ms" | entr gmake -B run_$(DOC)
# VIEWER_OPTS = -
# VIEWER = zathura $(VIEWER_OPTS)