[90374] branches/new-help-system/base/doc/Makefile

raimue at macports.org raimue at macports.org
Sat Mar 3 15:17:09 PST 2012


Revision: 90374
          http://trac.macports.org/changeset/90374
Author:   raimue at macports.org
Date:     2012-03-03 15:17:06 -0800 (Sat, 03 Mar 2012)
Log Message:
-----------
Handle bootstrapping by using pre-generated man pages only.
Print instructions for xml and html targets when modifying source files.
Do not delete generated man pages on clean.

Modified Paths:
--------------
    branches/new-help-system/base/doc/Makefile

Modified: branches/new-help-system/base/doc/Makefile
===================================================================
--- branches/new-help-system/base/doc/Makefile	2012-03-03 21:59:26 UTC (rev 90373)
+++ branches/new-help-system/base/doc/Makefile	2012-03-03 23:17:06 UTC (rev 90374)
@@ -1,6 +1,15 @@
-ASCIIDOC=	${prefix}/bin/asciidoc
+# If this is a selfupdate, we never want to run any tools from the target
+# prefix (could be broken or wrong architecture), otherwise try to use the
+# tools from the target prefix for generating man pages if they exist
+ifeq ($(SELFUPATING),1)
+ASCIIDOC=
+XSLTPROC=
+else
+ASCIIDOC=	$(wildcard ${prefix}/bin/asciidoc)
+XSLTPROC=	$(wildcard ${prefix}/bin/xsltproc)
+endif
+
 ASCIIDOCFLAGS=	-f asciidoc.conf -a manversion=${MACPORTS_VERSION}
-XSLTPROC=	${prefix}/bin/xsltproc
 XSLTFLAGS=	-nonet
 
 MAN1=		port.1 \
@@ -19,6 +28,14 @@
 MAN5=		macports.conf.5
 MAN7=		portfile.7 portstyle.7 porthier.7 portgroup.7
 MAN=		${MAN1} ${MAN5} ${MAN7}
+
+# Filter man pages with existing source files
+MANTXT=		$(wildcard ${MAN:%=%.txt})
+# Only those can be transformed into XML
+MANXML=		${MANTXT:.txt=.xml}
+# HTML version for all man pages
+MANHTML=	${MAN:%=%.html}
+
 CONF=       macports.conf pubkeys.conf sources.conf variants.conf
 INSTALLDIR=	${DESTDIR}${prefix}
 TOPSRCDIR=	..
@@ -39,12 +56,11 @@
 
 man: ${MAN} ${MAN:%=%.gz}
 
-xml: ${MAN:%=%.xml}
+xml: ${MANXML}
 
-html: ${MAN:%=%.html}
+html: ${MANHTML}
 
 clean:
-	rm -f *.{1,5,7}
 	rm -f *.{1,5,7}.html
 	rm -f *.{1,5,7}.xml
 	rm -f *.{1,5,7}.gz
@@ -64,20 +80,34 @@
 %.7.gz: %.7
 	gzip -c $^ > $@
 
-%.xml: %.txt asciidoc.conf
-	$(ASCIIDOC) $(ASCIIDOCFLAGS) -d manpage -b docbook $<
-
 %: %.soelim
 	ln -f $< $@
 
+%.html: %.soelim
+	ln -sf $(shell basename $$(awk '{print $$2}' < $<)).html $@
+
+# Define these rules only if both asciidoc and xsltproc are available
+ifneq ($(ASCIIDOC)$(XSLTPROC),)
 %: %.xml manpage.xsl
 	$(XSLTPROC) $(XSLTFLAGS) manpage.xsl $<
 
+%.xml: %.txt asciidoc.conf
+	$(ASCIIDOC) $(ASCIIDOCFLAGS) -d manpage -b docbook $<
+
 %.html: %.txt asciidoc.conf
 	$(ASCIIDOC) $(ASCIIDOCFLAGS) -d manpage -b xhtml11 $<
+else
+man: ${MAN} ${MAN:%=%.gz}
+	@echo "* Warning: Using pre-generated man pages only."
+	@echo "* asciidoc and xsltproc are required to generate man pages from source."
 
-%.html: %.soelim
-	ln -sf $(shell basename $$(awk '{print $$2}' < $<)).html $@
+%.xml %.html: | %.txt
+	@echo "* In order to modify and generate output from these source files,"
+	@echo "* please install asciidoc and xsltproc or use"
+	@echo "*   $(MAKE) ASCIIDOC=.../bin/asciidoc XSLTPROC=../bin/xsltproc"
+	@echo "* with appropriate paths."
+	@exit 1
+endif
 
 install: all
 	$(INSTALL) -d -o ${DSTUSR} -g ${DSTGRP} -m ${DSTMODE} ${INSTALLDIR}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20120303/8749a050/attachment.html>


More information about the macports-changes mailing list