1BOOKS	:= wanbook.sgml z8530book.sgml mcabook.sgml videobook.sgml \
2	   kernel-api.sgml parportbook.sgml kernel-hacking.sgml \
3	   kernel-locking.sgml via-audio.sgml mousedrivers.sgml sis900.sgml \
4	   deviceiobook.sgml procfs-guide.sgml tulip-user.sgml \
5	   journal-api.sgml libata.sgml
6
7PS	:=	$(patsubst %.sgml, %.ps, $(BOOKS))
8PDF	:=	$(patsubst %.sgml, %.pdf, $(BOOKS))
9HTML    :=      $(patsubst %.sgml, %, $(BOOKS))
10IMG-parportbook := parport-share.fig parport-multi.fig parport-structure.fig
11EPS-parportbook := $(patsubst %.fig, %.eps, $(IMG-parportbook))
12PNG-parportbook := $(patsubst %.fig, %.png, $(IMG-parportbook))
13C-procfs-example = procfs_example.sgml
14
15books:	$(BOOKS)
16
17$(BOOKS): $(TOPDIR)/scripts/docproc
18
19.PHONY:	books ps pdf html clean mrproper
20
21ps:	$(PS)
22
23pdf:	$(PDF)
24
25html:	$(HTML)
26
27man:	kernel-api-man
28
29%.eps: %.fig
30	fig2dev -Leps $< $@
31
32%.png: %.fig
33	fig2dev -Lpng $< $@
34
35%.sgml: %.c
36	echo "<programlisting>" > $@
37	expand --tabs=8 < $< | \
38	sed -e "s/&/\\&amp;/g" \
39	    -e "s/</\\&lt;/g" \
40	    -e "s/>/\\&gt;/g" >> $@
41	echo "</programlisting>" >> $@
42
43
44$(TOPDIR)/scripts/docproc:
45	$(MAKE) -C $(TOPDIR)/scripts docproc
46
47mousedrivers.sgml: mousedrivers.tmpl
48	$(TOPDIR)/scripts/docgen <$< >$@
49
50kernel-hacking.sgml: kernel-hacking.tmpl
51	$(TOPDIR)/scripts/docgen <$< >$@
52
53kernel-locking.sgml: kernel-locking.tmpl
54	$(TOPDIR)/scripts/docgen <$< >$@
55
56wanbook.sgml: wanbook.tmpl $(TOPDIR)/drivers/net/wan/syncppp.c
57	$(TOPDIR)/scripts/docgen $(TOPDIR)/drivers/net/wan/syncppp.c \
58		<wanbook.tmpl >wanbook.sgml
59
60z8530book.sgml: z8530book.tmpl $(TOPDIR)/drivers/net/wan/z85230.c
61	$(TOPDIR)/scripts/docgen $(TOPDIR)/drivers/net/wan/z85230.c \
62		<z8530book.tmpl >z8530book.sgml
63
64via-audio.sgml: via-audio.tmpl $(TOPDIR)/drivers/sound/via82cxxx_audio.c
65	$(TOPDIR)/scripts/docgen $(TOPDIR)/drivers/sound/via82cxxx_audio.c \
66		<via-audio.tmpl >via-audio.sgml
67
68tulip-user.sgml: tulip-user.tmpl
69	$(TOPDIR)/scripts/docgen <$< >$@
70
71sis900.sgml: sis900.tmpl $(TOPDIR)/drivers/net/sis900.c
72	$(TOPDIR)/scripts/docgen $(TOPDIR)/drivers/net/sis900.c \
73		<sis900.tmpl >sis900.sgml
74
75deviceiobook.sgml: deviceiobook.tmpl
76	$(TOPDIR)/scripts/docgen <deviceiobook.tmpl >deviceiobook.sgml
77
78mcabook.sgml: mcabook.tmpl $(TOPDIR)/arch/i386/kernel/mca.c
79	$(TOPDIR)/scripts/docgen $(TOPDIR)/arch/i386/kernel/mca.c \
80		<mcabook.tmpl >mcabook.sgml
81
82libata.sgml: libata.tmpl $(TOPDIR)/drivers/scsi/libata-core.c \
83		$(TOPDIR)/drivers/scsi/libata-scsi.c	\
84		$(TOPDIR)/drivers/scsi/sata_sil.c	\
85		$(TOPDIR)/drivers/scsi/sata_via.c
86	$(TOPDIR)/scripts/docgen $(TOPDIR)/drivers/scsi/libata-core.c \
87		$(TOPDIR)/drivers/scsi/libata-scsi.c	\
88		$(TOPDIR)/drivers/scsi/sata_sil.c	\
89		$(TOPDIR)/drivers/scsi/sata_via.c	\
90		< libata.tmpl > libata.sgml
91
92videobook.sgml: videobook.tmpl $(TOPDIR)/drivers/media/video/videodev.c
93	$(TOPDIR)/scripts/docgen $(TOPDIR)/drivers/media/video/videodev.c \
94		<videobook.tmpl >videobook.sgml
95
96procfs-guide.sgml:  procfs-guide.tmpl procfs_example.sgml
97	$(TOPDIR)/scripts/docgen < procfs-guide.tmpl >$@
98
99APISOURCES :=	$(TOPDIR)/drivers/media/video/videodev.c \
100		$(TOPDIR)/arch/i386/kernel/irq.c \
101		$(TOPDIR)/arch/i386/kernel/mca.c \
102		$(TOPDIR)/arch/i386/kernel/mtrr.c \
103		$(TOPDIR)/drivers/char/misc.c \
104		$(TOPDIR)/kernel/printk.c \
105		$(TOPDIR)/drivers/net/net_init.c \
106		$(TOPDIR)/drivers/net/8390.c \
107		$(TOPDIR)/drivers/char/serial.c \
108		$(TOPDIR)/drivers/pci/pci.c \
109		$(TOPDIR)/drivers/hotplug/pci_hotplug_core.c \
110		$(TOPDIR)/drivers/hotplug/pci_hotplug_util.c \
111		$(TOPDIR)/drivers/block/ll_rw_blk.c \
112		$(TOPDIR)/drivers/sound/sound_core.c \
113		$(TOPDIR)/drivers/sound/sound_firmware.c \
114		$(TOPDIR)/drivers/net/wan/syncppp.c \
115		$(TOPDIR)/drivers/net/wan/z85230.c \
116		$(TOPDIR)/drivers/usb/usb.c \
117		$(TOPDIR)/drivers/video/fbmem.c \
118		$(TOPDIR)/drivers/video/fbcmap.c \
119		$(TOPDIR)/drivers/video/fbcon.c \
120		$(TOPDIR)/drivers/video/fbgen.c \
121		$(TOPDIR)/drivers/video/fonts.c \
122		$(TOPDIR)/drivers/video/macmodes.c \
123		$(TOPDIR)/drivers/video/modedb.c \
124		$(TOPDIR)/fs/devfs/base.c \
125		$(TOPDIR)/fs/locks.c \
126		$(TOPDIR)/include/asm-i386/bitops.h \
127		$(TOPDIR)/kernel/pm.c \
128		$(TOPDIR)/kernel/ksyms.c \
129		$(TOPDIR)/kernel/kmod.c \
130		$(TOPDIR)/kernel/module.c \
131		$(TOPDIR)/kernel/printk.c \
132		$(TOPDIR)/kernel/sched.c \
133		$(TOPDIR)/kernel/sysctl.c \
134		$(TOPDIR)/lib/string.c \
135		$(TOPDIR)/lib/vsprintf.c \
136		$(TOPDIR)/net/netsyms.c
137
138kernel-api.sgml: kernel-api.tmpl $(APISOURCES)
139	$(TOPDIR)/scripts/docgen $(APISOURCES) \
140		<kernel-api.tmpl >kernel-api.sgml
141
142kernel-api-man: $(APISOURCES)
143	@rm -rf $(TOPDIR)/Documentation/man
144	$(TOPDIR)/scripts/kernel-doc -man $^ | \
145		$(PERL) $(TOPDIR)/scripts/split-man $(TOPDIR)/Documentation/man
146
147parportbook parportbook.pdf: $(PNG-parportbook)
148parportbook.ps: $(EPS-parportbook)
149parportbook.sgml: parportbook.tmpl $(TOPDIR)/drivers/parport/init.c
150	$(TOPDIR)/scripts/docgen $(TOPDIR)/drivers/parport/init.c <$< >$@
151
152
153JBDSOURCES :=  $(TOPDIR)/include/linux/jbd.h \
154	       $(TOPDIR)/fs/jbd/journal.c \
155	       $(TOPDIR)/fs/jbd/recovery.c \
156	       $(TOPDIR)/fs/jbd/transaction.c
157
158journal-api.sgml: journal-api.tmpl $(JBDSOURCES)
159	$(TOPDIR)/scripts/docgen   $(JBDSOURCES) \
160		<journal-api.tmpl >journal-api.sgml
161
162
163DVI	:=	$(patsubst %.sgml, %.dvi, $(BOOKS))
164AUX	:=	$(patsubst %.sgml, %.aux, $(BOOKS))
165TEX	:=	$(patsubst %.sgml, %.tex, $(BOOKS))
166LOG	:=	$(patsubst %.sgml, %.log, $(BOOKS))
167OUT	:=	$(patsubst %.sgml, %.out, $(BOOKS))
168
169clean:
170	rm -f core *~
171	rm -f $(BOOKS)
172	rm -f $(DVI) $(AUX) $(TEX) $(LOG) $(OUT)
173	rm -f $(PNG-parportbook) $(EPS-parportbook)
174	rm -f $(C-procfs-example)
175
176mrproper: clean
177	rm -f $(PS) $(PDF)
178	rm -f -r $(HTML)
179	rm -f .depend
180	rm -f $(TOPDIR)/scripts/mkdep-docbook
181	rm -rf DBTOHTML_OUTPUT*
182
183%.ps : %.sgml
184	@(which db2ps > /dev/null 2>&1) || \
185	 (echo "*** You need to install DocBook stylesheets ***"; \
186	  exit 1)
187	db2ps $<
188
189%.pdf : %.sgml
190	@(which db2pdf > /dev/null 2>&1) || \
191	 (echo "*** You need to install DocBook stylesheets ***"; \
192	  exit 1)
193	db2pdf $<
194
195%:	%.sgml
196	@(which db2html > /dev/null 2>&1) || \
197	 (echo "*** You need to install DocBook stylesheets ***"; \
198	  exit 1)
199	rm -rf $@
200	db2html $<
201	if [ ! -z "$(PNG-$@)" ]; then cp $(PNG-$@) $@; fi
202
203#
204# we could have our own dependency generator
205#
206#
207# .depend: $(TOPDIR)/scripts/mkdep-docbook
208#	$(TOPDIR)/scripts/mkdep-docbook $(wildcard *.tmpl) > .depend
209
210include $(TOPDIR)/Rules.make
211
212