-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
184 lines (130 loc) · 3.92 KB
/
Makefile
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# Makefile
# This file is part of Galope
# http:https://programandala.net/en.program.galope.html
# Last modified 202012241742
# ==============================================================
# Author {{{1
# Marcos Cruz (programandala.net), 2017.
# ==============================================================
# License {{{1
# You may do whatever you want with this work, so long as you
# retain every copyright, credit and authorship notice, and this
# license. There is no warranty.
# ==============================================================
# Requirements {{{1
# Asciidoctor (by Dan Allen and Sara White)
# http:https://asciidoctor.org
# asciidoctor-pdf (by Dan Allen and Sara White)
# http:https://asciidoctor.org
# cat (from the GNU coreutils)
# Gforth (by Anton Erlt, Bernd Paysan et al.)
# http:https://gnu.org/software/gforth
# Glosara (by Marcos Cruz)
# http:https://programandala.net/en.program.glosara.html
# htmldoc (by Michael Sweet)
# http:https://www.htmldoc.org
# pandoc (by Johw Macfarlane)
# http:https://john-macfarlane.net/pandoc
# ==============================================================
# History {{{1
# See at the end of the file.
# ==============================================================
# Notes about make {{{1
# $@ = the name of the target of the rule
# $< = the name of the first prerequisite
# $? = the names of all the prerequisites that are newer than the target
# $^ = the names of all the prerequisites
# `%` works only at the start of the filter pattern
# ==============================================================
# Config {{{1
VPATH = ./
MAKEFLAGS = --no-print-directory
#.ONESHELL:
# ==============================================================
# Main {{{1
.PHONY: all
all: doc
.PHONY: clean
clean: cleandoc
.PHONY: cleandoc
cleandoc:
-rm -f doc/*.html doc/*.pdf tmp/*.adoc
# ==============================================================
# Documentation {{{1
.PHONY: doc
doc: \
doc/galope_manual.html \
doc/galope_manual.pdf
# ----------------------------------------------
# Common rules {{{2
doc/%.pdf: tmp/%.adoc
asciidoctor-pdf --out-file $@ $<
%.html: %.adoc
asciidoctor --out-file=$@ $<
tmp/glossary.adoc: tmp/files.txt
glosara --level=3 --input=$< --output=$@
#glosara --level=3 -m "glossary{ }glossary" --input=$< --output=$@
%.docbook: %.adoc
asciidoctor --backend=docbook --out-file=$@ $<
%.texi: %.docbook
pandoc -o $@ $<
%.info: %.texi
makeinfo -o $@ $<
# ----------------------------------------------
# Main {{{2
galope_modules=$(wildcard *.fs)
doc/galope_manual.html: \
tmp/galope_manual.adoc \
README.adoc
asciidoctor --out-file=$@ $<
tmp/manual_skeleton.adoc: \
docsrc/manual_skeleton.adoc \
VERSION.txt
version=$$(cat VERSION.txt); \
sed -e "s/%VERSION%/$${version}/" $< > $@
tmp/files.txt: $(galope_modules)
ls -1 $^ > $@
tmp/galope_manual.adoc: \
tmp/manual_skeleton.adoc \
tmp/glossary.adoc
cat $^ > $@
doc/galope_manual.texi: tmp/galope_manual.docbook
pandoc -o $@ $<
doc/galope_manual.info: doc/galope_manual.texi
makeinfo -o $@ $<
# ----------------------------------------------
# Online documentation {{{2
# Online documentation displayed on the Fossil repository.
.PHONY: wwwdoc
wwwdoc: wwwreadme
.PHONY: cleanwww
cleanwww:
rm -f \
doc/www/* \
tmp/README.*
.PHONY: wwwreadme
wwwreadme: doc/www/README.html
doc/www/README.html: tmp/README.html
echo "<div class='fossil-doc' data-title='README'>" > $@;\
cat $< >> $@;\
echo "</div>" >> $@
tmp/README.html: README.adoc
asciidoctor \
--embedded \
--out-file=$@ $<
# ==============================================================
# Change log {{{1
# 2017-07-14: Start.
#
# 2017-07-15: Try Glosara `--output` parameter.
#
# 2017-11-20: First try to create Texinfo and Info versions of the manual.
#
# 2017-11-21: Improve.
#
# 2018-12-07: Update requirements.
#
# 2018-12-19: Replace htmldoc with asciidoctor-pdf, the PDF is much better.
#
# 2020-12-24: Build an online version of the README file for the Fossil
# repository.