marketing-content/FC-5-press-release Makefile,1.2,1.3

Karsten Wade (kwade) fedora-docs-commits at redhat.com
Thu Mar 16 00:14:33 UTC 2006


Author: kwade

Update of /cvs/docs/marketing-content/FC-5-press-release
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv15200

Modified Files:
	Makefile 
Log Message:
This is the real Makefile based on the real rev. 1.8.


Index: Makefile
===================================================================
RCS file: /cvs/docs/marketing-content/FC-5-press-release/Makefile,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Makefile	16 Mar 2006 00:11:38 -0000	1.2
+++ Makefile	16 Mar 2006 00:14:13 -0000	1.3
@@ -1,10 +1,10 @@
 ########################################################################
 # The ${DOC_BASE} symbol provides the basic name for this document.
-DOC_BASE=fdp-pr
+DOC_BASE=fc5-press-release
 ########################################################################
-# The ${LANG} symbol gives the locale for the original language for 
+# The ${PRI_LANG} symbol gives the locale for the original language for 
 # the document.
-LANG=en
+PRI_LANG=en_US
 ########################################################################
 # The ${OTHERS} symbol is a list of additional locales into which the
 # document is to be translated.
@@ -18,60 +18,125 @@
 XMLTOFLAGS=-m params.xsl
 XSL	=fdp-pr.xsl
 SED    =/bin/sed
-XML2POT	=xml2pot
 XML2PO	=xml2po
-PO2XML	=po2xml
 MSGMERGE=msgmerge
 MSGMERGEFLAGS=
 ########################################################################
+LANGUAGES=${PRI_LANG} ${OTHERS}
+########################################################################
 # Define our own set of suffixes to streamline the process
 .SUFFIXES:
 .SUFFIXES:	.txt	.pdf	.po	.pot	.xml	.xsl	.dtd	.in
 ########################################################################
 # Mark the proper virtual targets so that a "make -t all" does not create
 # an empty file called "all".
-.PHONY:	all clean distclean clobber pot
-.PHONY: $(foreach LOCALE,${OTHERS},xml-${LOCALE})
-.PHONY: $(foreach LOCALE,${OTHERS},po-${LOCALE})
+.PHONY:	all clean distclean clobber pot help
 ########################################################################
 # The default target "all"
 all::	${DOC_BASE}.pot
-all::	$(foreach LOCALE,${LANG} ${OTHERS},${DOC_BASE}-${LOCALE}.xml)
-all::	$(foreach LOCALE,${LANG} ${OTHERS},${DOC_BASE}-${LOCALE}.pdf)
-all::	$(foreach LOCALE,${LANG} ${OTHERS},${DOC_BASE}-${LOCALE}.txt)
+all::	$(foreach LOCALE,${LANGUAGES},${DOC_BASE}-${LOCALE}.pdf)
+# FIXME all::	$(foreach LOCALE,${LANGUAGES},${DOC_BASE}-${LOCALE}.txt)
+########################################################################
+HFMT	=%-31s\t%s\n
+help::
+	@printf "${HFMT}" "all" "Default target; generate PDF's"
+	@printf "${HFMT}" "clean" "Delete temporary files"
+	@printf "${HFMT}" "distclean" "Delete output and temporary files"
+	@printf "${HFMT}" "clobber" "Delete output and temporary files"
+	@printf "${HFMT}" "help" "This message; use 'make help|sort'"
 ########################################################################
 # Compute the rules to transform our XML documents into both PDF and TXT
 # forms
