docs-common Makefile.common,1.8,1.9
Tommy Reynolds (jtr)
fedora-docs-commits at redhat.com
Sat Sep 17 14:41:45 UTC 2005
Author: jtr
Update of /cvs/docs/docs-common
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv10318/docs-common
Modified Files:
Makefile.common
Log Message:
Added multi-language support.
Index: Makefile.common
===================================================================
RCS file: /cvs/docs/docs-common/Makefile.common,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Makefile.common 20 Aug 2005 14:34:09 -0000 1.8
+++ Makefile.common 17 Sep 2005 14:41:42 -0000 1.9
@@ -21,51 +21,100 @@
# providing additional rules, also marked with double-colons, in the
# document Makefile.
#########################################################################
+# Supply default values for the boilerplate files _unless_ the user has
+# provided their own values.
+ifeq (${XSLPDF},)
+XSLPDF = ../docs-common/xsl/main-pdf.xsl
+endif
+ifeq (${XSLHTML},)
+XSLHTML = ../docs-common/xsl/main-html.xsl
+endif
+ifeq (${XSHTMLNOCHUNKS},)
+XSLHTMLNOCHUNKS = ../docs-common/xsl/main-html-nochunks.xsl
+endif
+#########################################################################
# PUT NO TARGETS BEFORE THIS ONE, not even in your base Makefile
# In a properly-constructed Makefile, this will be the default target
-.PHONY: all tarball pdf html html-nochunks clean distclean
+TARGETS=all tarball pdf html html-nochunks clean distclean
+.PHONY: ${TARGETS}
-all:: ${DOCNAME}/index.html
+all:: html html-nochunks tarball # pdf
-# The "tarball" or "${DOCNAME}.tar.gz" target will bind the HTML formatted
-# document into a compressed tar archive.
+${TARGETS}::
-tarball ${DOCNAME}.tar.gz:: ${DOCNAME}/index.html
- tar -zc --exclude '*.eps' -f ${DOCNAME}.tar.gz ${DOCNAME}
-
-# The "pdf" or "${DOCNAME}.pdf" target produces an Adobe Portable Document
-# Format (PDF) file as output.
-
-pdf ${DOCNAME}.pdf:: ${XMLFILE} ${XMLEXTRAFILES}
- xmlto pdf -x $(XSLPDF) $(XMLFILE)
-
-# The "html" or "${DOCNAME}.
-html ${DOCNAME}/index.html:: ${XMLFILE} ${XMLEXTRAFILES}
- xmlto html -x $(XSLHTML) -o $(DOCNAME) $(XMLFILE)
- mkdir -p $(DOCNAME)/stylesheet-images
- cp ../docs-common/stylesheet-images/*.png $(DOCNAME)/stylesheet-images
- cp ../docs-common/css/fedora.css $(DOCNAME)
-
-html-nochunks $(DOCNAME).html:: ${XMLFILE} ${XMLEXTRAFILES}
- xmlto html-nochunks -x $(XSLHTMLNOCHUNKS) $(XMLFILE)
- mkdir -p stylesheet-images
- cp ../docs-common/stylesheet-images/*.png stylesheet-images
+#########################################################################
+# For each LANG in LANGUAGES, generate a target and rule similar to:
+# mydoc-en/index.html:: mydoc-en.xml ${XMLEXTRAFILES}-en
+# LANG=en.UTF-8 xmlto html -x $(XSLHTML) -o mydoc-en mydoc-en.xml
+# mkdir -p mydoc-en/stylesheet-images
+# cp ../docs-common/stylesheet-images/*.png mydoc-en/stylesheet-images/
+# cp ../docs-common/css/fedora.css mydoc-en/
+#
+define HTML_template
+${DOCBASE}-$(1)/index.html:: ${DOCBASE}-$(1).xml $$(XMLEXTRAFILES-$(1))
+ LANG=$(1).UTF-8 xmlto html -x $(XSLHTML) -o $(DOCBASE)-$(1) $(DOCBASE)-$(1).xml
+ mkdir -p $(DOCBASE)-$(1)/stylesheet-images/
+ cp ../docs-common/stylesheet-images/*.png $(DOCBASE)-$(1)/stylesheet-images
+ cp ../docs-common/css/fedora.css $$(DOCBASE)-$(1)/
+endef
+#
+html:: $(foreach LANG,${LANGUAGES},$(DOCBASE)-$(LANG)/index.html)
+
+$(foreach LANG,${LANGUAGES},$(eval $(call HTML_template,${LANG})))
+#
+#########################################################################
+# For each language in ${LANGUAGES}, generate a single HTML file
+define HTMLNOCHUNK_template
+${DOCBASE}-$(1).html:: ${DOCBASE}-$(1).xml $$(XMLEXTRAFILES-$(1))
+ xmlto html-nochunks -x $(XSLHTMLNOCHUNKS) $(DOCBASE)-$(1).xml
+ mkdir -p stylesheet-images/
+ cp ../docs-common/stylesheet-images/*.png stylesheet-images/
cp ../docs-common/css/fedora.css .
-
-# The "view" target ensures that the HTML version of the document is built
-# then displays it using the "htmlview" tool to start up the browser. It
-# assumes that the current working directory is immediately above the HTML
-# document directory. (We could change this if we wanted to futz around
-# with making up an absolute pathname, but why bother.)
-
-view:: ${DOCNAME}/index.html
- /usr/bin/htmlview file://localhost/${PWD}/${DOCNAME}/index.html
-
-# The "clean" or "distclean" target will remove all generated and temporary
-# files.
-
-distclean clean:
- ${RM} -r ${DOCNAME}.pdf $(DOCNAME) \
- ${DOCNAME}.tar.gz \
- ${DOCNAME}.html stylesheet-images fedora.css
+endef
+#
+html-nochunks:: $(foreach LANG,${LANGUAGES},$(DOCBASE)-$(LANG).html)
+
+$(foreach LANG,${LANGUAGES},$(eval $(call HTMLNOCHUNK_template,${LANG})))
+#
+#########################################################################
+# For each language in ${LANGUAGES}, build a tarball of the HTML files.
+#
+define TAR_template
+${DOCBASE}-$(1).tar.gz:: ${DOCBASE}-$(1)/index.html
+ tar -zc --exclude '*.eps' -f ${DOCBASE}-$(1).tar.gz ${DOCBASE}-$(1)
+endef
+#
+tarball:: $(foreach LANG,${LANGUAGES},$(DOCBASE)-$(LANG).tar.gz)
+
+$(foreach LANG,${LANGUAGES},$(eval $(call TAR_template,${LANG})))
+#
+#########################################################################
+# For each language in ${LANGUAGES}, generate an Adobe Portable Document
+# Format (PDF) file.
+define PDF_template
+${DOCBASE}-$(1).pdf:: ${DOCBASE}-$(1).xml $$(XMLEXTRAFILES-$(1))
+ xmlto pdf -x $(XSLPDF) $(DOCBASE)-$(1).xml
+endef
+#
+pdf:: $(foreach LANG,${LANGUAGES},$(DOCBASE)-$(LANG).pdf)
+
+$(foreach LANG,${LANGUAGES},$(eval $(call PDF_template,${LANG})))
+#
+#########################################################################
+# For each language in ${LANGUAGES}, clean up!
+define CLEAN_template
+${DOCBASE}-$(1)-clean::
+ ${RM} -r ${DOCBASE}-$(1)
+ ${RM} -r ${DOCBASE}-$(1).html stylesheet-images fedora.css
+ ${RM} -r ${DOCBASE}-$(1).pdf
+ ${RM} -r ${DOCBASE}-$(1).tar.gz
+endef
+#
+distclean clean:: $(foreach LANG,${LANGUAGES},${DOCBASE}-${LANG}-clean)
+
+$(foreach LANG,${LANGUAGES},$(eval $(call CLEAN_template,${LANG})))
+#
+#########################################################################
+# End of Makefile.common
+#########################################################################
More information about the Fedora-docs-commits
mailing list