2 # Makefile rules for docbook XML documents
5 ifeq ($(origin BASENAME), undefined)
6 BASENAME := $(notdir $(CURDIR))
10 ifneq ($(BASENAME).xml, $(wildcard *.xml))
14 ifeq ($(shell $(NKF) --guess $(BASENAME).xml),UTF-8)
15 ENCODING = SP_ENCODING=XML SP_CHARSET_FIXED=YES
21 ifeq ($(RESTRICT_COMMERCIAL), yes)
22 ifeq ($(RESTRICT-DIST), yes)
28 # default target by condition.
30 ifeq ($(COMPILE), yes)
31 all: index.html $(BASENAME).txt
33 install: install-work \
39 @echo Skip compilation.
41 @echo Skip installation.
50 IMAGE_EXPR = -o -name '*.gif' \
57 PS_EXPR = -o -name '*.eps' \
60 FIND_EXPR = -name "$(BASENAME).html" \
61 -o -name "$(BASENAME)-[0-9]*.html" \
62 -o -name "$(BASENAME).gz" \
63 -o -name "$(BASENAME).sgml.gz" \
64 -o -name "$(BASENAME).sgml.tar.gz" \
65 -o -name "$(BASENAME).tar.gz" \
66 -o -name "$(BASENAME).txt" \
67 -o -name "$(BASENAME).sgml" \
68 -o -name "$(BASENAME).xml.gz" \
69 -o -name "$(BASENAME).xml.tar.gz" \
70 -o -name "$(BASENAME).xml"
72 index.html: $(BASENAME).xml info
73 ifneq ($(NODELETE_OLDDOCS), yes)
74 if [ -d $(WORKDIR) ]; then \
75 find $(WORKDIR) $(FIND_EXPR) | xargs rm -f ;\
76 rm -rf $(WORK_SGML)/$(BASENAME) \
77 $(WORK_HTML)/$(BASENAME) \
78 $(WORK_HTML)/$(BASENAME)-images ;\
80 if [ -d $(FTP_ROOT) ]; then \
81 find $(FTP_ROOT) $(FIND_EXPR) | xargs rm -f ;\
83 if [ -d $(LDP_ROOT) ]; then \
84 find $(LDP_ROOT) $(FIND_EXPR) | xargs rm -f ;\
86 if [ -d $(WWW_ROOT)/JFdocs ]; then \
87 find $(WWW_ROOT)/JFdocs $(FIND_EXPR) | xargs rm -f ;\
88 rm -rf $(WWW_ROOT)/JFdocs/$(BASENAME) \
89 $(WWW_ROOT)/JFdocs/$(BASENAME)-images ;\
92 find . -name '*.html' | xargs rm -f
93 $(ENCODING) $(JADE) $(JADE_OPTION) $(JADE_ADD_OPTION) $(XMLDCL) \
95 find . -name '*.html' | while read f; do \
96 $(NKF) -w $$f > $$f.utf-8; \
97 mv $$f.utf-8 $$f; done
98 touch $(LAST_MODIFIED)
100 $(BASENAME).txt: $(BASENAME).xml info
102 $(ENCODING) $(JADE) $(JADE_OPTION) -V nochunks -V %show-ulinks% \
103 $(XMLDCL) $(BASENAME).xml | $(NKF) -s \
104 | $(HTML2TEXT) -I shift-jis -O shift-jis \
105 | perl $(BINDIR)/crlf_trim_blanks.pl >$(BASENAME).txt
106 touch $(LAST_MODIFIED)
108 $(BASENAME).tar.gz: index.html
109 find . -name '*.html' $(IMAGE_EXPR) \
110 | tar cvfz $@ --files-from=-
112 ifeq ($(MULTI_FILES), yes)
113 $(BASENAME).xml.tar.gz: $(BASENAME).xml
114 find . -name '*.xml' $(SRC_EXPR) $(IMAGE_EXPR) $(PS_EXPR) \
115 | tar cvfz $@ --files-from=-
123 ifneq ($(MULTI_FILES), yes)
126 # only one xml file, no images
129 $(WORK_TEXT)/$(BASENAME).txt \
130 $(WORK_SGML)/$(BASENAME).xml \
131 $(WORK_HTML)/$(BASENAME)/index.html
133 $(WORK_TEXT)/$(BASENAME).txt: $(BASENAME).txt
137 $(WORK_HTML)/$(BASENAME)/index.html: index.html
138 mkdir -p $(WORK_HTML)
140 $(INSTALL) *.html $(@D)
142 $(WORK_SGML)/$(BASENAME).xml: $(BASENAME).xml
147 # Install WWW contents
149 ifneq ($(INSTALL_WWW), yes)
153 $(DEST_WWW_TEXT)/$(BASENAME).txt \
154 $(DEST_WWW_SGML)/$(BASENAME).xml \
155 $(DEST_WWW_HTML)/$(BASENAME)/index.html
157 $(DEST_WWW_TEXT)/$(BASENAME).txt: $(BASENAME).txt
161 $(DEST_WWW_HTML)/$(BASENAME)/index.html: index.html
162 mkdir -p $(DEST_WWW_HTML)
164 $(INSTALL) *.html $(@D)
165 if [ -r dot.htaccess ]; then \
166 $(INSTALL) dot.htaccess $(@D)/.htaccess ; \
169 $(DEST_WWW_SGML)/$(BASENAME).xml: $(BASENAME).xml
175 # Install FTP contents
177 ifneq ($(INSTALL_FTP), yes)
181 $(DEST_FTP_TEXT)/$(BASENAME).gz \
182 $(DEST_FTP_HTML)/$(BASENAME).tar.gz \
183 $(DEST_FTP_SGML)/$(BASENAME).xml.gz
185 $(DEST_FTP_TEXT)/$(BASENAME).gz: $(BASENAME).txt
187 $(INSTALL) $< $(@:.gz=)
191 $(DEST_FTP_HTML)/$(BASENAME).tar.gz: $(BASENAME).tar.gz
195 $(DEST_FTP_SGML)/$(BASENAME).xml.gz: $(BASENAME).xml
197 $(INSTALL) $< $(@:.gz=)
203 # Install LDP translations for mirror
205 ifneq ($(INSTALL_LDP), yes)
208 ifneq ($(KIND), LDP-TRANS)
210 @echo Non-LDP document. Skipped.
212 install-ldp-mirror: \
213 $(DEST_LDP_TEXT)/$(BASENAME).gz \
214 $(DEST_LDP_HTML)/$(BASENAME).tar.gz \
215 $(DEST_LDP_SGML)/$(BASENAME).xml.gz
217 $(DEST_LDP_TEXT)/$(BASENAME).gz: $(BASENAME).txt
219 $(INSTALL) $< $(@:.gz=)
223 $(DEST_LDP_HTML)/$(BASENAME).tar.gz: $(BASENAME).tar.gz
227 $(DEST_LDP_SGML)/$(BASENAME).xml.gz: $(BASENAME).xml
229 $(INSTALL) $< $(@:.gz=)
239 # single xml file with images, multiple xml files,
240 # multiple xml files with images
243 $(WORK_TEXT)/$(BASENAME).txt \
244 $(WORK_SGML)/$(BASENAME)/$(BASENAME).xml \
245 $(WORK_HTML)/$(BASENAME)/index.html
247 $(WORK_TEXT)/$(BASENAME).txt: $(BASENAME).txt
251 $(WORK_HTML)/$(BASENAME)/index.html: index.html
252 mkdir -p $(WORK_HTML)
254 tar cf - `find . -name '*.html' $(IMAGE_EXPR)` \
255 | ( cd $(@D); tar xpf -)
257 $(WORK_SGML)/$(BASENAME)/$(BASENAME).xml: $(BASENAME).xml
258 mkdir -p $(WORK_SGML)
260 tar cf - `find . -name '*.xml' $(SRC_EXPR) $(IMAGE_EXPR) $(PS_EXPR)` \
261 | ( cd $(@D); tar xpf -)
264 # Install WWW contents
266 ifneq ($(INSTALL_WWW), yes)
270 $(DEST_WWW_TEXT)/$(BASENAME).txt \
271 $(DEST_WWW_HTML)/$(BASENAME)/index.html \
272 $(DEST_WWW_SGML)/$(BASENAME)/$(BASENAME).xml
274 $(DEST_WWW_TEXT)/$(BASENAME).txt: $(BASENAME).txt
278 $(DEST_WWW_HTML)/$(BASENAME)/index.html: index.html
279 mkdir -p $(DEST_WWW_HTML)
281 tar cf - `find . -name '*.html' $(IMAGE_EXPR)` \
282 | ( cd $(@D); tar xpf -)
283 if [ -r dot.htaccess ]; then \
284 $(INSTALL) dot.htaccess $(@D)/.htaccess ; \
287 $(DEST_WWW_SGML)/$(BASENAME)/$(BASENAME).xml: $(BASENAME).xml
288 mkdir -p $(DEST_WWW_SGML)
290 tar cf - `find . -name '*.xml' $(SRC_EXPR) $(IMAGE_EXPR) $(PS_EXPR)` \
291 | ( cd $(@D); tar xpf -)
295 # Install FTP contents
297 ifneq ($(INSTALL_FTP), yes)
301 $(DEST_FTP_TEXT)/$(BASENAME).gz \
302 $(DEST_FTP_HTML)/$(BASENAME).tar.gz \
303 $(DEST_FTP_SGML)/$(BASENAME).xml.tar.gz
305 $(DEST_FTP_TEXT)/$(BASENAME).gz: $(BASENAME).txt
307 $(INSTALL) $< $(@:.gz=)
311 $(DEST_FTP_HTML)/$(BASENAME).tar.gz: $(BASENAME).tar.gz
315 $(DEST_FTP_SGML)/$(BASENAME).xml.tar.gz: $(BASENAME).xml.tar.gz
321 # Install LDP translations for mirror
323 ifneq ($(INSTALL_LDP), yes)
326 ifneq ($(KIND), LDP-TRANS)
328 @echo Non-LDP document. Skipped.
330 install-ldp-mirror: \
331 $(DEST_LDP_TEXT)/$(BASENAME).gz \
332 $(DEST_LDP_HTML)/$(BASENAME).tar.gz \
333 $(DEST_LDP_SGML)/$(BASENAME).xml.tar.gz
335 $(DEST_LDP_TEXT)/$(BASENAME).gz: $(BASENAME).txt
337 $(INSTALL) $< $(@:.gz=)
341 $(DEST_LDP_HTML)/$(BASENAME).tar.gz: $(BASENAME).tar.gz
345 $(DEST_LDP_SGML)/$(BASENAME).xml.tar.gz: $(BASENAME).xml.tar.gz
355 find . -name '*.html' | xargs rm -f
357 rm -f $(BASENAME).tar.gz
358 rm -f $(BASENAME).xml.tar.gz