docs-common Makefile.common,1.143,1.144

Paul W. Frields (pfrields) fedora-docs-commits at redhat.com
Sun Feb 18 20:04:06 UTC 2007


Author: pfrields

Update of /cvs/docs/docs-common
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv17713

Modified Files:
	Makefile.common 
Log Message:
OMF handling


Index: Makefile.common
===================================================================
RCS file: /cvs/docs/docs-common/Makefile.common,v
retrieving revision 1.143
retrieving revision 1.144
diff -u -r1.143 -r1.144
--- Makefile.common	17 Sep 2006 18:51:25 -0000	1.143
+++ Makefile.common	18 Feb 2007 20:04:04 -0000	1.144
@@ -196,7 +196,7 @@
 # Explode the template from the doc-specific Makefile to get the
 # XML files the author knows about.
 $(foreach L,${LANGUAGES},$(eval $(call XMLFILES_template,${L})))
-# Append per-document dependancies
+# Append per-document dependencies
 $(foreach L, ${LANGUAGES}, $(eval XMLDEPFILES-${L}+=${DOC_ENTITIES_ENT-${L}}))
 $(foreach L, ${LANGUAGES}, $(eval XMLDEPFILES-${L}+=${L}/fdp-info.xml))
 $(foreach L, ${LANGUAGES}, $(eval XMLDEPFILES-${L}+=${L}/${FDP_ENTITIES}))
@@ -333,6 +333,115 @@
 
 #########################################################################
 
+###########
+#
+# Get or build OMF.
+# 
+# If the per-doc Makefile provides a ${OMFINFILES} list, we use those.
+# If it does not:
+# 1.  look for ${PRI_LANG}/*.omf.in and use those; or, failing that,
+# 2.  if ${BUILDOMF} is defined, make one using XSLT and rpm-info data.
+#
+# The template OMF files are expected to use @VARNAME@ notation to
+# allow replacement of their content dynamically at build time.  They
+# should retain this notation during PO/POT conversion so that
+# translators never have to worry about that content.  Substitution
+# only occurs during the packaging process.
+#
+
+# FIXME: There may not be a need to have the ${PRI_LANG} prefixing
+# each entry in ${OMFINFILES}.  Might be a good idea to take that out.
+
+# if OMFINFILES is empty, try and get the file list.
+# If it's still empty, and BUILDOMF is set, use that to populate the list.
+# Otherwise it stays empty.  After all, we may not want them at all.
+
+ifeq "${OMFINFILES}" ""
+OMFINFILES=$(foreach F,$(wildcard ${PRI_LANG}/*.omf.in),$(shell basename ${F}))
+ifeq "${OMFINFILES}" ""
+ifdef BUILDOMF
+OMFINFILES=${PKGNAME}.omf.in
+${PRI_LANG}/${PKGNAME}.omf.in:: ${PRI_LANG}/${RPMINFO}
+	${XSLTPROC} --stringparam lang ${PRI_LANG}		\
+		--stringparam docbase ${PKGNAME}		\
+		${FDPDIR}/docs-common/packaging/omf-in.xsl 	\
+		$< > $@
+endif
+endif
+endif
+
+showvars::
+	@echo "OMFINFILES=\"${OMFINFILES}\""
+
+define OMFVAR_template
+$(foreach F,${OMFINFILES},$(eval OMFINFILES-${1}+=${1}/${F}))
+$(foreach F,${OMFINFILES},$(eval OMFFILES-${1}+=$(patsubst %.in,${1}/%,${F})))
+showvars-debug::
+	@echo "OMFFILES-${1}=\"${OMFFILES-${1}}\""
+endef
+
+$(foreach L,${LANGUAGES},$(eval $(call OMFVAR_template,${L})))
+
+define OMFIN_template
+.PHONY: omf-in-${1}
+omf-in-${1}:: ${OMFINFILES-${1}}
+# Treat .omf.in files just like XML... since they are!
+$(foreach F,${OMFINFILES},$(eval $(call XML_template,${1},${PRI_LANG}/${F})))
+
+clean::
+	${RM} ${OMFINFILES-${1}}
+
+help::
+	@printf ${TFMT} 'omf-in-${1}' 'Make OMF input file for ${1}'
+
+endef
+
+$(foreach L,${OTHERS},$(eval $(call OMFIN_template,${L})))
+
+.PHONY: omf-in
+omf-in:: $(foreach L,${LANGUAGES},${OMFINFILES-${L}})
+
+help::
+	@printf ${TFMT} 'omf-in' 'Make all OMF input files'
+
+
+# To make the real OMF, just do a quick bit of sed processing.
+# The spacing in the second command is purposeful to ensure no extra
+# space appears in the sed command.
+#
+# Note the difference between @LANG@ and @LANGC@: the former is always
+# replaced by the locale name, whereas the latter is replaced by the
+# locale name *unless* the locale is en_US, in which case it is replaced
+# by "C", the fallback.
+%.omf:	%.omf.in
+	sed -e 's!@RELEASE@!${VERSION}!g' $< > $@
+	sed -i 's!@DATE@!${REVDATE}!g' $@
+	sed -i 's!@LANG@!$(patsubst %/$(shell basename $<),%,$<)!g' $@
+	sed -i 's!@LANGC@!$(if $(findstring en_US,$(patsubst 		\
+		%/$(shell basename $<),%,$<)),C,$(patsubst 		\
+		%/$(shell basename $<),%,$<))!g' $@
+
+
+define OMF_template
+.PHONY: omf-${1}
+omf-${1}:: ${OMFFILES-${1}}
+
+clean::
+	${RM} ${OMFFILES-${1}}
+
+help::
+	@printf ${TFMT} 'omf-${1}' 'Make all OMF files for ${1} locale'
+
+endef
+
+$(foreach L,${LANGUAGES},$(eval $(call OMF_template,${L})))
+
+.PHONY: omf
+omf:: $(foreach L,${LANGUAGES},${OMFFILES-${L}})
+help::
+	@printf ${TFMT} 'omf' 'Make all OMF files for all locales'
+# End of OMF ###############################
+
 #########################################################################
 # Rules to generate the "${LANG}/${DOC_ENTITIES}.ent" file, if used
 define DOC_ENTITIES_template




More information about the docs-commits mailing list