aboutsummaryrefslogtreecommitdiffstats
path: root/txt/Makefile
blob: 0e4cfb451a56dcab1e5e614ea944c10e89696607 (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
## -----------------------------------------------------------------------
##
##   Copyright 2012 Gene Cumm
##
##   Some logic from win32/Makefile:
##     Copyright 1998-2008 H. Peter Anvin - All Rights Reserved
##     Copyright 2010 Intel Corporation; author: H. Peter Anvin
##
##   This program is free software; you can redistribute it and/or modify
##   it under the terms of the GNU General Public License as published by
##   the Free Software Foundation, Inc., 53 Temple Place Ste 330,
##   Boston MA 02111-1307, USA; either version 2 of the License, or
##   (at your option) any later version; incorporated herein by reference.
##
## -----------------------------------------------------------------------

##
## AsciiDoc documentation for syslinux
##

topdir = ..
MAKEDIR = $(topdir)/mk
# include $(MAKEDIR)/embedded.mk

VPATH = $(SRC)

A2X_OPTS	 = -k
# A2X_OPTS	+= -v
A2X_MAN_OPTS	 = -D man -f manpage

DOCS 		 = syslinux.txt syslinux-cli.txt syslinux.cfg.txt
MAN_DOCS	 = man/syslinux.1 man/syslinux-cli.1 man/syslinux.cfg.5
HTML_DOCS	:= $(patsubst %.txt,html/%.html,$(DOCS)) 
XHTML_DOCS	:= $(patsubst %.txt,%.html,$(DOCS))
# MAN_DOCS	:= $(patsubst %.txt,man/%.1,$(DOCS1)) $(patsubst %.txt,man/%.5,$(DOCS5))
TEXT_DOCS	:= $(patsubst %.txt,%.text,$(DOCS))
PDF_DOCS	:= $(patsubst %.txt,%.pdf,$(DOCS))
TARGETS		 =

# ASCIIDOC_OK := $(shell which asciidoc 2>&1 ; echo $$?)
ASCIIDOC_OK	:= $(shell which asciidoc > /dev/null ; echo $$?)
A2X_XML_OK	:= $(shell a2x $(A2X_OPTS) -f docbook hello.txt 2>&1 ; echo $$?)
ifeq ($(A2X_XML_OK),0)
A2X_MAN_OK	:= $(shell [ ! -d man ] && mkdir man ; a2x $(A2X_MAN_OPTS) hello.txt 2>&1 ; echo $$?)
A2X_XHTML_OK	:= $(shell a2x $(A2X_OPTS) -f xhtml hello.xml 2>&1 ; echo $$?)
A2X_TEXT_OK	:= $(shell a2x $(A2X_OPTS) -f text hello.xml 2>&1 ; echo $$?)
endif

ifeq ($(ASCIIDOC_OK),0)
TARGETS		+= $(HTML_DOCS)
endif
ifeq ($(A2X_MAN_OK),0)
TARGETS		+= $(MAN_DOCS)
endif
ifeq ($(A2X_XHTML_OK),0)
TARGETS		+= $(XHTML_DOCS)
endif
ifeq ($(A2X_TEXT_OK),0)
TARGETS		+= $(TEXT_DOCS)
endif

# $(HTML_DOCS) $(MAN_DOCS) $(XHTML_DOCS) $(TEXT_DOCS)
all:	$(TARGETS)

syslinux.cfg.txt:	com-bug.txt com-rpt.txt

# During 'make all', *.xml is kept but deleted at the end; do we _really_
#	need the XML longer?
.PRECIOUS:	%.xml

# %.html:	%.txt
# 	asciidoc -D html $<

html/ man/ text/ xhtml/:
	mkdir $@

html/%.html:	%.txt html/
	asciidoc -o $@ $<

# As of AsciiDoc-8.5.2, altering the output filename for a2x does not appear possible
# xhtml/%.html:	%.txt
# 	a2x $(A2X_OPTS) -D xhtml -f xhtml $<
# text/%.text:	%.xml %.txt
# 	a2x $(A2X_OPTS) -D text -f text $<

%.xml:	%.txt
	a2x $(A2X_OPTS) -f docbook $<

# when %.xml is missing, an update to %.txt must force regeneration
%.html:	%.xml %.txt
	a2x $(A2X_OPTS) -f xhtml $<

man/%.1:	%.txt man/
	a2x $(A2X_MAN_OPTS) $<

man/%.5:	%.txt man/
	a2x $(A2X_MAN_OPTS) $<

%.text:	%.xml %.txt
	a2x $(A2X_OPTS) -f text $<

%.pdf:	%.xml %.txt
	a2x $(A2X_OPTS) -f pdf $<

tidy dist:
	rm -f *~ *.xml *.text.html text/*.text.html text/*.xml xhtml/*.xml

clean: tidy

spotless: clean
	rm -f *.1 *.5 *.css *.html *.text html/*.html man/*.1 man/*.5 text/*.text xhtml/*.html xhtml/*.css

-include .*.d