txt/Makefile: order-only prerequisite
[syslinux.git] / txt / Makefile
blobc325c388a700baa3fe6353e0ab5b15cccd0efe43
1 ## -----------------------------------------------------------------------
2 ##
3 ## Copyright 2012 Gene Cumm
4 ##
5 ## Some logic from win32/Makefile:
6 ## Copyright 1998-2008 H. Peter Anvin - All Rights Reserved
7 ## Copyright 2010 Intel Corporation; author: H. Peter Anvin
8 ##
9 ## This program is free software; you can redistribute it and/or modify
10 ## it under the terms of the GNU General Public License as published by
11 ## the Free Software Foundation, Inc., 53 Temple Place Ste 330,
12 ## Boston MA 02111-1307, USA; either version 2 of the License, or
13 ## (at your option) any later version; incorporated herein by reference.
15 ## -----------------------------------------------------------------------
18 ## AsciiDoc documentation for syslinux
21 topdir = ..
22 MAKEDIR = $(topdir)/mk
23 # include $(MAKEDIR)/embedded.mk
25 A2X_OPTS = -k
26 # A2X_OPTS += -v
27 A2X_MAN_OPTS = -D man -f manpage
29 DOCS = syslinux.txt syslinux-cli.txt syslinux.cfg.txt
30 MAN_DOCS = man/syslinux.1 man/syslinux-cli.1 man/syslinux.cfg.5
31 HTML_DOCS := $(patsubst %.txt,html/%.html,$(DOCS))
32 XHTML_DOCS := $(patsubst %.txt,%.html,$(DOCS))
33 # MAN_DOCS := $(patsubst %.txt,man/%.1,$(DOCS1)) $(patsubst %.txt,man/%.5,$(DOCS5))
34 TEXT_DOCS := $(patsubst %.txt,%.text,$(DOCS))
35 PDF_DOCS := $(patsubst %.txt,%.pdf,$(DOCS))
36 TARGETS =
38 # ASCIIDOC_OK := $(shell which asciidoc 2>&1 ; echo $$?)
39 ASCIIDOC_OK := $(shell which asciidoc > /dev/null ; echo $$?)
40 A2X_XML_OK := $(shell a2x $(A2X_OPTS) -f docbook hello.txt 2>&1 ; echo $$?)
41 ifeq ($(A2X_XML_OK),0)
42 A2X_MAN_OK := $(shell [ ! -d man ] && mkdir man ; a2x $(A2X_MAN_OPTS) hello.txt 2>&1 ; echo $$?)
43 A2X_XHTML_OK := $(shell a2x $(A2X_OPTS) -f xhtml hello.xml 2>&1 ; echo $$?)
44 A2X_TEXT_OK := $(shell a2x $(A2X_OPTS) -f text hello.xml 2>&1 ; echo $$?)
45 endif
47 ifeq ($(ASCIIDOC_OK),0)
48 TARGETS += $(HTML_DOCS)
49 endif
50 ifeq ($(A2X_MAN_OK),0)
51 TARGETS += $(MAN_DOCS)
52 endif
53 ifeq ($(A2X_XHTML_OK),0)
54 TARGETS += $(XHTML_DOCS)
55 endif
56 ifeq ($(A2X_TEXT_OK),0)
57 TARGETS += $(TEXT_DOCS)
58 endif
60 # $(HTML_DOCS) $(MAN_DOCS) $(XHTML_DOCS) $(TEXT_DOCS)
61 all: $(TARGETS)
63 syslinux.cfg.txt: com-bug.txt com-rpt.txt
65 # During 'make all', *.xml is kept but deleted at the end; do we _really_
66 # need the XML longer?
67 .PRECIOUS: %.xml
69 # %.html: %.txt
70 # asciidoc -D html $<
72 html/ man/ text/ xhtml/:
73 mkdir $@
75 html/%.html: %.txt | html/
76 asciidoc -o $@ $<
78 # As of AsciiDoc-8.5.2, altering the output filename for a2x does not appear possible
79 # xhtml/%.html: %.txt
80 # a2x $(A2X_OPTS) -D xhtml -f xhtml $<
81 # text/%.text: %.xml %.txt
82 # a2x $(A2X_OPTS) -D text -f text $<
84 %.xml: %.txt
85 a2x $(A2X_OPTS) -f docbook $<
87 # when %.xml is missing, an update to %.txt must force regeneration
88 %.html: %.xml %.txt
89 a2x $(A2X_OPTS) -f xhtml $<
91 man/%.1: %.txt | man/
92 a2x $(A2X_MAN_OPTS) $<
94 man/%.5: %.txt | man/
95 a2x $(A2X_MAN_OPTS) $<
97 %.text: %.xml %.txt
98 a2x $(A2X_OPTS) -f text $<
100 %.pdf: %.xml %.txt
101 a2x $(A2X_OPTS) -f pdf $<
103 tidy dist:
104 rm -f *~ *.xml *.text.html text/*.text.html text/*.xml xhtml/*.xml
106 clean: tidy
108 spotless: clean
109 rm -f *.1 *.5 *.css *.html *.text html/*.html man/*.1 man/*.5 text/*.text xhtml/*.html xhtml/*.css
111 -include .*.d