These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / Documentation / DocBook / Makefile
index b6a6a2e..91f6d89 100644 (file)
@@ -14,8 +14,8 @@ DOCBOOKS := z8530book.xml device-drivers.xml \
            genericirq.xml s390-drivers.xml uio-howto.xml scsi.xml \
            80211.xml debugobjects.xml sh.xml regulator.xml \
            alsa-driver-api.xml writing-an-alsa-driver.xml \
-           tracepoint.xml drm.xml media_api.xml w1.xml \
-           writing_musb_glue_layer.xml crypto-API.xml
+           tracepoint.xml gpu.xml media_api.xml w1.xml \
+           writing_musb_glue_layer.xml crypto-API.xml iio.xml
 
 include Documentation/DocBook/media/Makefile
 
@@ -56,16 +56,25 @@ htmldocs: $(HTML)
 
 MAN := $(patsubst %.xml, %.9, $(BOOKS))
 mandocs: $(MAN)
-       find $(obj)/man -name '*.9' | xargs gzip -f
+       find $(obj)/man -name '*.9' | xargs gzip -nf
 
 installmandocs: mandocs
        mkdir -p /usr/local/man/man9/
-       install $(obj)/man/*.9.gz /usr/local/man/man9/
+       find $(obj)/man -name '*.9.gz' -printf '%h %f\n' | \
+               sort -k 2 -k 1 | uniq -f 1 | sed -e 's: :/:' | \
+               xargs install -m 644 -t /usr/local/man/man9/
 
 ###
 #External programs used
-KERNELDOC = $(srctree)/scripts/kernel-doc
-DOCPROC   = $(objtree)/scripts/docproc
+KERNELDOCXMLREF = $(srctree)/scripts/kernel-doc-xml-ref
+KERNELDOC       = $(srctree)/scripts/kernel-doc
+DOCPROC         = $(objtree)/scripts/docproc
+CHECK_LC_CTYPE = $(objtree)/scripts/check-lc_ctype
+
+# Use a fixed encoding - UTF-8 if the C library has support built-in
+# or ASCII if not
+LC_CTYPE := $(call try-run, LC_CTYPE=C.UTF-8 $(CHECK_LC_CTYPE),C.UTF-8,C)
+export LC_CTYPE
 
 XMLTOFLAGS = -m $(srctree)/$(src)/stylesheet.xsl
 XMLTOFLAGS += --skip-validation
@@ -89,7 +98,7 @@ define rule_docproc
         ) > $(dir $@).$(notdir $@).cmd
 endef
 
-%.xml: %.tmpl $(KERNELDOC) $(DOCPROC) FORCE
+%.xml: %.tmpl $(KERNELDOC) $(DOCPROC) $(KERNELDOCXMLREF) FORCE
        $(call if_changed_rule,docproc)
 
 # Tell kbuild to always build the programs
@@ -140,7 +149,20 @@ quiet_cmd_db2html = HTML    $@
                echo '<a HREF="$(patsubst %.html,%,$(notdir $@))/index.html"> \
                $(patsubst %.html,%,$(notdir $@))</a><p>' > $@
 
-%.html:        %.xml
+###
+# Rules to create an aux XML and .db, and use them to re-process the DocBook XML
+# to fill internal hyperlinks
+       gen_aux_xml = :
+ quiet_gen_aux_xml = echo '  XMLREF  $@'
+silent_gen_aux_xml = :
+%.aux.xml: %.xml
+       @$($(quiet)gen_aux_xml)
+       @rm -rf $@
+       @(cat $< | egrep "^<refentry id" | egrep -o "\".*\"" | cut -f 2 -d \" > $<.db)
+       @$(KERNELDOCXMLREF) -db $<.db $< > $@
+.PRECIOUS: %.aux.xml
+
+%.html:        %.aux.xml
        @(which xmlto > /dev/null 2>&1) || \
         (echo "*** You need to install xmlto ***"; \
          exit 1)
@@ -150,12 +172,12 @@ quiet_cmd_db2html = HTML    $@
             cp $(PNG-$(basename $(notdir $@))) $(patsubst %.html,%,$@); fi
 
 quiet_cmd_db2man = MAN     $@
-      cmd_db2man = if grep -q refentry $<; then xmlto man $(XMLTOFLAGS) -o $(obj)/man $< ; fi
+      cmd_db2man = if grep -q refentry $<; then xmlto man $(XMLTOFLAGS) -o $(obj)/man/$(*F) $< ; fi
 %.9 : %.xml
        @(which xmlto > /dev/null 2>&1) || \
         (echo "*** You need to install xmlto ***"; \
          exit 1)
-       $(Q)mkdir -p $(obj)/man
+       $(Q)mkdir -p $(obj)/man/$(*F)
        $(call cmd,db2man)
        @touch $@
 
@@ -209,15 +231,18 @@ dochelp:
 ###
 # Temporary files left by various tools
 clean-files := $(DOCBOOKS) \
-       $(patsubst %.xml, %.dvi,  $(DOCBOOKS)) \
-       $(patsubst %.xml, %.aux,  $(DOCBOOKS)) \
-       $(patsubst %.xml, %.tex,  $(DOCBOOKS)) \
-       $(patsubst %.xml, %.log,  $(DOCBOOKS)) \
-       $(patsubst %.xml, %.out,  $(DOCBOOKS)) \
-       $(patsubst %.xml, %.ps,   $(DOCBOOKS)) \
-       $(patsubst %.xml, %.pdf,  $(DOCBOOKS)) \
-       $(patsubst %.xml, %.html, $(DOCBOOKS)) \
-       $(patsubst %.xml, %.9,    $(DOCBOOKS)) \
+       $(patsubst %.xml, %.dvi,     $(DOCBOOKS)) \
+       $(patsubst %.xml, %.aux,     $(DOCBOOKS)) \
+       $(patsubst %.xml, %.tex,     $(DOCBOOKS)) \
+       $(patsubst %.xml, %.log,     $(DOCBOOKS)) \
+       $(patsubst %.xml, %.out,     $(DOCBOOKS)) \
+       $(patsubst %.xml, %.ps,      $(DOCBOOKS)) \
+       $(patsubst %.xml, %.pdf,     $(DOCBOOKS)) \
+       $(patsubst %.xml, %.html,    $(DOCBOOKS)) \
+       $(patsubst %.xml, %.9,       $(DOCBOOKS)) \
+       $(patsubst %.xml, %.aux.xml, $(DOCBOOKS)) \
+       $(patsubst %.xml, %.xml.db,  $(DOCBOOKS)) \
+       $(patsubst %.xml, %.xml,     $(DOCBOOKS)) \
        $(index)
 
 clean-dirs := $(patsubst %.xml,%,$(DOCBOOKS)) man