-define	OUTPUT_template
-${DOC_BASE}-$(1).pdf::	${DOC_BASE}-$(1).xml params.xsl.in
-	LC_ALL=${1}.UTF-8 ${SED} -e "s|DATE|$$(date +'%x %X')|" 	\
+define	PDF_template
+.PHONY:	pdf-${1}
+
+pdf-${1}:: ${DOC_BASE}-${1}.pdf
+
+help::
+	@printf "${HFMT}" "pdf-${1}" "Generate PDF for locale '${1}'"
+
+${DOC_BASE}-$(1).pdf::	${DOC_BASE}-$(1).xml params.xsl.in ${XSL}
+	LC_ALL=${1}.UTF-8 ${SED} 					\
+	       -e "s|DATE|$$(shell LC_ALL=${1} date +'%x %X')|" 	\
+	       -e "s|LANG|${1}|"					\
 	       params.xsl.in >params.xsl
 	LC_ALL=${1}.UTF-8 ${XMLTO} -x ${XSL} ${XMLTOFLAGS} pdf 		\
 	       ${DOC_BASE}-$(1).xml
-${DOC_BASE}-$(1).txt::	${DOC_BASE}-$(1).xml params.xsl.in
-	LC_ALL=${1}.UTF-8 ${SED} -e "s|DATE|$$(date +'%x %X')|" 	\
-	       params.xsl.in >params.xsl
-	LC_ALL=${1}.UTF-8 ${XMLTO} -x ${XSL} ${XMLTOFLAGS} txt 		\
-	       ${DOC_BASE}-$(1).xml
+
+help::
+	@printf "${HFMT}" "${DOC_BASE}-${1}.pdf" "Render PDF for locale '${1}'"
+
+distclean::
+	${RM} ${DOC_BASE}-${1}.pdf
 endef
 
-$(foreach LOCALE,${LANG} ${OTHERS},$(eval $(call OUTPUT_template,${LOCALE})))
+$(foreach LOCALE,${LANGUAGES},$(eval $(call PDF_template,${LOCALE})))
+########################################################################
+
+########################################################################
+define	TXT_template
+# This assumes w3m(1) is installed.  The stock xmlto RPM uses it.
+XMLPOSTFLAGS=-p '-cols 72'
+
+.PHONY:	txt-${1}
+
+txt-${1}:: ${DOC_BASE}-${1}.txt
+
+help::
+	@printf "${HFMT}" "txt-${1}" "Generate text version for locale '${1}'"
+
+${DOC_BASE}-$(1).txt::	${DOC_BASE}-$(1).xml params.xsl.in ${XSL}
+	LC_ALL=${1}.UTF-8 ${SED} 					\
+	       -e "s|DATE|$$(shell LC_ALL=${1} date +'%x %X')|"		\
+	       params.xsl.in >params.xsl
+	LC_ALL=${1}.UTF-8 ${XMLTO} -x ${XSL} ${XMLTOFLAGS} $${XMLPOSTFLAGS} \
+	       txt ${DOC_BASE}-$(1).xml
+
+help::
+	@printf "${HFMT}" "${DOC_BASE}-${1}.txt" "Render locale '${1}' text"
+
+distclean::
+	${RM} ${DOC_BASE}-${1}.txt
+endef
+# FIXME $(foreach LOCALE,${LANGUAGES},$(eval $(call TXT_template,${LOCALE})))
 ########################################################################
 # Always generate the current date.
-params.xsl: params.xsl.in
-	${SED} -e "s|DATE|$$(date +'%x %X')|" $< >$@.tmp && move-if-change $@.tmp $@
+params.xsl: params.xsl.in Makefile
+	${SED} -e "s|DATE|$$(LC_ALL=${PRI_LANG} date +'%x %X')|" 	\
+	       -e "s|LANG|${PRI_LANG}|"					\
+		$< >$@.tmp && move-if-change $@.tmp $@
+
+help::
+	@printf "${HFMT}" "params.xsl" "Generate dynamic parameters"
 ########################################################################
 # The ${DOC_BASE}.pot target produces a new .POT file everytime the
 # original XML file is updated.
