docs/90255: Conflict about "index.sgml" and bugs on ${DOC}.rtf

Intron intron at intron.ac
Sun Dec 11 18:30:15 UTC 2005


>Number:         90255
>Category:       docs
>Synopsis:       Conflict about "index.sgml" and bugs on ${DOC}.rtf
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-doc
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          doc-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Dec 11 18:30:10 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Intron
>Release:        7.0-CURRENT
>Organization:
Tsinghua University
>Environment:
FreeBSD celeron 7.0-CURRENT FreeBSD 7.0-CURRENT #0: Thu Nov 10 18:26:33 CST 2005
>Description:
  Conflict about "index.sgml" may cause index unable to be correctly built.
Links in index in single HTML are pointed to HTML-split files *.html.
You can have a try:
ftp://ftp.freebsd.org/pub/FreeBSD/doc/en_US.ISO8859-1/books/arch-handbook/book.html.tar.bz2

  And I cannot build ${DOC}.rtf alone.

  What's in my patch:

1.Regard "index.sgml" as temporary file, no longer as what ${DOC}.* depend on.
  And now generate "index.sgml" when updating targets ${DOC}.* .
  This measure solves the conflict that all targets depend on deferent but
  commonly-named "index.sgml"s.

  Related targets:

    index.html HTML.manifest
    ${DOC}.html
    ${DOC}.html-text
    ${DOC}.rtf
    ${DOC}.tex
    ${DOC}.tex-pdf

2.Let ${DOC}.rtf depends on ${PRINT_INDEX} and ${LOCAL_IMAGES_PNG} .
  Otherwise, it will depend on ${DOC}.html to generate ${PRINT_INDEX} and
  ${LOCAL_IMAGES_PNG}.

3.Delete target ${INDEX_SGML}, which was used to initialize index.sgml.

4.Modification on targets ${HTML_INDEX} and ${HTML_SPLIT_INDEX}:
  a. Let them depend on ${SRCS} ${LOCAL_IMAGES_TXT} .
  b. Initialize index.sgml by themselves.
  c. No longer generate index.sgml here, which is generated by ${DOC}.* .

>How-To-Repeat:
              
>Fix:
--- /root/doc.docbook.mk.orig	Sun Dec 11 07:55:11 2005
+++ doc.docbook.mk	Sun Dec 11 21:13:19 2005
@@ -427,20 +427,24 @@
 .endif
 
 #
 # Index generation
 #
-CLEANFILES+= 		${INDEX_SGML}
 
 .if defined(GEN_INDEX) && defined(HAS_INDEX)
 JADEFLAGS+=		-i chap.index
 HTML_SPLIT_INDEX?=	html-split.index
 HTML_INDEX?=		html.index
 PRINT_INDEX?=		print.index
 INDEX_SGML?=		index.sgml
 
-CLEANFILES+= 		${HTML_SPLIT_INDEX} ${HTML_INDEX} ${PRINT_INDEX}
+CLEANFILES+= 		${INDEX_SGML} ${HTML_SPLIT_INDEX} ${HTML_INDEX} ${PRINT_INDEX}
+
+INIT_INDEX_SGML_CMD=	${PERL} ${COLLATEINDEX} -i doc-index -N -o ${INDEX_SGML}
+GEN_INDEX_SGML_CMD=	${PERL} ${COLLATEINDEX} -i doc-index -g -o ${INDEX_SGML} ${.ALLSRC:M*.index}
+.else
+GEN_INDEX_SGML_CMD=	@${ECHO} "No index to generate."
 .endif
 
 .MAIN: all
 
 all: ${_docs}
@@ -460,16 +464,18 @@
 
 # HTML-SPLIT -------------------------------------------------------------
 
 .if ${STYLESHEET_TYPE} == "dsssl"
 index.html HTML.manifest: ${SRCS} ${LOCAL_IMAGES_LIB} ${LOCAL_IMAGES_PNG} \
