aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc/Makefile
blob: 36ea60860faa8a5faf322e64fe57b1e92a34e927 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#
# Makefile for the Vim documentation on Unix
#
# If you get "don't know how to make scratch", first run make in the source
# directory.  Or remove the include below.

AWK = awk

# Set to $(VIMTARGET) when executed from src/Makefile.
VIMEXE = vim

DOCS = $(wildcard *.txt)
HTMLS = $(DOCS:.txt=.html)

MANPAGES = \
	manpages/vim.man \
	manpages/vimtutor.man \
	manpages/xxd.man \
	manpages/de/vim-de.man \
	manpages/fr/vim-fr.man \
	manpages/fr/vimtutor-fr.man \
	manpages/fr/xxd-fr.man \
	manpages/pl/vim-pl.man \
	manpages/pl/vimtutor-pl.man \
	manpages/pl/xxd-pl.man \
	manpages/it/vim-it.man \
	manpages/it/vimtutor-it.man \
	manpages/it/xxd-it.man \
	manpages/ru/vim-ru.man \
	manpages/ru/vimtutor-ru.man \
	manpages/ru/xxd-ru.man \
	manpages/ja/vim-ja.man \
	manpages/ja/vimtutor-ja.man \
	manpages/ja/xxd-ja.man

.SUFFIXES:
.SUFFIXES: .c .o .txt .html .1 .man

all: tags manpages html

# Use Vim to generate the tags file.  Can only be used when Vim has been
# compiled and installed.  Supports multiple languages.
vimtags: $(DOCS)
	$(VIMEXE) -u NONE -esX -c "helptags ++t ." -c quit

# Use "doctags" to generate the tags file.  Only works for English!
tags: doctags $(DOCS)
	./doctags $(DOCS) | LANG=C LC_ALL=C sort >tags
	uniq -d -2 tags

doctags: doctags.c
	$(CC) doctags.c -o doctags

manpages: $(MANPAGES)

# OSX groff doesn't support utf-8 as input encoding, so this won't work there.
.1.man:
	groff -k -mandoc -Tutf8 $< | sed -e s/.^H//g > $@

# Awk version of .txt to .html conversion.
html: noerrors tags $(HTMLS)
	@if test -f errors.log; then cat errors.log; fi

noerrors:
	-rm -f errors.log

$(HTMLS): tags.ref

.txt.html:
	$(AWK) -f makehtml.awk $< >$@

# index.html is the starting point for HTML, but for the help files it is
# help.txt.  Therefore use vimindex.html for index.txt.
index.html: help.txt
	$(AWK) -f makehtml.awk help.txt >index.html

vimindex.html: index.txt
	$(AWK) -f makehtml.awk index.txt >vimindex.html

tags.ref tags.html: tags
	$(AWK) -f maketags.awk tags >tags.html

clean:
	-rm -f doctags *.html tags.ref $(MANPAGES) $(HTMLS) errors.log