diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /Documentation/DocBook/Makefile |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'Documentation/DocBook/Makefile')
-rw-r--r-- | Documentation/DocBook/Makefile | 195 |
1 files changed, 195 insertions, 0 deletions
diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile new file mode 100644 index 000000000000..a221039ee4c9 --- /dev/null +++ b/Documentation/DocBook/Makefile | |||
@@ -0,0 +1,195 @@ | |||
1 | ### | ||
2 | # This makefile is used to generate the kernel documentation, | ||
3 | # primarily based on in-line comments in various source files. | ||
4 | # See Documentation/kernel-doc-nano-HOWTO.txt for instruction in how | ||
5 | # to ducument the SRC - and how to read it. | ||
6 | # To add a new book the only step required is to add the book to the | ||
7 | # list of DOCBOOKS. | ||
8 | |||
9 | DOCBOOKS := wanbook.xml z8530book.xml mcabook.xml videobook.xml \ | ||
10 | kernel-hacking.xml kernel-locking.xml via-audio.xml \ | ||
11 | deviceiobook.xml procfs-guide.xml tulip-user.xml \ | ||
12 | writing_usb_driver.xml scsidrivers.xml sis900.xml \ | ||
13 | kernel-api.xml journal-api.xml lsm.xml usb.xml \ | ||
14 | gadget.xml libata.xml mtdnand.xml librs.xml | ||
15 | |||
16 | ### | ||
17 | # The build process is as follows (targets): | ||
18 | # (xmldocs) | ||
19 | # file.tmpl --> file.xml +--> file.ps (psdocs) | ||
20 | # +--> file.pdf (pdfdocs) | ||
21 | # +--> DIR=file (htmldocs) | ||
22 | # +--> man/ (mandocs) | ||
23 | |||
24 | ### | ||
25 | # The targets that may be used. | ||
26 | .PHONY: xmldocs sgmldocs psdocs pdfdocs htmldocs mandocs installmandocs | ||
27 | |||
28 | BOOKS := $(addprefix $(obj)/,$(DOCBOOKS)) | ||
29 | xmldocs: $(BOOKS) | ||
30 | sgmldocs: xmldocs | ||
31 | |||
32 | PS := $(patsubst %.xml, %.ps, $(BOOKS)) | ||
33 | psdocs: $(PS) | ||
34 | |||
35 | PDF := $(patsubst %.xml, %.pdf, $(BOOKS)) | ||
36 | pdfdocs: $(PDF) | ||
37 | |||
38 | HTML := $(patsubst %.xml, %.html, $(BOOKS)) | ||
39 | htmldocs: $(HTML) | ||
40 | |||
41 | MAN := $(patsubst %.xml, %.9, $(BOOKS)) | ||
42 | mandocs: $(MAN) | ||
43 | |||
44 | installmandocs: mandocs | ||
45 | $(MAKEMAN) install Documentation/DocBook/man | ||
46 | |||
47 | ### | ||
48 | #External programs used | ||
49 | KERNELDOC = scripts/kernel-doc | ||
50 | DOCPROC = scripts/basic/docproc | ||
51 | SPLITMAN = $(PERL) $(srctree)/scripts/split-man | ||
52 | MAKEMAN = $(PERL) $(srctree)/scripts/makeman | ||
53 | |||
54 | ### | ||
55 | # DOCPROC is used for two purposes: | ||
56 | # 1) To generate a dependency list for a .tmpl file | ||
57 | # 2) To preprocess a .tmpl file and call kernel-doc with | ||
58 | # appropriate parameters. | ||
59 | # The following rules are used to generate the .xml documentation | ||
60 | # required to generate the final targets. (ps, pdf, html). | ||
61 | quiet_cmd_docproc = DOCPROC $@ | ||
62 | cmd_docproc = SRCTREE=$(srctree)/ $(DOCPROC) doc $< >$@ | ||
63 | define rule_docproc | ||
64 | set -e; \ | ||
65 | $(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))';) \ | ||
66 | $(cmd_$(1)); \ | ||
67 | ( \ | ||
68 | echo 'cmd_$@ := $(cmd_$(1))'; \ | ||
69 | echo $@: `SRCTREE=$(srctree) $(DOCPROC) depend $<`; \ | ||
70 | ) > $(dir $@).$(notdir $@).cmd | ||
71 | endef | ||
72 | |||
73 | %.xml: %.tmpl FORCE | ||
74 | $(call if_changed_rule,docproc) | ||
75 | |||
76 | ### | ||
77 | #Read in all saved dependency files | ||
78 | cmd_files := $(wildcard $(foreach f,$(BOOKS),$(dir $(f)).$(notdir $(f)).cmd)) | ||
79 | |||
80 | ifneq ($(cmd_files),) | ||
81 | include $(cmd_files) | ||
82 | endif | ||
83 | |||
84 | ### | ||
85 | # Changes in kernel-doc force a rebuild of all documentation | ||
86 | $(BOOKS): $(KERNELDOC) | ||
87 | |||
88 | ### | ||
89 | # procfs guide uses a .c file as example code. | ||
90 | # This requires an explicit dependency | ||
91 | C-procfs-example = procfs_example.xml | ||
92 | C-procfs-example2 = $(addprefix $(obj)/,$(C-procfs-example)) | ||
93 | $(obj)/procfs-guide.xml: $(C-procfs-example2) | ||
94 | |||
95 | ### | ||
96 | # Rules to generate postscript, PDF and HTML | ||
97 | # db2html creates a directory. Generate a html file used for timestamp | ||
98 | |||
99 | quiet_cmd_db2ps = DB2PS $@ | ||
100 | cmd_db2ps = db2ps -o $(dir $@) $< | ||
101 | %.ps : %.xml | ||
102 | @(which db2ps > /dev/null 2>&1) || \ | ||
103 | (echo "*** You need to install DocBook stylesheets ***"; \ | ||
104 | exit 1) | ||
105 | $(call cmd,db2ps) | ||
106 | |||
107 | quiet_cmd_db2pdf = DB2PDF $@ | ||
108 | cmd_db2pdf = db2pdf -o $(dir $@) $< | ||
109 | %.pdf : %.xml | ||
110 | @(which db2pdf > /dev/null 2>&1) || \ | ||
111 | (echo "*** You need to install DocBook stylesheets ***"; \ | ||
112 | exit 1) | ||
113 | $(call cmd,db2pdf) | ||
114 | |||
115 | quiet_cmd_db2html = DB2HTML $@ | ||
116 | cmd_db2html = db2html -o $(patsubst %.html,%,$@) $< && \ | ||
117 | echo '<a HREF="$(patsubst %.html,%,$(notdir $@))/book1.html"> \ | ||
118 | Goto $(patsubst %.html,%,$(notdir $@))</a><p>' > $@ | ||
119 | |||
120 | %.html: %.xml | ||
121 | @(which db2html > /dev/null 2>&1) || \ | ||
122 | (echo "*** You need to install DocBook stylesheets ***"; \ | ||
123 | exit 1) | ||
124 | @rm -rf $@ $(patsubst %.html,%,$@) | ||
125 | $(call cmd,db2html) | ||
126 | @if [ ! -z "$(PNG-$(basename $(notdir $@)))" ]; then \ | ||
127 | cp $(PNG-$(basename $(notdir $@))) $(patsubst %.html,%,$@); fi | ||
128 | |||
129 | ### | ||
130 | # Rule to generate man files - output is placed in the man subdirectory | ||
131 | |||
132 | %.9: %.xml | ||
133 | ifneq ($(KBUILD_SRC),) | ||
134 | $(Q)mkdir -p $(objtree)/Documentation/DocBook/man | ||
135 | endif | ||
136 | $(SPLITMAN) $< $(objtree)/Documentation/DocBook/man "$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)" | ||
137 | $(MAKEMAN) convert $(objtree)/Documentation/DocBook/man $< | ||
138 | |||
139 | ### | ||
140 | # Rules to generate postscripts and PNG imgages from .fig format files | ||
141 | quiet_cmd_fig2eps = FIG2EPS $@ | ||
142 | cmd_fig2eps = fig2dev -Leps $< $@ | ||
143 | |||
144 | %.eps: %.fig | ||
145 | @(which fig2dev > /dev/null 2>&1) || \ | ||
146 | (echo "*** You need to install transfig ***"; \ | ||
147 | exit 1) | ||
148 | $(call cmd,fig2eps) | ||
149 | |||
150 | quiet_cmd_fig2png = FIG2PNG $@ | ||
151 | cmd_fig2png = fig2dev -Lpng $< $@ | ||
152 | |||
153 | %.png: %.fig | ||
154 | @(which fig2dev > /dev/null 2>&1) || \ | ||
155 | (echo "*** You need to install transfig ***"; \ | ||
156 | exit 1) | ||
157 | $(call cmd,fig2png) | ||
158 | |||
159 | ### | ||
160 | # Rule to convert a .c file to inline XML documentation | ||
161 | %.xml: %.c | ||
162 | @echo ' GEN $@' | ||
163 | @( \ | ||
164 | echo "<programlisting>"; \ | ||
165 | expand --tabs=8 < $< | \ | ||
166 | sed -e "s/&/\\&/g" \ | ||
167 | -e "s/</\\</g" \ | ||
168 | -e "s/>/\\>/g"; \ | ||
169 | echo "</programlisting>") > $@ | ||
170 | |||
171 | ### | ||
172 | # Help targets as used by the top-level makefile | ||
173 | dochelp: | ||
174 | @echo ' Linux kernel internal documentation in different formats:' | ||
175 | @echo ' xmldocs (XML DocBook), psdocs (Postscript), pdfdocs (PDF)' | ||
176 | @echo ' htmldocs (HTML), mandocs (man pages, use installmandocs to install)' | ||
177 | |||
178 | ### | ||
179 | # Temporary files left by various tools | ||
180 | clean-files := $(DOCBOOKS) \ | ||
181 | $(patsubst %.xml, %.dvi, $(DOCBOOKS)) \ | ||
182 | $(patsubst %.xml, %.aux, $(DOCBOOKS)) \ | ||
183 | $(patsubst %.xml, %.tex, $(DOCBOOKS)) \ | ||
184 | $(patsubst %.xml, %.log, $(DOCBOOKS)) \ | ||
185 | $(patsubst %.xml, %.out, $(DOCBOOKS)) \ | ||
186 | $(patsubst %.xml, %.ps, $(DOCBOOKS)) \ | ||
187 | $(patsubst %.xml, %.pdf, $(DOCBOOKS)) \ | ||
188 | $(patsubst %.xml, %.html, $(DOCBOOKS)) \ | ||
189 | $(patsubst %.xml, %.9, $(DOCBOOKS)) \ | ||
190 | $(C-procfs-example) | ||
191 | |||
192 | clean-dirs := $(patsubst %.xml,%,$(DOCBOOKS)) | ||
193 | |||
194 | #man put files in man subdir - traverse down | ||
195 | subdir- := man/ | ||