######################################################################### # Makefile.common # # This file, to be included from every document's local Makefile, provides # the basic targets used by the Fedora Docs Project. To see a list, # type "make help". ######################################################################### ######################################################################### # PDF generation is still fragile and probably won't work on your document. # Yet. ######################################################################### ######################################################################### # Note: all targets within this Makefile.common must be defined as # double-colon (::) targets so that additional steps can be added by # providing additional rules, also marked with double-colons, in the # document Makefile. ######################################################################### ######################################################################### # N.B., if you want to use built-in variables such as "$@" in a template # be sure to quote them as "$$@" since the template is evaluated once as # it is expanded ######################################################################### ######################################################################### # WARNING. This feature is deprecated and will shortly disappear. ######################################################################### # Allow client document to provide "Make.paths" file to locate our files # This is a "silent include", so if it's missing there is no problem. # This file, if present, must be in the DOCUMENT directory, not here in # docs-common. Even if this file is present, defining FTPDIR via the # command line will take precedence. sinclude Make.paths ######################################################################### ######################################################################### # Strange though it may seem, some shells do not provide a ${PWD} # environment variable for us. PWD :=$(shell /bin/pwd) ######################################################################### ######################################################################### # Supply default values for the boilerplate files _unless_ the user has # provided their own values. ifeq "${FDPDIR}" "" FDPDIR = $(PWD)/.. endif ifeq "${FDPBIN}" "" FDPBIN = ${FDPDIR}/docs-common/bin endif ifeq "${XSLPDF}" "" XSLPDF = ${FDPDIR}/docs-common/xsl/main-pdf.xsl endif ifeq "${XSLHTML}" "" XSLHTML = ${FDPDIR}/docs-common/xsl/main-html.xsl endif ifeq "${XSLHTMLNOCHUNKS}" "" XSLHTMLNOCHUNKS = ${FDPDIR}/docs-common/xsl/main-html-nochunks.xsl endif ifeq "${HTMLCSS}" "" HTMLCSS = ${FDPDIR}/docs-common/css/fedora-draft.css endif ifeq "${DRAFT}" "" #DRAFT = no DRAFT = yes endif ifeq "${PRI_LANG}" "" PRI_LANG= en endif ifeq "${RPMINFO}" "" RPMINFO = ${PWD}/rpm-info.xml endif ifeq "${RPMPREP}" "" RPMPREP=yes endif ifeq "${RPMPOST}" "" RPMPOST=yes endif ifeq "${XMLTOTXTPOSTOPT}" "" XMLTOTXTPOSTOPT =-p '-no-numbering -no-references' endif ifeq "${XMLLINTOPT}" "" XMLLINTOPT =--xinclude --postvalid --noent endif ######################################################################### ######################################################################### # Use macros to locate our commonly-used programs XMLTO =xmlto XSLTPROC=xsltproc XMLFORMAT=xmlformat XMLFOPTS=-f $(FDPDIR)/docs-common/bin/xmlformat-fdp.conf XMLLINT =xmllint XML2PO =xml2po XML2POFLAGS=-e MSGMERGE=msgmerge LN =ln MEINPROC=meinproc ######################################################################### ######################################################################### FDP_ENTITIES=fdp-entities.ent ######################################################################### ######################################################################### # Rules to produce .po files from .xml files. Get the tools to do this # from the gnome-doc-utils RPM. .SUFFIXES: .po .pot .fo .ent .xml %.po: %.xml ${XML2PO} ${XML2POFLAGS} $< >$@ %.ent: %.xml ${XSLTPROC} -o $@ --stringparam FDPCOMMONDIR "NONE" \ ${FDPDIR}/docs-common/common/entities/entities.xsl $< ######################################################################### ######################################################################### # Use our very own "docs-common/bin/fdpsh" as the command interpreter # This automatically has ${FDPBIN} as first in the ${PATH} SHELL =${FDPBIN}/fdpsh ######################################################################### ######################################################################### # Obtain the document version and release info for building RPM's VERSION:=$(shell version doc) RELEASE:=$(shell version rpm) ######################################################################### ######################################################################### RPMFLAGS=--define "docbase $(DOCBASE)" \ --define "_topdir $(PWD)/rpm" \ --define "fdpdir /usr/share/fedora/doc" SPECFILE=fedora-doc-$(DOCBASE).spec ifeq "${RPMDEBUG}" "1" RPMDFLAG = -vv endif ######################################################################### ######################################################################### # Set a provisional ${LANG} value. We'll dynamically change this as # needed. The "${PRI_LANG}" value is used because that is the original # language the doc. LANG =${PRI_LANG} LANGUAGES=${PRI_LANG} ${OTHERS} # ######################################################################### ######################################################################### define DOCENT_template DOC_ENTITIES_XML-${1}=${1}/${DOC_ENTITIES}.xml DOC_ENTITIES_ENT-${1}=${1}/${DOC_ENTITIES}.ent endef ifneq "${DOC_ENTITIES}" "" $(foreach L,${LANGUAGES},$(eval $(call DOCENT_template,${L}))) 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 $(foreach L, ${LANGUAGES}, $(eval XMLDEPFILES-${L}+=${DOC_ENTITIES_ENT-${L}})) $(foreach L, ${LANGUAGES}, $(eval XMLDEPFILES-${L}+=${L}/fdp-info.xml)) # ######################################################################### ######################################################################### TFMT="%-31s -- %s\n" ######################################################################### ######################################################################### # PUT NO TARGETS BEFORE THIS ONE, not even in your base Makefile # In a properly-constructed Makefile, this will be the default target TARGETS=all clean distclean fdp-info html html-nochunks pdf po showvars \ tarball rpm rpm-common noarch srpm package-prep package-post \ src-tarball txt text targets help # FIXME: add the .PHONY attribute where the actual target is defined .PHONY: ${TARGETS} .PHONY: $(foreach LANG,${LANGUAGES},html-${LANG}) .PHONY: $(foreach LANG,${LANGUAGES},html-nochunks-${LANG}) .PHONY: $(foreach LANG,${LANGUAGES},pdf-${LANG}) all:: html html-nochunks tarball # pdf help:: @printf ${TFMT} 'help' 'This help; try "make help|sort"' @printf ${TFMT} 'text' 'Same as "txt" target' @printf ${TFMT} 'txt' 'Renders XML into ASCII text file' @printf ${TFMT} 'src-tarball' 'FIXME' @printf ${TFMT} 'package-post' 'FIXME' @printf ${TFMT} 'package-prep' 'FIXME' @printf ${TFMT} 'srpm' 'FIXME' @printf ${TFMT} 'noarch' 'FIXME' @printf ${TFMT} 'rpm-common' 'FIXME' @printf ${TFMT} 'rpm' 'Builds RPM packages' @printf ${TFMT} 'tarball' 'Packages HTML files into tar(1) archive' @printf ${TFMT} 'clean' 'Removes temporary files' @printf ${TFMT} 'distclean' 'Removes product files and temporaries' @printf ${TFMT} 'fdp-info' 'Produces all $${LANG}/fdp-info.xml' @printf ${TFMT} 'all' 'Builds html, html-nochunks, and tarball' @printf ${TFMT} 'html' 'Renders XML into chunked HTML' @printf ${TFMT} 'html-nochunks' 'Renders XML into one big HTML file' @printf ${TFMT} 'pdf' 'Renders XML into one PDF file' @printf ${TFMT} 'po' 'Updates .PO files for all $${OTHERS} locales' @printf ${TFMT} 'showvars' 'Displays convenient make(1) variables' ${TARGETS}:: ######################################################################### # Ensure all 'clean' targets are invoked before 'distclean' targets distclean:: clean # ######################################################################### ######################################################################### # Rules to generate the "${LANG}/${DOC_ENTITIES}.ent" file, if used define DOC_ENTITIES_template #po/${DOC_ENTITIES}.pot:: ${1}/${FDP_ENTITIES} ${PRI_LANG}/${DOC_ENTITIES}.xml # ${XML2PO} -o $$@ ${XML2POFLAGS} ${PRI_LANG}/${DOC_ENTITIES}.xml #clean:: # ${RM} po/${DOC_ENTITIES}.pot # #help:: # @printf ${TFMT} 'po/${DOC_ENTITIES}.pot' 'Create .POT file for per-doc entities' #po/${1}.po:: ${1}/${FDP_ENTITIES} po/${DOC_ENTITIES}.pot # if [ ! -f $$@ ]; then \ # mkdir -p ${1}; \ # cp -f po/${DOC_ENTITIES}.pot $$@; \ # fi # ${MSGMERGE} -U -q $$@ po/${DOC_ENTITIES}.pot # touch $$@ ${1}/${DOC_ENTITIES}.xml:: ${1}/${FDP_ENTITIES} po/${1}.po ${PRI_LANG}/${DOC_ENTITIES}.xml ${XML2PO} ${XML2POFLAGS} -p po/${1}.po \ ${PRI_LANG}/${DOC_ENTITIES}.xml >$$@ clean:: ${RM} ${1}/${DOC_ENTITIES}.xml ${1}/${DOC_ENTITIES}.ent:: ${1}/${DOC_ENTITIES}.xml help:: @printf ${TFMT} '${1}/${DOC_ENTITIES}.ent' 'Per-doc entities for locale "${1}"' @printf ${TFMT} '${1}/${DOC_ENTITIES}.xml' 'Translated per-doc entities for locale "${1}"' endef ifneq "${DOC_ENTITIES}" "" ${PRI_LANG}/${DOC_ENTITIES}.ent:: ${PRI_LANG}/${DOC_ENTITIES}.xml help:: @printf ${TFMT} '${PRI_LANG}/${DOC_ENTITIES}.ent' 'Per-doc entities for locale "${PRI_LANG}"' $(foreach L, ${OTHERS},$(eval $(call DOC_ENTITIES_template,${L}))) showvars:: @echo "DOC_ENTITIES=${DOC_ENTITIES}" endif # ######################################################################### ######################################################################### po/${DOCBASE}.pot:: ${DOC_ENTITIES_XML-${PRI_LANG}} \ ${DOC_ENTITIES_ENT-${PRI_LANG}} \ ${PRI_LANG}/${FDP_ENTITIES} ${XMLFILES-${PRI_LANG}} [ -d po/CVS ] || (echo ADD po/ TO CVS >&2; exit 1) ${XML2PO} ${XML2POFLAGS} -o $@ ${XMLFILES-${PRI_LANG}} ${DOC_ENTITIES_XML-${PRI_LANG}} help:: @printf ${TFMT} 'po/${DOCBASE}.pot' 'Writes one POT file for all XML' .PHONY: pot pot:: po/${DOCBASE}.pot help:: @printf ${TFMT} 'po' 'Writes one ${PRI_LANG} PO file for all XML' ######################################################################### ######################################################################### define PO_template .PRECIOUS: po/${1}.po po/${1}.po:: po/${DOCBASE}.pot $${DOC_ENTITITES_ENT-${1}} [ -d po/CVS ] || (echo ADD po/ TO CVS >&2; exit 1) if [ ! -f $$@ ]; then \ cp po/${DOCBASE}.pot $$@; \ else \ ${MSGMERGE} -U -q $$@ po/${DOCBASE}.pot; \ touch $$@; \ fi .PHONY: po-${1} po-${1}:: po/${1}.po help:: @printf ${TFMT} 'po-${1}' 'Creates or updates locale ${1} .PO file' @printf ${TFMT} 'po/${1}.po' 'Creates or updates locale ${1} .PO file' clean:: ${RM} .xml2po.mo endef $(foreach L,${OTHERS},$(eval $(call PO_template,${L}))) .PHONY: po po:: $(foreach L,${OTHERS},po-${L}) ######################################################################## ######################################################################### # Define a template to generate the locale-specific XML files given the # original ${PRI_LANG} file and an updated po/${LANG}.po file. # We have to be funky and cd(1) into the ${LANG} directory so that # the "lang=foo" attribute that ${XML2PO} generates will be correct. # Hiss! Boo! define XML_template $(patsubst ${PRI_LANG}/%,${1}/%,${2}):: ${2} po/${1}.po \ ${DOC_ENTITIES_ENT-${1}} mkdir -p ${1} cd po && ${XML2PO} ${XML2POFLAGS} -p ${1}.po ../${2} >../$$@ endef $(foreach L,${OTHERS}, \ $(foreach F,${XMLFILES-${PRI_LANG}}, \ $(eval $(call XML_template,${L},${F})))) define XMLTARGET_template .PHONY: xml-${1} xml-${1}:: ${XMLDEPFILES-${1}} ${XMLFILES-${1}} distclean:: ${RM} -r ${1} help:: @printf ${TFMT} 'xml-${1}' 'Produces translated XML for locale ${1}' endef .PHONY: xml-${PRI_LANG} xml-${PRI_LANG}:: ${XMLFILES-${PRI_LANG}} help:: @printf ${TFMT} 'xml-${PRI_LANG}' 'Comfirms primary language XML files.' $(foreach L,${OTHERS},$(eval $(call XMLTARGET_template,${L}))) .PHONY: xml-all xml-all:: $(foreach L,${LANGUAGES},xml-${L}) help:: @printf ${TFMT} 'xml-all' 'Creates all XML locale files' distclean:: $(foreach L,${OTHERS},${RM} -r ${L}) ######################################################################### ######################################################################### # 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 ${FDPDIR}/docs-common/stylesheet-images/*.png mydoc-en/stylesheet-images/ # cp ${HTMLCSS} mydoc-en/fedora.css # cp ${HTMLCSSEXTRA} mydoc-en/watermark.png # cp ${FDPDIR}/docs-common/images/watermark.png mydoc-en/ # ${FDPDIR}/docs-common/bin/copy-figs -f '*.png' figs mydoc-en/ # but we do avoid copying EPS files since they are nonsense to the HTML world. # define HTML_template .PHONY: html-${1} html-$(1):: ${DOCBASE}-$(1)/index.html ${DOCBASE}-$(1)/index.html:: set-locale-${1} ${XMLFILES-${1}} ${XMLDEPFILES-${1}} LANG=$(1).UTF-8 ${XMLTO} html -x $(XSLHTML) -o $(DOCBASE)-$(1) $(1)/$(DOCBASE).xml mkdir -p $(DOCBASE)-$(1)/stylesheet-images/ cp ${FDPDIR}/docs-common/stylesheet-images/*.png $(DOCBASE)-$(1)/stylesheet-images cp ${HTMLCSS} $(DOCBASE)-$(1)/fedora.css ifneq "${DRAFT}" "no" cp ${FDPDIR}/docs-common/images/watermark-$(1).png \ $(DOCBASE)-$(1)/watermark.png endif [ ! -d figs ] || copy-figs -v -f '*.png' \ -l $(1) figs $(DOCBASE)-$(1) distclean:: ${RM} -r ${DOCBASE}-${1} help:: @printf ${TFMT} 'html-${1}' 'Renders XML into locale ${1}' @printf ${TFMT} '${1}/index.html' 'Renders XML into locale ${1}' endef $(foreach L,${LANGUAGES},$(eval $(call HTML_template,${L}))) .PHONY: html html:: $(foreach L,${LANGUAGES},html-${L}) # ######################################################################### ######################################################################### # For each language in ${LANGUAGES}, generate a single HTML file define HTMLNOCHUNK_template .PHONY: html-nochunks-${1} html-nochunks-$(1):: ${DOCBASE}-$(1).html ${DOCBASE}-$(1).html:: set-locale-${1} ${XMLFILES-${1}} ${XMLDEPFILES-${1}} LANG=${1}.UTF-8 ${XMLTO} html-nochunks -x $(XSLHTMLNOCHUNKS) $(1)/$(DOCBASE).xml mv $(DOCBASE).html $(DOCBASE)-$(1).html mkdir -p stylesheet-images/ cp ${FDPDIR}/docs-common/stylesheet-images/*.png stylesheet-images/ cp ${HTMLCSS} fedora.css ifneq "${DRAFT}" "no" cp ${FDPDIR}/docs-common/images/watermark-$(1).png watermark.png endif distclean:: ${RM} ${DOCBASE}-${1}.html ${RM} -r stylesheet-images ${RM} fedora.css ${RM} watermark.png help:: @printf ${TFMT} 'html-nochunks-${1}' 'Renders XML into locale ${1} HTML' @printf ${TFMT} '${DOCBASE}-${1}.html' 'Renders XML into locale ${1} HTML' endef $(foreach L,${LANGUAGES},$(eval $(call HTMLNOCHUNK_template,${L}))) .PHONY: html-nochunks html-nochunks:: $(foreach L,${LANGUAGES},html-nochunks-$(L)) # ######################################################################### ######################################################################### # For each language in ${LANGUAGES}, build a tarball of the HTML and # image files. Any ".eps" files are ignored. # define HTMLTAR_template ${DOCBASE}-$(1).tar.gz:: ${DOCBASE}-$(1)/index.html tar -zc --exclude '*.eps' -f ${DOCBASE}-$(1).tar.gz ${DOCBASE}-$(1) distclean:: ${RM} ${DOCBASE}-${1}.tar.gz help:: @printf ${TFMT} '${DOCBASE}-${1}.tar.gz' 'Tar archive of HTML and images' endef $(foreach L,${LANGUAGES},$(eval $(call HTMLTAR_template,${L}))) .PHONY: tarball tarball:: $(foreach LANG,${LANGUAGES},$(DOCBASE)-$(LANG).tar.gz) # ######################################################################### ######################################################################### # For each language in ${LANGUAGES}, generate an Adobe Portable Document # Format (PDF) file. define FO_template .PHONY: fo-${1} fo-${1}:: ${1}/${DOCBASE}.fo ${1}/${DOCBASE}.fo:: set-locale-${1} ${XMLFILES-${1}} ${XMLDEPFILES-${1}} LANG=${1}.UTF-8 xsltproc --xinclude \ --stringparam FDPDIR ${FDPDIR} \ --stringparam IMGROOT ${PWD} \ --stringparam RENDEREDBY fop-0.20.5 \ ${XSLPDF} ${1}/${DOCBASE}.xml | ${XMLLINT} --format -o $$@ - clean:: ${RM} ${1}/${DOCBASE}.fo help:: @printf ${TFMT} 'fo-${1}' 'Creates ${1}/${DOCBASE}.fo file' @printf ${TFMT} '${1}/${DOCBASE}.fo' 'XSL-FO file for locale ${1}' endef $(foreach L,${LANGUAGES},$(eval $(call FO_template,${L}))) .PHONY: fo fo-all fo fo-all:: $(foreach L,${LANGUAGES},fo-${L}) help:: @printf ${TFMT} 'fo' 'Generate .FO files for all languages' @printf ${TFMT} 'fo-all' 'Generate .FO files for all languages' define PDF_template .PHONY: pdf-${1} pdf-$(1):: ${DOCBASE}-$(1).pdf ${DOCBASE}-${1}.pdf:: ${1}/${DOCBASE}.fo LANG=${1}.UTF-8 ${XMLTO} -o ${1} pdf $$< mv -f ${1}/${DOCBASE}.pdf $$@ distclean:: ${RM} ${DOCBASE}-${1}.pdf help:: @printf ${TFMT} 'pdf-${1}' 'Renders XML-FO into PDF for locale ${1}' @printf ${TFMT} '${DOCBASE}-${1}.pdf' 'Renders XML-FO into PDF file' endef $(foreach L,${LANGUAGES},$(eval $(call PDF_template,${L}))) .PHONY: pdf pdf:: $(foreach LANG,${LANGUAGES},pdf-$(LANG)) define TXT_template .PHONY: txt-${1} text-${1} txt-$(1) text-$(1):: ${DOCBASE}-$(1).txt ${DOCBASE}-$(1).txt:: set-locale-${1} ${XMLFILES-${1}} ${XMLDEPFILES-${1}} ${XMLLINT} ${XMLLINTOPT} $(1)/$(DOCBASE).xml > $(1)/$(DOCBASE).lint.xml ${XSLTPROC} $(FDPDIR)/docs-common/packaging/strip-for-txt.xsl \ $(1)/$(DOCBASE).lint.xml > $(1)/$(DOCBASE).stripped.xml rm $(1)/$(DOCBASE).lint.xml LANG=$(1).UTF-8 ${XMLTO} ${XMLTOTXTPOSTOPT} txt $(1)/$(DOCBASE).stripped.xml mv $(DOCBASE).stripped.txt $(DOCBASE)-$(1).txt rm $(1)/$(DOCBASE).stripped.xml clean:: ${RM} ${1}/${DOCBASE}.stripped.xml distclean:: ${RM} ${DOCBASE}-${1}.txt help:: @printf ${TFMT} 'txt-${1}' 'Renders XML into ASCII text for locale ${1}' @printf ${TFMT} 'text-${1}' 'Renders XML into ASCII text for locale ${1}' @printf ${TFMT} '${DOCBASE}-${1}.txt' 'Renders XML into ASCII text for locale ${1}' endef $(foreach L,${LANGUAGES},$(eval $(call TXT_template,${L}))) .PHONY: txt text txt text:: $(foreach LANG,${LANGUAGES},txt-$(LANG)) # ######################################################################### ######################################################################### clean:: ${RM} *.tmp ######################################################################### ######################################################################### # showvars:: @echo "DOCBASE=\"$(DOCBASE)\"" @echo "PRI_LANG=\"$(PRI_LANG)\"" @echo "OTHERS=\"$(OTHERS)\"" # ######################################################################### ######################################################################### # Show differences between two file revisions. To use this tool: # $ make OLD=old.xml NEW=new.xml diff # The ${DIFFS} macro can select a different output format: # $ make DIFFS=-C OLD=old.xml NEW=new.xml diff OLD =define-me-old.xml NEW =define-me-new.xml DIFFS =-u diff:: xmldiff ${DIFFS} ${OLD} ${NEW} help:: @printf ${TFMT} 'diff' 'Compares XML files' # ######################################################################### ######################################################################### # The "${LANG}/fdp-info.xml" file contains the or # stanza. It is automatically generated from data in the # "rpm-info.xml" file whenever that file changes. # define fdp-info_template $(1)/fdp-info.xml:: $(RPMINFO) mkdir -p ${1} LANG=$(1).UTF-8 ${XSLTPROC} --stringparam lang $(1) \ --stringparam fdpdir $(FDPDIR) \ --stringparam doctype $(shell \ doctype ${PRI_LANG}/$(DOCBASE).xml \ ) ${FDPDIR}/docs-common/packaging/bookinfo.xsl \ $(RPMINFO) | \ $(XMLFORMAT) $(XMLFOPTS) >$$@ clean:: ${RM} ${1}/fdp-info.xml help:: @printf ${TFMT} '${1}/fdp-info.xml' 'Locale ${1} packaging information' endef $(foreach L,${LANGUAGES},$(eval $(call fdp-info_template,${L}))) .PHONY: fdp-info fdp-info:: $(foreach LANG,${LANGUAGES},$(LANG)/fdp-info.xml) help:: @printf ${TFMT} 'fdp-info' 'Outputs all locale-specific packaging info' define khelp_template .PHONY: khelp-$(1) khelp-$(1):: set-locale-$(1) ${XMLFILES-$(1)} ${XMLDEPFILES-$(1)} LANG=$(1).UTF-8 ${XMLLINT} --noent --xinclude $(1)/$(DOCBASE).xml 2>/dev/null >$(1)/$(DOCBASE).xml-parsed mkdir -p kde-$(1) ${MEINPROC} --output kde-$(1)/index.docbook \ --cache kde-$(1)/index.cache.bz2 \ $(1)/$(DOCBASE).xml-parsed ${RM} -f $(1)/$(DOCBASE).xml-parsed clean:: ${RM} -rf kde-$(1) help:: @printf ${TFMT} 'khelp-$(1)' 'Build khelpcenter files for locale $(1)' endef $(foreach L,${LANGUAGES},$(eval $(call khelp_template,${L}))) .PHONY: khelp khelp:: $(foreach LANG,${LANGUAGES},khelp-$(LANG)) help:: @printf ${TFMT} 'khelp' 'Build all locale-specific khelpcenter files' # ######################################################################### ######################################################################### # Stuff after here is for RPM packaging ######################################################################### ######################################################################### # Make a new changelog entry for an existing rpm-info.xml file. clog:: $(RPMINFO) insert-changelog $(RPMINFO).tmp && \ move-if-change $(RPMINFO).tmp $(RPMINFO) help:: @printf ${TFMT} 'clog' 'Adds changelog entry to rpm-info.xml file' # ######################################################################### # Make a new colophon entry for an existing rpm-info.xml file. colophon:: $(RPMINFO) insert-colophon $(RPMINFO).tmp && \ move-if-change $(RPMINFO).tmp $(RPMINFO) help:: @printf ${TFMT} 'colophon' 'Adds colophon entry to rpm-info.xml file' ######################################################################### .PHONY: ${DOCBASE}-${1}-distclean define DISTCLEAN_template ${DOCBASE}-$(1)-distclean:: ${RM} *-$(1).omf ${RM} *-$(1).desktop help:: @printf ${TFMT} '${DOCBASE}-${1}-distclean' 'Removes locale ${1} product files' endef $(foreach L,${LANGUAGES},$(eval $(call DISTCLEAN_template,${L}))) distclean:: $(foreach L,${LANGUAGES},${DOCBASE}-${L}-distclean) ######################################################################### clean:: ${RM} $(DOCBASE)-$(VERSION)*.src.tar.gz ${RM} -r $(DOCBASE)-$(VERSION)/ ${RM} fedora-doc-$(DOCBASE)*.{omf,desktop,spec} ${RM} *~ distclean:: ${RM} -r rpm ${RM} fedora-doc-$(DOCBASE)*.rpm ${RM} fedora-doc-$(DOCBASE)*.omf ${RM} fedora-doc-$(DOCBASE)*.desktop ${RM} fedora-doc-$(DOCBASE)*.spec ${RM} $(DOCBASE)*.src.tar.gz help:: @printf ${TFMT} 'spec' 'Creates RPM spec file from rpm-info.xml' spec:: ${SPECFILE} help:: @printf ${TFMT} '${SPECFILE}' 'Creates RPM spec file from rpm-info.xml' ${SPECFILE}:: ${RPMINFO} $(XSLTPROC) --stringparam docbase "${DOCBASE}" \ ${FDPDIR}/docs-common/packaging/spec.xsl ${RPMINFO} \ >$@.tmp && move-if-change $@.tmp $@ help:: @printf ${TFMT} 'gnome-desktop' 'Outputs Gnome desktop description' gnome.desktop:: fedora-doc-${DOCBASE}-gnome.desktop help:: @printf ${TFMT} 'fedora-doc-${DOCBASE}-gnome.desktop' 'Gnome Desktop Files' fedora-doc-${DOCBASE}-gnome.desktop:: ${RPMINFO} $(XSLTPROC) --stringparam docbase "${DOCBASE}" \ ${FDPDIR}/docs-common/packaging/gnome-desktop.xsl \ ${RPMINFO} >$@.tmp && move-if-change $@.tmp $@ help:: @printf ${TFMT} 'kde.desktop' 'Generates KDE desktop files' kde.desktop:: fedora-doc-${DOCBASE}-kde.desktop help:: @printf ${TFMT} 'fedora-doc-${DOCBASE}-kde.desktop' 'KDE desktop files' fedora-doc-${DOCBASE}-kde.desktop:: ${RPMINFO} $(XSLTPROC) --stringparam docbase "${DOCBASE}" \ ${FDPDIR}/docs-common/packaging/kde-desktop.xsl \ ${RPMINFO} >$@.tmp && move-if-change $@.tmp $@ help:: @printf ${TFMT} 'khelp.desktop' 'KDE Help desktop files' khelp.desktop:: fedora-doc-${DOCBASE}-khelp.desktop help:: @printf ${TFMT} 'fedora-doc-${DOCBASE}-khelp.desktop' 'KDE Help files' fedora-doc-${DOCBASE}-khelp.desktop:: ${RPMINFO} $(XSLTPROC) --stringparam docbase "${DOCBASE}" \ ${FDPDIR}/docs-common/packaging/khelpcenter-plugin.xsl \ ${RPMINFO} >$@.tmp && move-if-change $@.tmp $@ define omf_template omf-$(1):: fedora-doc-${DOCBASE}-$(1).omf fedora-doc-${DOCBASE}-$(1).omf:: ${RPMINFO} LANG=$(1).UTF-8 ${XSLTPROC} --stringparam docbase "${DOCBASE}" \ --stringparam lang "$(1)" \ ${FDPDIR}/docs-common/packaging/omf.xsl ${RPMINFO} | \ $(XMLFORMAT) $(XMLFOPTS) >fedora-doc-${DOCBASE}-$(1).omf.tmp && \ move-if-change fedora-doc-${DOCBASE}-$(1).omf.tmp fedora-doc-${DOCBASE}-$(1).omf help:: @printf ${TFMT} 'omf-${1}' 'OMF file for locale ${1}' @printf ${TFMT} 'fedora-doc-${DOCBASE}-${1}.omf' 'OMF file for locale ${1}' endef help:: @printf ${TFMT} 'fedora-doc-${DOCBASE}-C.omf' 'Locale "EN" not the C locale' fedora-doc-${DOCBASE}-C.omf:: fedora-doc-${DOCBASE}-en_US.omf cp fedora-doc-$(DOCBASE)-en_US.omf $@ $(foreach LANG,${LANGUAGES},$(eval $(call omf_template,${LANG}))) help:: @printf ${TFMT} 'omf' 'Generates the OMF files' omf:: $(foreach LANG,${LANGUAGES},omf-$(LANG)) fedora-doc-${DOCBASE}-C.omf help:: @printf ${TFMT} 'src-tarball' 'Builds tar(1) archive of sources & desktop files' src-tarball $(DOCBASE)-$(VERSION).src.tar.gz:: xml-all ${MAKE} fdp-info ${MAKE} gnome.desktop ${MAKE} kde.desktop ${MAKE} khelp.desktop ${MAKE} omf ${RM} -r $(DOCBASE)-$(VERSION) mkdir -p $(DOCBASE)-$(VERSION) find . '(' \ -name '*#*' \ -o -name 'CVS' \ -o -name 'rpm' \ -o -name '*.rpm' \ -o -name '*~' \ -o -name '*.tar.gz' \ -o -name '*.tmp' \ -o -name '${DOCBASE}-${VERSION}' \ -o -name '*.mo' \ ')' -prune -o -print | cpio -pamdv $(DOCBASE)-$(VERSION) tar -zcvf $(DOCBASE)-$(VERSION).src.tar.gz $(DOCBASE)-$(VERSION)/ ${RM} -r $(DOCBASE)-$(VERSION) package-prep:: ${MAKE} distclean ${MAKE} ${DOCBASE}-${shell version doc}.src.tar.gz ${MAKE} ${SPECFILE} ${MAKE} omf ${MAKE} kde.desktop ${MAKE} khelp.desktop mkdir -p rpm/{BUILD,RPMS,SOURCES,SPECS,SRPMS} mkdir -p rpm/RPMS/{i386,i486,i586,i686,noarch,ppc,x86_64} cp -f $(DOCBASE)-$(shell version doc).src.tar.gz rpm/SOURCES/ cp -f ${SPECFILE} rpm/SPECS cp -f *.omf *.desktop rpm/SOURCES rpm-common:: if test $(shell get_latest_revision rpm) -eq 0 ; then \ V=$(shell get_latest_revision doc) ; \ echo "*** Creating revision log entry for rpm ***" ; \ ROLE=rpm ID=1 DETAILS="Update to version $$V" \ $(MAKE) clog ; \ fi ${RM} *.rpm if test $(RPMPREP) != "no" ; then ${MAKE} package-prep ; fi noarch:: rpm-common rpmbuild -bb $(RPMDFLAG) $(RPMFLAGS) rpm/SPECS/$(SPECFILE) if test $(RPMPOST) != "no" ; then $(MAKE) package-post ; fi srpm:: rpm-common rpmbuild -bs $(RPMDFLAG) $(RPMFLAGS) rpm/SPECS/$(SPECFILE) if test $(RPMPOST) != "no" ; then $(MAKE) package-post ; fi rpm:: rpm-common rpmbuild -ba $(RPMDFLAG) $(RPMFLAGS) rpm/SPECS/$(SPECFILE) if test $(RPMPOST) != "no" ; then $(MAKE) package-post ; fi package-post:: $(MAKE) clean # If needed, review materials in rpm/BUILD/ find rpm/ -name '*.rpm' -exec ln '{}' . ';' ls *.rpm showvars:: @echo "VERSION=$(VERSION)" @echo "RELEASE=$(RELEASE)" @echo "PWD=$(PWD)" ######################################################################### define FDP_ENTITIES_template ${1}/$${FDP_ENTITIES}:: ${FDPDIR}/docs-common/common/entities/entities-${1}.xml mkdir -p ${1} xsltproc --stringparam FDPCOMMONDIR "${FDPDIR}/docs-common/common" \ $${FDPDIR}/docs-common/common/entities/entities.xsl \ $${FDPDIR}/docs-common/common/entities/entities-${1}.xml \ >$$@.tmp && move-if-change $$@.tmp $$@ clean:: ${RM} ${1}/$${FDP_ENTITIES} help:: @printf ${TFMT} '${1}/$${FDP_ENTITIES}' 'Link locale ${1} to FDP entities' endef $(foreach L,${LANGUAGES},$(eval $(call FDP_ENTITIES_template,${L}))) ######################################################################### ######################################################################### # 'LOCALE_template' issues rules and targets to symbolicly link the local # file 'locale-entities.xml' to the per-locale entity files located in # the "docs-common/common/entities/" directory. # define LOCALE_template .PHONY: set-locale-${1} set-locale-${1}:: ${1}/${FDP_ENTITIES} ${DOC_ENTITIES_ENT-${PRI_LANG}} clean:: ${RM} ${1}/${FDP_ENTITIES} ifneq "${DOC_ENTITIES_ENT-${1}}" "" ${RM} ${DOC_ENTITIES_ENT-${1}} endif help:: @printf ${TFMT} 'set-locale-${1}' 'Link to locale ${1} FDP entities' endef $(foreach L,${PRI_LANG} ${OTHERS},$(eval $(call LOCALE_template,${L}))) # ######################################################################### ######################################################################### # 'VALIDATE_template' emits rules and targets to validate the XML for the # specified ${LANG} define VALIDATE_template .PHONY: validate-xml-${1} validate-xml-${1}:: set-locale-${1} ${XMLFILES-${1}} ${XMLDEPFILES-${1}} ${XMLLINT} --noout --xinclude --postvalid ${1}/${DOCBASE}.xml help:: @printf ${TFMT} 'validate-xml-${1}' 'Validate locale "${1}" XML' endef $(foreach L,${PRI_LANG} ${OTHERS},$(eval $(call VALIDATE_template,${L}))) .PHONY: validate-xml validate-xml: $(foreach L,${PRI_LANG} ${OTHERS},validate-xml-${L}) help:: @printf ${TFMT} 'validate-xml' 'Validate all XML' # ######################################################################### ######################################################################### # I'm going to bury this target deep at the bottom of the Makefile so # that maybe you won't see it ;-) This is a *VERY DANGEROUS* target # what will destroy *ALL* of your work, that of all the translators, # and probably cause dental cavities as well. You *DO NOT* want to # use this target, ever. The purpose of this target is to erase the # oh-so-carefully hand-crafted .POT and .PO translation files in addition # to all of the other generated product files. THIS IS THE ONLY TARGET # THAT WILL ERASE A .PO FILE! Unless you are working on the I18N part # of the FDP toolchain itself, you MUST NOT EVER use this target! It # voids all warranties! It will never show up on a "make help" list! mrproper: distclean ${RM} po/*.* # OK, you tried it anyway didn't you? To recover you must: # 1) NOT DO A CVS COMMIT; and # 2) Immediately do a "cvs update po" to repair the damage; and # 3) Send $25.00USD to the charity of your choice; or # 4) Just pretend you didn't use this target in the first place. ######################################################################### ######################################################################### # End of Makefile.common ######################################################################### # Local variables: # mode: makefile # End: