summaryrefslogtreecommitdiffstats
path: root/Makefile.common
diff options
context:
space:
mode:
authorPaul W. Frields <stickster@gmail.com>2007-02-18 20:04:04 +0000
committerPaul W. Frields <stickster@gmail.com>2007-02-18 20:04:04 +0000
commita5b328592e9e9665bfa2cb45a136e31e0aa9ca60 (patch)
tree80855501f7abf4ae6756affeba3b3539ade15df1 /Makefile.common
parentd2ee317b6d341e0b89c9ff79ea22d7248879e938 (diff)
downloadfedora-doc-utils-a5b328592e9e9665bfa2cb45a136e31e0aa9ca60.tar.gz
fedora-doc-utils-a5b328592e9e9665bfa2cb45a136e31e0aa9ca60.tar.xz
fedora-doc-utils-a5b328592e9e9665bfa2cb45a136e31e0aa9ca60.zip
OMF handling
Diffstat (limited to 'Makefile.common')
-rw-r--r--Makefile.common111
1 files changed, 110 insertions, 1 deletions
diff --git a/Makefile.common b/Makefile.common
index 06494a4..2ca10ec 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -196,7 +196,7 @@ endif
# 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 @@ help::
#########################################################################
+###########
+#
+# 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