-			  ${LOCAL_IMAGES_TXT} ${INDEX_SGML} ${HTML_SPLIT_INDEX} ${LOCAL_CSS_SHEET}
+			  ${LOCAL_IMAGES_TXT} ${HTML_SPLIT_INDEX} ${LOCAL_CSS_SHEET}
+	${GEN_INDEX_SGML_CMD}
 	${JADE_CMD} -V html-manifest ${HTMLOPTS} -ioutput.html.images \
 		${JADEOPTS} -t sgml ${MASTERDOC}
 .elif ${STYLESHEET_TYPE} == "xsl"
 index.html: ${DOC}.xml ${LOCAL_IMAGES_LIB} ${LOCAL_IMAGES_PNG} \
-	${INDEX_SGML} ${HTML_SPLIT_INDEX} ${LOCAL_CSS_SHEET}
+	${HTML_SPLIT_INDEX} ${LOCAL_CSS_SHEET}
+	${GEN_INDEX_SGML_CMD}
 	${XSLTPROC} ${XSLTPROCOPTS} --param freebsd.output.html.images "'1'" ${XSLHTMLCHUNK} \
 		${DOC}.xml
 .endif
 .if !defined(NO_TIDY)
 	-${TIDY} ${TIDYOPTS} $$(${XARGS} < HTML.manifest)
@@ -477,17 +483,19 @@
 
 # HTML -------------------------------------------------------------------
 
 .if ${STYLESHEET_TYPE} == "dsssl"
 ${DOC}.html: ${SRCS} ${LOCAL_IMAGES_LIB} ${LOCAL_IMAGES_PNG} \
-	     ${LOCAL_IMAGES_TXT} ${INDEX_SGML} ${HTML_INDEX} ${LOCAL_CSS_SHEET}
+	     ${LOCAL_IMAGES_TXT} ${HTML_INDEX} ${LOCAL_CSS_SHEET}
+	${GEN_INDEX_SGML_CMD}
 	${JADE_CMD} -V nochunks ${HTMLOPTS} -ioutput.html.images \
 		${JADEOPTS} -t sgml ${MASTERDOC} > ${.TARGET} || \
 		(${RM} -f ${.TARGET} && false)
 .elif ${STYLESHEET_TYPE} == "xsl"
 ${DOC}.html: ${DOC}.xml ${LOCAL_IMAGES_LIB} ${LOCAL_IMAGES_PNG} \
-	${INDEX_SGML} ${LOCAL_CSS_SHEET}     
+	${LOCAL_CSS_SHEET}     
+	${GEN_INDEX_SGML_CMD}
 	${XSLTPROC} ${XSLTPROCOPTS} --param freebsd.output.html.images "'1'" ${XSLHTML} \
 		${DOC}.xml > ${.TARGET}
 .endif
 .if !defined(NO_TIDY)
 	-${TIDY} ${TIDYOPTS} ${.TARGET}
@@ -495,16 +503,18 @@
 
 # HTML-TEXT --------------------------------------------------------------
 
 # Special target to produce HTML with no images in it.
 .if ${STYLESHEET_TYPE} == "dsssl"
-${DOC}.html-text: ${SRCS} ${INDEX_SGML} ${HTML_INDEX} ${LOCAL_IMAGES_TXT}
+${DOC}.html-text: ${SRCS} ${HTML_INDEX} ${LOCAL_IMAGES_TXT}
+	${GEN_INDEX_SGML_CMD}
 	${JADE_CMD} -V nochunks ${HTMLTXTOPTS} \
 		${JADEOPTS} -t sgml ${MASTERDOC} > ${.TARGET} || \
 		(${RM} -f ${.TARGET} && false)
 .elif ${STYLESHEET_TYPE} == "xsl"
-${DOC}.html-text: ${DOC}.xml ${INDEX_SGML} ${HTML_INDEX}
+${DOC}.html-text: ${DOC}.xml ${HTML_INDEX}
+	${GEN_INDEX_SGML_CMD}
 	${XSLTPROC} ${XSLTPROCOPTS} --param freebsd.output.html.images "'0'" ${XSLHTML} \
 		${DOC}.xml > ${.TARGET}
 .endif
 
 ${DOC}.html-split.tar: HTML.manifest ${LOCAL_IMAGES_LIB} \
@@ -556,11 +566,13 @@
 .endfor
 
 # RTF --------------------------------------------------------------------
 
 .if !defined(NO_TEX)
