Changeset 2550 for box/trunk/docs/Makefile
- Timestamp:
- 22/08/2009 21:22:41 (3 years ago)
- File:
-
- 1 edited
-
box/trunk/docs/Makefile (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
box/trunk/docs/Makefile
r2515 r2550 1 2 3 1 # Process DocBook to HTML 4 2 5 DBPROC=xsltproc 3 # This makefile is a bit obfuscated so that it works correctly on both 4 # BSD and GNU make. Some parts apply to one version of make and not the 5 # other; these are marked by comments. 6 7 # The "all" target shouldn't be up here, but the trickery below defines 8 # what looks like a rule to GNU make, and so we need to define the actual 9 # default target before it. 10 11 all: docs 12 13 DBPROC_COMMAND = xsltproc 14 MKDIR_COMMAND = mkdir 15 CP_COMMAND = cp 16 PERL_COMMAND = perl 17 RM_COMMAND = rm -f 18 TAR_COMMAND = tar 19 GZIP_COMMAND = gzip -f 20 GENERATE_SCRIPT = tools/generate_except_xml.pl 21 22 DBPROC = $(DBPROC_COMMAND) 23 MKDIR = $(MKDIR_COMMAND) 24 CP = $(CP_COMMAND) 25 GENERATE = $(PERL_COMMAND) $(GENERATE_SCRIPT) 26 RM_QUIET = $(RM_COMMAND) 27 TAR = $(TAR_COMMAND) 28 GZIP = $(GZIP_COMMAND) 29 PROGRESS = @ true 30 31 # use a GNU make "define" command, that looks like a harmless dummy rule 32 # to BSD make, to hide parts of the Makefile from GNU make. 33 define IGNORED_BY_GNU_MAKE: 34 .if 0 35 endef 36 37 # seen by GNU make, not by BSD make 38 ifeq ($(V),) 39 DBPROC = @ echo " [XLSTPROC]" $^ && $(DBPROC_COMMAND) 2>/dev/null 40 GENERATE = @ echo " [GENERATE]" $@ && $(PERL_COMMAND) $(GENERATE_SCRIPT) 41 TAR = @ echo " [TAR] " $@ && $(TAR_COMMAND) 42 GZIP = @ echo " [GZIP] " $< && $(GZIP_COMMAND) 43 RM_QUIET = @ $(RM_COMMAND) 44 PROGRESS = @ echo 45 endif 46 47 define IGNORED_BY_GNU_MAKE: 48 .endif 49 50 .ifndef V 51 # seen by BSD make, not by GNU make 52 DBPROC = @ echo " [XSLTPROC]" $(.ALLSRC) && $(DBPROC_COMMAND) 2>/dev/null 53 GENERATE = @ echo " [GENERATE]" $(.TARGET) && $(PERL_COMMAND) $(GENERATE_SCRIPT) 54 TAR = @ echo " [TAR] " $(.TARGET) && $(TAR_COMMAND) 55 GZIP = @ echo " [GZIP] " $(.TARGET:.gz=) && $(GZIP_COMMAND) 56 RM_QUIET = @ $(RM_COMMAND) 57 PROGRESS = @ echo 58 .endif 59 60 # neither .endif nor endef can be followed by a colon; each creates 61 # warnings or errors in one or other version of make. we need some 62 # magic to make them both work. Luckily, .endfor ignores the colon. 63 64 .for DUMMY in $(NO_SUCH_VARIABLE) 65 endef 66 .endfor : 67 68 PROGRESS_RM = $(PROGRESS) " [RM] " 6 69 7 70 DOCBOOK_DIR = docbook … … 16 79 .SUFFIXES: .html .xml .gz .1 .5 .8 17 80 18 all: docs19 20 81 docs: instguide adminguide manpages 21 82 @mkdir -p $(HTML_DIR)/images … … 26 87 adminguide: $(DOCBOOK_DIR)/ExceptionCodes.xml $(HTML_DIR)/adminguide/index.html 27 88 28 # all sources ($>) is exactly the right args for xsltproc 89 # $^ gives all sources on GNU make, and nothing on BSD make 90 # $> gives all sources on BSD make, and nothing on GNU make 29 91 $(HTML_DIR)/adminguide/index.html: $(BOOKXSL) $(DOCBOOK_DIR)/adminguide.xml 30 $(DBPROC) -o $(HTML_DIR)/adminguide/ $ >92 $(DBPROC) -o $(HTML_DIR)/adminguide/ $^ $> 31 93 32 94 instguide: $(HTML_DIR)/instguide/index.html 33 95 34 96 $(HTML_DIR)/instguide/index.html: $(BOOKXSL) $(DOCBOOK_DIR)/instguide.xml 35 $(DBPROC) -o $(HTML_DIR)/instguide/ $ >97 $(DBPROC) -o $(HTML_DIR)/instguide/ $^ $> 36 98 37 # $< is empty on BSD make when making this rule, $> has all sources38 # $< has the target on GNU make,$> is empty99 # On BSD make, $> contains all sources and $^ is empty 100 # On GNU make, $^ contains all sources and $> is empty 39 101 $(DOCBOOK_DIR)/ExceptionCodes.xml: ../ExceptionCodes.txt 40 perl tools/generate_except_xml.pl $< $>$@102 $(GENERATE) $> $^ $@ 41 103 42 104 manpages: man-dirs man-nroff man-html … … 67 129 man-html: $(HTML_FILES) 68 130 69 # GNU make 70 $(HTML_DIR)/man-html/%.html: $(DOCBOOK_DIR)/%.xml $(NOCHUNKBOOKXSL) 71 $(DBPROC) -o $@ $(NOCHUNKBOOKXSL) $< 131 # $^ gives all sources on GNU make, and nothing on BSD make 72 132 73 133 # GNU make 74 $(MAN_DIR)/%.8.gz: $(DOCBOOK_DIR)/%.xml 75 $(DBPROC) -o $(@:.gz=) $(MANXSL) $< 76 gzip $(@:.gz=) 134 $(HTML_DIR)/man-html/%.html: $(NOCHUNKBOOKXSL) $(DOCBOOK_DIR)/%.xml 135 $(DBPROC) -o $@ $^ 77 136 78 137 # GNU make 79 $(MAN_DIR)/%.5.gz: $(DOCBOOK_DIR)/%.xml 80 $(DBPROC) -o $(@:.gz=) $(MANXSL) $< 81 gzip $(@:.gz=) 138 $(MAN_DIR)/%.8: $(MANXSL) $(DOCBOOK_DIR)/%.xml 139 $(DBPROC) -o $@ $^ 140 141 # GNU make 142 $(MAN_DIR)/%.8.gz: $(MAN_DIR)/%.8 143 $(GZIP) $< 144 145 # GNU make 146 $(MAN_DIR)/%.5: $(MANXSL) $(DOCBOOK_DIR)/%.xml $(MANXSL) 147 $(DBPROC) -o $@ $^ 148 149 # GNU make 150 $(MAN_DIR)/%.5.gz: $(MAN_DIR)/%.5 151 $(GZIP) $< 82 152 83 153 # BSD make: the final colon (:) is required to make the .for and .endfor … … 86 156 87 157 .for MAN_PAGE in $(NROFF_PAGES) : 88 $(MAN_DIR)/$(MAN_PAGE).gz: $( DOCBOOK_DIR)/$(MAN_PAGE:R).xml89 $(DBPROC) -o $(.TARGET:.gz=) $( MANXSL) $>90 gzip $(@:.gz=)158 $(MAN_DIR)/$(MAN_PAGE).gz: $(MANXSL) $(DOCBOOK_DIR)/$(MAN_PAGE:R).xml 159 $(DBPROC) -o $(.TARGET:.gz=) $(.ALLSRC) 160 $(GZIP) $(.TARGET:.gz=) 91 161 92 $(HTML_DIR)/man-html/$(MAN_PAGE:R).html: $(DOCBOOK_DIR)/$(MAN_PAGE:R).xml 93 $(DBPROC) -o $@ $(NOCHUNKBOOKXSL) $> 162 $(HTML_DIR)/man-html/$(MAN_PAGE:R).html: $(NOCHUNKBOOKXSL) \ 163 $(DOCBOOK_DIR)/$(MAN_PAGE:R).xml 164 $(DBPROC) -o $(.TARGET) $(.ALLSRC) 94 165 .endfor : 95 166 96 dockit: clean docs 97 tar zcf documentation-kit-0.10.tar.gz $(HTML_DIR)/ 167 dockit: clean docs documentation-kit-0.10.tar.gz 168 169 documentation-kit-0.10.tar.gz: 170 $(TAR) zcf documentation-kit-0.10.tar.gz $(HTML_DIR)/ 98 171 99 172 clean: 100 rm -f $(HTML_FILES) 101 rm -f $(NROFF_FILES) 102 rm -f $(DOCBOOK_DIR)/ExceptionCodes.xml 103 rm -f documentation-kit-0.10.tar.gz 173 $(PROGRESS_RM) "$(HTML_DIR)/man-html/*.html" 174 $(RM_QUIET) $(HTML_FILES) 104 175 176 $(PROGRESS_RM) "$(MAN_DIR)/*.[58].gz" 177 $(RM_QUIET) $(NROFF_FILES) 178 179 $(PROGRESS_RM) "$(DOCBOOK_DIR)/ExceptionCodes.xml" 180 $(RM_QUIET) $(DOCBOOK_DIR)/ExceptionCodes.xml 181 182 $(PROGRESS_RM) "documentation-kit-0.10.tar.gz" 183 $(RM_QUIET) documentation-kit-0.10.tar.gz
Note: See TracChangeset
for help on using the changeset viewer.
