[e16e8f2] | 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. |
---|
| 14 | ## |
---|
| 15 | ## ----------------------------------------------------------------------- |
---|
| 16 | |
---|
| 17 | ## |
---|
| 18 | ## AsciiDoc documentation for syslinux |
---|
| 19 | ## |
---|
| 20 | |
---|
| 21 | topdir = .. |
---|
| 22 | MAKEDIR = $(topdir)/mk |
---|
| 23 | # include $(MAKEDIR)/embedded.mk |
---|
| 24 | |
---|
| 25 | VPATH = $(SRC) |
---|
| 26 | |
---|
| 27 | A2X_OPTS = -k |
---|
| 28 | # A2X_OPTS += -v |
---|
| 29 | A2X_MAN_OPTS = -D man -f manpage |
---|
| 30 | |
---|
| 31 | DOCS = syslinux.txt syslinux-cli.txt syslinux.cfg.txt \ |
---|
| 32 | isolinux.txt pxelinux.txt |
---|
| 33 | MAN_DOCS = man/syslinux.1 man/syslinux-cli.1 man/syslinux.cfg.5 \ |
---|
| 34 | man/isolinux.1 man/pxelinux.1 |
---|
| 35 | HTML_DOCS := $(patsubst %.txt,html/%.html,$(DOCS)) |
---|
| 36 | XHTML_DOCS := $(patsubst %.txt,%.html,$(DOCS)) |
---|
| 37 | # MAN_DOCS := $(patsubst %.txt,man/%.1,$(DOCS1)) $(patsubst %.txt,man/%.5,$(DOCS5)) |
---|
| 38 | TEXT_DOCS := $(patsubst %.txt,%.text,$(DOCS)) |
---|
| 39 | PDF_DOCS := $(patsubst %.txt,%.pdf,$(DOCS)) |
---|
| 40 | TARGETS = |
---|
| 41 | |
---|
| 42 | # ASCIIDOC_OK := $(shell which asciidoc 2>&1 ; echo $$?) |
---|
| 43 | ASCIIDOC_OK := $(shell which asciidoc > /dev/null ; echo $$?) |
---|
| 44 | A2X_XML_OK := $(shell a2x $(A2X_OPTS) -f docbook hello.txt 2>&1 ; echo $$?) |
---|
| 45 | ifeq ($(A2X_XML_OK),0) |
---|
| 46 | A2X_MAN_OK := $(shell [ ! -d man ] && mkdir man ; a2x $(A2X_MAN_OPTS) hello.txt 2>&1 ; echo $$?) |
---|
| 47 | A2X_XHTML_OK := $(shell a2x $(A2X_OPTS) -f xhtml hello.xml 2>&1 ; echo $$?) |
---|
| 48 | A2X_TEXT_OK := $(shell a2x $(A2X_OPTS) -f text hello.xml 2>&1 ; echo $$?) |
---|
| 49 | endif |
---|
| 50 | |
---|
| 51 | ifeq ($(ASCIIDOC_OK),0) |
---|
| 52 | TARGETS += $(HTML_DOCS) |
---|
| 53 | endif |
---|
| 54 | ifeq ($(A2X_MAN_OK),0) |
---|
| 55 | TARGETS += $(MAN_DOCS) |
---|
| 56 | endif |
---|
| 57 | ifeq ($(A2X_XHTML_OK),0) |
---|
| 58 | TARGETS += $(XHTML_DOCS) |
---|
| 59 | endif |
---|
| 60 | ifeq ($(A2X_TEXT_OK),0) |
---|
| 61 | TARGETS += $(TEXT_DOCS) |
---|
| 62 | endif |
---|
| 63 | |
---|
| 64 | # $(HTML_DOCS) $(MAN_DOCS) $(XHTML_DOCS) $(TEXT_DOCS) |
---|
| 65 | all: $(TARGETS) |
---|
| 66 | |
---|
| 67 | syslinux.cfg.txt: com-bug.txt com-rpt.txt |
---|
| 68 | |
---|
| 69 | # During 'make all', *.xml is kept but deleted at the end; do we _really_ |
---|
| 70 | # need the XML longer? |
---|
| 71 | .PRECIOUS: %.xml |
---|
| 72 | |
---|
| 73 | # %.html: %.txt |
---|
| 74 | # asciidoc -D html $< |
---|
| 75 | |
---|
| 76 | # Mark as .PHONY so they're ignored if found in VPATH |
---|
| 77 | .PHONY: html/ man/ text/ xhtml/ |
---|
| 78 | |
---|
| 79 | html/ man/ text/ xhtml/: |
---|
| 80 | mkdir -p $@ |
---|
| 81 | |
---|
| 82 | html/%.html: %.txt | html/ |
---|
| 83 | asciidoc -o $@ $< |
---|
| 84 | |
---|
| 85 | # As of AsciiDoc-8.5.2, altering the output filename for a2x does not appear possible |
---|
| 86 | # xhtml/%.html: %.txt |
---|
| 87 | # a2x $(A2X_OPTS) -D xhtml -f xhtml $< |
---|
| 88 | # text/%.text: %.xml %.txt |
---|
| 89 | # a2x $(A2X_OPTS) -D text -f text $< |
---|
| 90 | |
---|
| 91 | %.xml: %.txt |
---|
| 92 | a2x $(A2X_OPTS) -f docbook $< |
---|
| 93 | |
---|
| 94 | # when %.xml is missing, an update to %.txt must force regeneration |
---|
| 95 | %.html: %.xml %.txt |
---|
| 96 | a2x $(A2X_OPTS) -f xhtml $< |
---|
| 97 | |
---|
| 98 | man/%.1: %.txt | man/ |
---|
| 99 | a2x $(A2X_MAN_OPTS) $< |
---|
| 100 | |
---|
| 101 | man/%.5: %.txt | man/ |
---|
| 102 | a2x $(A2X_MAN_OPTS) $< |
---|
| 103 | |
---|
| 104 | %.text: %.xml %.txt |
---|
| 105 | a2x $(A2X_OPTS) -f text $< |
---|
| 106 | |
---|
| 107 | %.pdf: %.xml %.txt |
---|
| 108 | a2x $(A2X_OPTS) -f pdf $< |
---|
| 109 | |
---|
| 110 | tidy dist: |
---|
| 111 | rm -f *~ *.xml *.text.html text/*.text.html text/*.xml xhtml/*.xml |
---|
| 112 | |
---|
| 113 | clean: tidy |
---|
| 114 | |
---|
| 115 | spotless: clean |
---|
| 116 | rm -f *.1 *.5 *.css *.html *.text html/*.html man/*.1 man/*.5 text/*.text xhtml/*.html xhtml/*.css |
---|
| 117 | |
---|
| 118 | -include .*.d |
---|