From 031a5ea57b350af5b618008a74cea85162eb7af4 Mon Sep 17 00:00:00 2001 From: "Paul W. Frields" Date: Thu, 22 Mar 2007 03:27:55 +0000 Subject: Move OMF stuff into proper position since it relies on XMLFILES. --- Makefile.common | 218 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 109 insertions(+), 109 deletions(-) (limited to 'Makefile.common') diff --git a/Makefile.common b/Makefile.common index eba493b..d158b32 100644 --- a/Makefile.common +++ b/Makefile.common @@ -340,115 +340,6 @@ 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} \ - ${FDPCOMMONDIR}/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 @@ -597,6 +488,115 @@ distclean:: $(foreach L,${OTHERS},${RM} -r ${L}) ######################################################################### +########### +# +# 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} \ + ${FDPCOMMONDIR}/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 ############################### + ######################################################################### # For each LANG in LANGUAGES, generate a target and rule similar to: # mydoc-en/index.html:: mydoc-en.xml ${XMLEXTRAFILES}-en -- cgit