-${DOC}.rtf: ${SRCS} ${LOCAL_IMAGES_EPS} ${LOCAL_IMAGES_TXT}
+${DOC}.rtf: ${SRCS} ${LOCAL_IMAGES_EPS} ${PRINT_INDEX} \
+		${LOCAL_IMAGES_TXT} ${LOCAL_IMAGES_PNG}
+	${GEN_INDEX_SGML_CMD}
 	${JADE_CMD} -V rtf-backend ${PRINTOPTS} -ioutput.rtf.images \
 		${JADEOPTS} -t rtf -o ${.TARGET} ${MASTERDOC}
 
 ${DOC}.rtf.tar: ${DOC}.rtf ${LOCAL_IMAGES_PNG}
 	${TAR} cf ${.TARGET} ${DOC}.rtf ${IMAGES_PNG:N*share*}
@@ -574,21 +586,23 @@
 # to use different image formats, which are chosen at the .tex stage.  So,
 # we need to create a different .tex file depending on our eventual output
 # format, which will then lead on to a different .dvi file as well.
 #
 
-${DOC}.tex: ${SRCS} ${LOCAL_IMAGES_EPS} ${INDEX_SGML} ${PRINT_INDEX} \
+${DOC}.tex: ${SRCS} ${LOCAL_IMAGES_EPS} ${PRINT_INDEX} \
 		${LOCAL_IMAGES_TXT} ${LOCAL_IMAGES_EN}
+	${GEN_INDEX_SGML_CMD}
 	${JADE_CMD} -V tex-backend ${PRINTOPTS} \
 		${JADEOPTS} -t tex -o ${.TARGET} ${MASTERDOC}
 
 ${DOC}.tex-ps: ${DOC}.tex
 	${LN} -f ${.ALLSRC} ${.TARGET}
 
 .if !target(${DOC}.tex-pdf)
-${DOC}.tex-pdf: ${SRCS} ${IMAGES_PDF} ${INDEX_SGML} ${PRINT_INDEX} \
+${DOC}.tex-pdf: ${SRCS} ${IMAGES_PDF} ${PRINT_INDEX} \
 		${LOCAL_IMAGES_TXT}
+	${GEN_INDEX_SGML_CMD}
 	${RM} -f ${.TARGET}
 	${CAT} ${PDFTEX_DEF} > ${.TARGET}
 	${JADE_CMD} -V tex-backend ${PRINTOPTS} -ioutput.print.pdf \
 		${JADEOPTS} -t tex -o /dev/stdout ${MASTERDOC} >> ${.TARGET}
 .endif
@@ -674,22 +688,20 @@
 #
 # If we're not generating an index (the default) then we need to create
 # an empty index.sgml file so that we can reference index.sgml in book.sgml
 #
 
-${INDEX_SGML}:
-	${PERL} ${COLLATEINDEX} -i doc-index -N -o ${.TARGET}
 
-${HTML_INDEX}:
+${HTML_INDEX}: ${SRCS} ${LOCAL_IMAGES_TXT}
+	${INIT_INDEX_SGML_CMD}
 	${JADE_CMD} -V html-index -V nochunks ${HTMLOPTS} -ioutput.html.images \
 		${JADEOPTS} -t sgml ${MASTERDOC} > /dev/null
-	${PERL} ${COLLATEINDEX} -i doc-index -g -o ${INDEX_SGML} ${.TARGET}
 
-${HTML_SPLIT_INDEX}:
+${HTML_SPLIT_INDEX}: ${SRCS} ${LOCAL_IMAGES_TXT}
+	${INIT_INDEX_SGML_CMD}
 	${JADE_CMD} -V html-index ${HTMLOPTS} -ioutput.html.images \
 		${JADEOPTS} -t sgml ${MASTERDOC} > /dev/null
-	${PERL} ${COLLATEINDEX} -i doc-index -g -o ${INDEX_SGML} ${.TARGET}
 
 .if !target(${PRINT_INDEX})
 ${PRINT_INDEX}: ${HTML_INDEX}
 	${CP} -p ${HTML_INDEX} ${.TARGET}
 .endif	

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-doc mailing list