-${DOC_BASE}.pot: ${DOC_BASE}-${LANG}.xml
-	xml2pot $< >$@
+.PHONY:	pot
+
+pot::	${DOC_BASE}.pot
+
+help::
+	@printf "${HFMT}" "pot" "Generate .POT file for translation"
+
+${DOC_BASE}.pot:: ${DOC_BASE}-${PRI_LANG}.xml
+	xml2po -o $@ $<
+
+help::
+	@printf "${HFMT}" "${DOC_BASE}.pot" "Generate .POT file for translation"
 ########################################################################
 # Compute the rules to create or update a language-specific .po file
 # any time the ${DOC_BASE}.pot file is updated.  We try to avoid losing
 # current .PO translations by calling msgmerge if a .po file already 
 # exists.
 define PO_template
-po-${1} ${1}.po:: ${DOC_BASE}.pot
+.PHONY:	po-${1}
+po-${1}::	${1}.po
+
+help::
+	@printf "${HFMT}" "po-${1}" "Update translations for locale '${1}'"
+
+.PRECIOUS: ${1}.po
+${1}.po:: ${DOC_BASE}.pot
 	@if [ ! -f ${1}.po ]; then					\
 		echo Creating pristine ${1}.po;				\
 		cp ${DOC_BASE}.pot ${1}.po;				\
@@ -80,6 +145,9 @@
 		${MSGMERGE} ${MSGMERGEFLAGS} 				\
 			${1}.po $${DOC_BASE}.pot >${1}.po;		\
 	fi
+
+help::
+	@printf "${HFMT}" "${1}.po" "Update translations for locale '${1}'"
 endef
 
 $(foreach LOCALE,${OTHERS},$(eval $(call PO_template,${LOCALE})))
@@ -87,20 +155,40 @@
 # Compute the rules and targets to generate the translated XML files
 # given an updated .PO file and the source XML file.
 define NEWLANG_template
-xml-${1} ${DOC_BASE}-${1}.xml:: ${DOC_BASE}-${LANG}.xml ${1}.po
-	${PO2XML} ${DOC_BASE}-${LANG}.xml ${1}.po >${DOC_BASE}-${1}.xml
+.PHONY:	xml-${1}
+xml-${1}::	${DOC_BASE}-${1}.xml
+
+help::
+	@printf "${HFMT}" "xml-${1}" "Translate XML for locale '${1}'"
+
+${DOC_BASE}-${1}.xml:: ${DOC_BASE}-${PRI_LANG}.xml ${1}.po
+	${XML2PO} -p ${1}.po ${DOC_BASE}-${PRI_LANG}.xml >${DOC_BASE}-${1}.xml
+
+help::
+	@printf "${HFMT}" "${DOC_BASE}-${1}.xml" "Create XML for locale '${1}'"
+
+clean::
+	${RM} ${DOC_BASE}-${1}.xml
 endef
 
 $(foreach LOCALE,${OTHERS},$(eval $(call NEWLANG_template,${LOCALE})))
+
+.PHONY:	xml-${PRI_LANG}
+
+xml-${PRI_LANG}:: ${DOC_BASE}-${PRI_LANG}.xml
+
+help::
+	@printf "${HFMT}" "${DOC_BASE}-${PRI_LANG}.xml" "Primary XML"
 ########################################################################
-# Neatness counts
-clean:
-	${RM} $(foreach LOCALE,${OTHERS},${DOC_BASE}-${LOCALE}.xml)
+clean::
 	${RM} params.xsl
-
-distclean clobber: clean
-	${RM} $(foreach LOCALE,${LANG} ${OTHERS},${DOC_BASE}-${LOCALE}.pdf)
-	${RM} $(foreach LOCALE,${LANG} ${OTHERS},${DOC_BASE}-${LOCALE}.txt)
+distclean clobber:: clean
+########################################################################
+.PHONY:	mrproper
+mrproper:: distclean
+	${RM} *.po
+	${RM} *.pdf
+	${RM} *.txt
 ########################################################################
 # End of Makefile
 ########################################################################




More information about the docs-commits mailing list