summaryrefslogtreecommitdiff
path: root/Makefile.in
blob: 5c8ff901a52398cd4e7adb63832c261e63108f2b (plain)
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
#
# Make file to install/uninstall AsciiDoc
#
# Run `make help` to print out directions on running
# this file. To add new messages to help, prepend
# the line with ## and then one additional character,
# e.g. `## help` to show "help" or `##   help` will show
# "  help" or `##.` will show a blank line.

.NOTPARALLEL:

INSTALL = @INSTALL@
INSTALL_PROG = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
SED = @SED@

prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
datadir = @datadir@
docdir = @docdir@
sysconfdir = @sysconfdir@
datarootdir = @datarootdir@
mandir=@mandir@
srcdir = @srcdir@

VPATH = @srcdir@

ASCIIDOCVERSION = @PACKAGE_VERSION@
ASCIIDOCDATE = @PACKAGE_DATE@
ASCIIDOCCONF = $(sysconfdir)/asciidoc

prog = asciidoc.py a2x.py
progdir = $(bindir)

manp = $(patsubst %1.txt,%1,$(wildcard doc/*.1.txt))
manpdir = $(mandir)/man1

conf = $(wildcard *.conf)
confdir = $(ASCIIDOCCONF)

filtersdir = $(ASCIIDOCCONF)/filters

codefilter = filters/code/code-filter.py
codefilterdir = $(filtersdir)/code
codefilterconf = filters/code/code-filter.conf
codefilterconfdir = $(filtersdir)/code

graphvizfilter = filters/graphviz/graphviz2png.py
graphvizfilterdir = $(filtersdir)/graphviz
graphvizfilterconf = filters/graphviz/graphviz-filter.conf
graphvizfilterconfdir = $(filtersdir)/graphviz

musicfilter = filters/music/music2png.py
musicfilterdir = $(filtersdir)/music
musicfilterconf = filters/music/music-filter.conf
musicfilterconfdir = $(filtersdir)/music

sourcefilterconf = filters/source/source-highlight-filter.conf
sourcefilterconfdir = $(filtersdir)/source

latexfilter = filters/latex/latex2img.py
latexfilterdir = $(filtersdir)/latex
latexfilterconf = filters/latex/latex-filter.conf
latexfilterconfdir = $(filtersdir)/latex

unwraplatexfilter = filters/unwraplatex.py
unwraplatexfilterdir = $(filtersdir)

themesdir = $(ASCIIDOCCONF)/themes

flasktheme = themes/flask/flask.css
flaskthemedir = $(themesdir)/flask

volnitskytheme = themes/volnitsky/volnitsky.css
volnitskythemedir = $(themesdir)/volnitsky

docbook = $(wildcard docbook-xsl/*.xsl)
docbookdir = $(ASCIIDOCCONF)/docbook-xsl

dblatex = $(wildcard dblatex/*.xsl) $(wildcard dblatex/*.sty)
dblatexdir = $(ASCIIDOCCONF)/dblatex

css = $(wildcard stylesheets/*.css)
cssdir = $(ASCIIDOCCONF)/stylesheets

js = $(wildcard javascripts/*.js)
jsdir = $(ASCIIDOCCONF)/javascripts

callouts = $(wildcard images/icons/callouts/*)
calloutsdir = $(ASCIIDOCCONF)/images/icons/callouts

icons = $(wildcard images/icons/*.png) images/icons/README
iconsdir = $(ASCIIDOCCONF)/images/icons

doc = $(wildcard README*) $(wildcard BUGS*) $(wildcard INSTALL*) $(wildcard CHANGELOG*)

DATATARGETS = manp conf docbook dblatex css js callouts icons codefilterconf graphvizfilterconf latexfilterconf musicfilterconf sourcefilterconf flasktheme volnitskytheme
PROGTARGETS = prog codefilter graphvizfilter latexfilter musicfilter unwraplatexfilter
TARGETS = $(DATATARGETS) $(PROGTARGETS) doc

INSTDIRS = $(TARGETS:%=%dir)

.PHONY: $(TARGETS)

# this needs to be above help so that it runs
# by default
all: build

.PHONY : help
help : Makefile
	@sed -n 's/^##.//p' $<

## Makefile for AsciiDoc @PACKAGE_VERSION@ (@PACKAGE_DATE@)
## Usage: make [VARIABLE=value] ... [TARGET]
##.
##   all: runs the build target

# create directories used during the install
$(INSTDIRS):
	$(INSTALL) -d $(DESTDIR)$($@)

$(PROGTARGETS): % : %dir
	$(INSTALL_PROG) $($@) $(DESTDIR)$($<)/

$(DATATARGETS): % : %dir
	$(INSTALL_DATA) $($@) $(DESTDIR)$($<)/

$(manp): %.1 : %.1.txt
	python3 -m asciidoc.a2x -f manpage $<

progsymlink:
	(cd $(DESTDIR)$(progdir); ln -sf asciidoc.py asciidoc)
	(cd $(DESTDIR)$(progdir); ln -sf a2x.py a2x)

##.

##   version: print out the version to use for the other targets
.PHONY: version
version:
	@echo "Version $(ASCIIDOCVERSION) (released $(ASCIIDOCDATE))";

##   vers_update: updates the version string in asciidoc and a2x
.PHONY: vers_update
vers_update:
	@for f in $(prog); do \
		echo "Setting VERSION in $$f to $(ASCIIDOCVERSION)"; \
		$(SED) "s#^VERSION = '.*'#VERSION = '$(ASCIIDOCVERSION)'#" $$f > $$f.out; \
		mv $$f.out $$f; \
		chmod +x $$f; \
	done

##.

DOC_FILES = CHANGELOG.txt README.asciidoc BUGS.txt INSTALL.txt doc/a2x.1.txt \
	 		doc/faq.txt doc/asciidocapi.txt doc/testasciidoc.txt \
			doc/epub-notes.txt doc/publishing-ebooks-with-asciidoc.txt \
			doc/source-highlight-filter.txt doc/slidy.txt doc/slidy-example.txt

WEBSITE_FILES = $(wildcard website/*.txt)

##   spell: run doc_spell and website_spell
.PHONY: spell
spell: doc_spell website_spell


##   doc_spell: run aspell over all files under doc/
.PHONY: doc_spell
doc_spell:
	@for f in $(DOC_FILES); do \
		echo "aspell check -p ./doc/asciidoc.dict $$f"; \
		aspell check -p ./doc/asciidoc.dict $$f; \
	done

##   website_spell: run aspell over all files under website/
.PHONY: website_spell
website_spell:
	@for f in $(WEBSITE_FILES); do \
		echo "aspell check -p ./website/asciidoc-website.dict $$f"; \
		aspell check -p ./website/asciidoc-website.dict $$f; \
	done

##.

##   install: install asciidoc to target directory
.PHONY: install
install: all $(PROGTARGETS) $(DATATARGETS) progsymlink

##   build: runs manpages
.PHONY: build
build: manpages

##   manpages: generate manpages for asciidoc, a2x, and testasciidoc
manpages: doc/asciidoc.1 doc/a2x.1 doc/testasciidoc.1

##   docs: install documentation files to filesystem (e.g. /usr/local/share/doc/asciidoc)
docs:
	$(INSTALL) -d $(DESTDIR)$(docdir)
	$(INSTALL_DATA) $(doc) $(DESTDIR)$(docdir)
	$(INSTALL) -d $(DESTDIR)$(docdir)/docbook-xsl
	$(INSTALL_DATA) docbook-xsl/asciidoc-docbook-xsl.txt $(DESTDIR)$(docdir)/docbook-xsl
	$(INSTALL) -d $(DESTDIR)$(docdir)/dblatex
	$(INSTALL_DATA) dblatex/dblatex-readme.txt $(DESTDIR)$(docdir)/dblatex
	$(INSTALL) -d $(DESTDIR)$(docdir)/stylesheets
	$(INSTALL_DATA) $(css) $(DESTDIR)$(docdir)/stylesheets
	$(INSTALL) -d $(DESTDIR)$(docdir)/javascripts
	$(INSTALL_DATA) $(js) $(DESTDIR)$(docdir)/javascripts
	$(INSTALL) -d $(DESTDIR)$(docdir)/images
	( cd images && \
		cp -R * $(DESTDIR)$(docdir)/images )
	$(INSTALL) -d $(DESTDIR)$(docdir)/doc
	( cd doc && \
		cp -R * $(DESTDIR)$(docdir)/doc )
	$(INSTALL) -d $(DESTDIR)$(docdir)/website
	( cd website && \
		cp -R * $(DESTDIR)$(docdir)/website )

##   website: generates the website into ./gh-pages directory (which will point at gh-pages branch)
.PHONY: website
website:
	bash build_website.sh

##   tags: generate tags index files for use with vim and other tags-capable editors
.PHONY: tags
tags:
	rm -f tags
	ctags asciidoc.py asciidocapi.py tests/testasciidoc.py

##   uninstall: uninstall asciidoc
.PHONY: uninstall
uninstall:
	rm -f $(DESTDIR)$(progdir)/asciidoc
	rm -f $(DESTDIR)$(progdir)/asciidoc.py
	rm -f $(DESTDIR)$(progdir)/a2x
	rm -f $(DESTDIR)$(progdir)/a2x.py
	rm -f $(DESTDIR)$(manpdir)/asciidoc.1
	rm -f $(DESTDIR)$(manpdir)/testasciidoc.1
	rm -f $(DESTDIR)$(manpdir)/a2x.1
	rm -rf $(DESTDIR)$(confdir)
	rm -rf $(DESTDIR)$(docdir)

##   clean: delete built asciidoc doc files
.PHONY: clean
clean:
	rm -f $(manp)

MANIFEST: MANIFEST.in
	bash build_manifest.sh

##.
##   dist: creates the zip and tarball for release
.PHONY: dist
dist: vers_update manpages MANIFEST
	mkdir -p build
	rm -rf build/*
	tar -czf build/asciidoc-tmp.tar.gz -T MANIFEST
	mkdir -p build/asciidoc-$(ASCIIDOCVERSION)
	tar -xf build/asciidoc-tmp.tar.gz -C build/asciidoc-$(ASCIIDOCVERSION)
	cd build && tar -czf asciidoc-$(ASCIIDOCVERSION).tar.gz asciidoc-$(ASCIIDOCVERSION) && zip -r asciidoc-$(ASCIIDOCVERSION).zip asciidoc-$(ASCIIDOCVERSION)
	rm -rf build/asciidoc-tmp.tar.gz
	rm -rf build/asciidoc-$(ASCIIDOCVERSION)

##.
##   test: run the asciidoc test suite
.PHONY: test
test:
	python3 ./asciidoc/asciidoc.py --doctest
	python3 tests/testasciidoc.py run