Skip to content

Commit

Permalink
Add cross-platform buildability (modify preamble.tex automatically)
Browse files Browse the repository at this point in the history
Use sed to modify preamble.tex to use common fonts on each platform,
so the buid can succeed on any platform.

Theoretically, should be able to build on Windows (+ MinGW, Cygwin,
and any other Windows environment), Mas OS X, Linux, GNU Hurd, *BSD,
Haiku, Android, and any other modern open-source OS.
  • Loading branch information
fedorenchik committed Jul 10, 2017
1 parent 2f9ec97 commit d0af450
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,20 @@ export TASKS

SHELL=/bin/bash

ifeq ($(OS),Windows_NT) # Windows, MinGW, Cygwin, etc...
OS := Windows
subst_text := \\setmainfont{Arial}\n\\setmonofont{Courier New}
else
OS := $(shell sh -c 'uname -s 2>/dev/null || echo not')
ifeq ($(OS),Darwin) # Mac OS X
OS := Darwin
subst_text := \\setromanfont{Avenir Next}\n\\setmonofont{Source Code Pro}
else # Linux, GNU Hurd, *BSD, Haiku, Android, etc...
OS := Linux
subst_text := \\setmainfont{Liberation Sans}\n\\setmonofont{Liberation Mono}
endif
endif

docdir = doc
helpfiles = $(wildcard $(docdir)/*.txt)

Expand All @@ -26,6 +40,11 @@ update:
$(docdir):
./update.sh

vimhelp.tex vimhelp-a4.tex vimhelp-ipad.tex: preamble.tex

preamble.tex: FORCE
sed -i -e '/^\\usepackage{fontspec}/ {n;N;s/.*/$(subst_text)/}' preamble.tex

%.pdf: %.tex body.tex FORCE
xelatex $<
ifndef SECOND_TIME_RUN
Expand Down

0 comments on commit d0af450

Please sign in to comment.