Ignore:
Timestamp:
22/08/2009 21:22:41 (3 years ago)
Author:
chris
Message:

Make generation of documentation quieter.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • box/trunk/docs/Makefile

    r2515 r2550  
    1  
    2  
    31# Process DocBook to HTML 
    42 
    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 
     11all: docs 
     12 
     13DBPROC_COMMAND = xsltproc 
     14MKDIR_COMMAND  = mkdir 
     15CP_COMMAND     = cp 
     16PERL_COMMAND   = perl 
     17RM_COMMAND     = rm -f 
     18TAR_COMMAND    = tar 
     19GZIP_COMMAND   = gzip -f 
     20GENERATE_SCRIPT = tools/generate_except_xml.pl 
     21 
     22DBPROC   = $(DBPROC_COMMAND) 
     23MKDIR    = $(MKDIR_COMMAND) 
     24CP       = $(CP_COMMAND) 
     25GENERATE = $(PERL_COMMAND) $(GENERATE_SCRIPT) 
     26RM_QUIET = $(RM_COMMAND) 
     27TAR      = $(TAR_COMMAND) 
     28GZIP     = $(GZIP_COMMAND) 
     29PROGRESS = @ 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. 
     33define IGNORED_BY_GNU_MAKE: 
     34.if 0 
     35endef 
     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 
     47define 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) 
     65endef 
     66.endfor : 
     67 
     68PROGRESS_RM = $(PROGRESS) "  [RM]      " 
    669 
    770DOCBOOK_DIR = docbook 
     
    1679.SUFFIXES: .html .xml .gz .1 .5 .8 
    1780 
    18 all: docs 
    19  
    2081docs: instguide adminguide manpages 
    2182        @mkdir -p $(HTML_DIR)/images 
     
    2687adminguide: $(DOCBOOK_DIR)/ExceptionCodes.xml $(HTML_DIR)/adminguide/index.html  
    2788 
    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 
    2991$(HTML_DIR)/adminguide/index.html: $(BOOKXSL) $(DOCBOOK_DIR)/adminguide.xml 
    30         $(DBPROC) -o $(HTML_DIR)/adminguide/ $> 
     92        $(DBPROC) -o $(HTML_DIR)/adminguide/ $^ $> 
    3193 
    3294instguide: $(HTML_DIR)/instguide/index.html  
    3395 
    3496$(HTML_DIR)/instguide/index.html: $(BOOKXSL) $(DOCBOOK_DIR)/instguide.xml 
    35         $(DBPROC) -o $(HTML_DIR)/instguide/ $> 
     97        $(DBPROC) -o $(HTML_DIR)/instguide/ $^ $> 
    3698 
    37 # $< is empty on BSD make when making this rule, $> has all sources 
    38 # $< has the target on GNU make, $> is empty 
     99# On BSD make, $> contains all sources and $^ is empty  
     100# On GNU make, $^ contains all sources and $> is empty 
    39101$(DOCBOOK_DIR)/ExceptionCodes.xml: ../ExceptionCodes.txt 
    40         perl tools/generate_except_xml.pl $< $> $@ 
     102        $(GENERATE) $> $^ $@ 
    41103 
    42104manpages: man-dirs man-nroff man-html 
     
    67129man-html: $(HTML_FILES) 
    68130 
    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 
    72132 
    73133# 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 $@ $^ 
    77136 
    78137# 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) $< 
    82152 
    83153# BSD make: the final colon (:) is required to make the .for and .endfor 
     
    86156 
    87157.for MAN_PAGE in $(NROFF_PAGES) : 
    88 $(MAN_DIR)/$(MAN_PAGE).gz: $(DOCBOOK_DIR)/$(MAN_PAGE:R).xml 
    89         $(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=) 
    91161 
    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) 
    94165.endfor : 
    95166 
    96 dockit: clean docs 
    97         tar zcf documentation-kit-0.10.tar.gz $(HTML_DIR)/ 
     167dockit: clean docs documentation-kit-0.10.tar.gz 
     168 
     169documentation-kit-0.10.tar.gz: 
     170        $(TAR) zcf documentation-kit-0.10.tar.gz $(HTML_DIR)/ 
    98171 
    99172clean: 
    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) 
    104175 
     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.