| 1 |
#
|
| 2 |
# Makefile for the release notes, top-level
|
| 3 |
#
|
| 4 |
|
| 5 |
# TODO: Once #477458 is fixed in stable remove all committed sgml files
|
| 6 |
# which are generated from a PO file (was a workaround for old po4a).
|
| 7 |
|
| 8 |
manual := release-notes
|
| 9 |
|
| 10 |
arches := $(shell grep '<phrase arch=' $(CURDIR)/$(manual).ent \
|
| 11 |
| sed 's/.* arch=.\([a-z0-9]*\).*/\1/' | sort -u)
|
| 12 |
|
| 13 |
ifeq "$(OFFICIALWEBBUILD)" "true"
|
| 14 |
install_file := install -m 2664 -p
|
| 15 |
makedir := mkdir -p -m 2775
|
| 16 |
else
|
| 17 |
install_file := install -m 644 -p
|
| 18 |
makedir := mkdir -p -m 0755
|
| 19 |
endif
|
| 20 |
|
| 21 |
LANGUAGES := en ca cs de es fi fr it ja pl pt_BR pt ro ru sv zh_TW
|
| 22 |
# languages w/o .po files
|
| 23 |
# (either original English or translators don't like .po)
|
| 24 |
DBK_LANGUAGES := en pt_BR
|
| 25 |
XMLROFF_LANGS=cs ja pl ro ru vi zh_CN
|
| 26 |
|
| 27 |
LANGUAGES-publish := $(addsuffix -publish,$(LANGUAGES))
|
| 28 |
LANGUAGES-clean := $(addsuffix -clean,$(LANGUAGES))
|
| 29 |
|
| 30 |
SOURCES := $(wildcard en/*.dbk)
|
| 31 |
|
| 32 |
# DocBook stuff
|
| 33 |
XP=xsltproc --nonet --novalid --xinclude
|
| 34 |
XL=xmllint --nonet --noout --postvalid --xinclude
|
| 35 |
# XSL files and parameters
|
| 36 |
# note: the URL is used as identifier, no HTTP is used!
|
| 37 |
DOCBOOK_XSL=http://docbook.sourceforge.net/release/xsl/current
|
| 38 |
# for HTML output
|
| 39 |
DBK2HTML=$(CURDIR)/html.xsl
|
| 40 |
# all in one file for text output
|
| 41 |
DBK2HTML1=$(CURDIR)/txt.xsl
|
| 42 |
DBLATEX=dblatex --style=db2latex
|
| 43 |
PROFILE=$(DOCBOOK_XSL)/profiling/profile.xsl
|
| 44 |
XMLROFF=xmlroff --backend cairo
|
| 45 |
|
| 46 |
ifeq "$(DRAFT)" "1"
|
| 47 |
draftmode := yes
|
| 48 |
else
|
| 49 |
draftmode := maybe
|
| 50 |
endif
|
| 51 |
|
| 52 |
# po4a stuff
|
| 53 |
UPDATEPO=po4a-updatepo --format docbook
|
| 54 |
PO_FILES=$(wildcard de/*.po es/*.po)
|
| 55 |
# The "--keep 0" should be removed as soon as the translations are ready
|
| 56 |
TRANSLATE=po4a-translate --format docbook --keep 0
|
| 57 |
|
| 58 |
.SUFFIXES:
|
| 59 |
.PHONY: publish all clean $(LANGUAGES) $(LANGUAGES-publish)
|
| 60 |
|
| 61 |
all:
|
| 62 |
for l in $(LANGUAGES); do \
|
| 63 |
for a in $(arches); do \
|
| 64 |
$(MAKE) LINGUA=$$l architecture=$$l html txt pdf ps; \
|
| 65 |
done; \
|
| 66 |
done
|
| 67 |
|
| 68 |
$(LANGUAGES):
|
| 69 |
ifeq "$(architecture)" ""
|
| 70 |
@echo "architecture variable must be set, try one of: $(arches)"
|
| 71 |
exit 1
|
| 72 |
else
|
| 73 |
-$(MAKE) LINGUA=$@ html txt pdf ps
|
| 74 |
endif
|
| 75 |
|
| 76 |
publish: clean
|
| 77 |
set -ex; \
|
| 78 |
for arch in $(arches); do \
|
| 79 |
$(MAKE) architecture=$$arch; \
|
| 80 |
$(makedir) $(PUBLISHDIR)/$$arch/$(manual); \
|
| 81 |
$(makedir) $(manual)-$$arch; \
|
| 82 |
for lang in $(LANGUAGES); do \
|
| 83 |
$(makedir) $(manual)-$$arch/$$lang; \
|
| 84 |
$(install_file) $$lang/$(manual).$$lang.$$arch.html/* \
|
| 85 |
$(PUBLISHDIR)/$$arch/$(manual)/; \
|
| 86 |
$(install_file) $$lang/$(manual).$$arch.txt \
|
| 87 |
$(PUBLISHDIR)/$$arch/$(manual).$$lang.txt; \
|
| 88 |
$(install_file) $$lang/$(manual).$$lang.$$arch.pdf \
|
| 89 |
$(PUBLISHDIR)/$$arch/$(manual).$$lang.pdf; \
|
| 90 |
$(install_file) $$lang/$(manual).$$lang.$$arch.ps \
|
| 91 |
$(PUBLISHDIR)/$$arch/$(manual).$$lang.ps; \
|
| 92 |
$(install_file) $$lang/$(manual).$$lang.$$arch.html/* \
|
| 93 |
$(manual)-$$arch/$$lang/; \
|
| 94 |
$(install_file) $$lang/$(manual).$$arch.txt \
|
| 95 |
$(manual)-$$arch/$$lang/$(manual).$$lang.txt; \
|
| 96 |
$(install_file) $$lang/$(manual).$$lang.$$arch.pdf \
|
| 97 |
$(manual)-$$arch/$$lang/$(manual).$$lang.pdf ; \
|
| 98 |
$(install_file) $$lang/$(manual).$$lang.$$arch.ps \
|
| 99 |
$(manual)-$$arch/$$lang/$(manual).$$lang.ps ; \
|
| 100 |
done; \
|
| 101 |
for i in $(PUBLISHDIR)/$$arch/$(manual)/*.en.html; do \
|
| 102 |
ln -sf `basename $$i` $${i%.en.html}.html; \
|
| 103 |
done; \
|
| 104 |
if [ -n "$(PUBLISHTARBALL)" ]; then (cd $(manual)-$$arch \
|
| 105 |
&& tar czf $(PUBLISHDIR)/$(manual)-$$arch.tar.gz *); fi \
|
| 106 |
done
|
| 107 |
|
| 108 |
ifdef LINGUA
|
| 109 |
html: $(LINGUA)/$(manual).$(architecture).html/index.html
|
| 110 |
$(LINGUA)/$(manual).$(architecture).html/index.html: \
|
| 111 |
$(LINGUA)/$(manual).$(architecture).xml html.xsl
|
| 112 |
mkdir -p $(LINGUA)/$(manual).$(architecture).html
|
| 113 |
cd $(LINGUA) && $(XP) -o $(manual).$(architecture).html/ \
|
| 114 |
--stringparam html.ext .$(LINGUA).html \
|
| 115 |
--stringparam draft.mode $(draftmode) \
|
| 116 |
$(DBK2HTML) $(manual).$(architecture).xml
|
| 117 |
|
| 118 |
pdf: $(LINGUA)/$(manual).$(architecture).pdf
|
| 119 |
ps: $(LINGUA)/$(manual).$(architecture).ps
|
| 120 |
ifneq "$(filter $(XMLROFF_LANGS),$(LINGUA))" ""
|
| 121 |
$(LINGUA)/$(manual).$(architecture).pdf: \
|
| 122 |
$(LINGUA)/$(manual).$(architecture).fo
|
| 123 |
$(LINGUA)/$(manual).$(architecture).ps: \
|
| 124 |
$(LINGUA)/$(manual).$(architecture).fo
|
| 125 |
$(LINGUA)/$(manual).$(architecture).fo: \
|
| 126 |
$(LINGUA)/$(manual).$(architecture).xml fo.xsl
|
| 127 |
else
|
| 128 |
$(LINGUA)/$(manual).$(architecture).pdf: \
|
| 129 |
$(LINGUA)/$(manual).$(architecture).xml
|
| 130 |
$(LINGUA)/$(manual).$(architecture).ps: \
|
| 131 |
$(LINGUA)/$(manual).$(architecture).xml
|
| 132 |
endif
|
| 133 |
|
| 134 |
%.fo: %.xml
|
| 135 |
$(XP) -o $@ --stringparam draft.mode $(draftmode) fo.xsl $<
|
| 136 |
|
| 137 |
%.pdf: %.fo
|
| 138 |
$(XMLROFF) -o $@ $<
|
| 139 |
|
| 140 |
%.pdf: %.xml
|
| 141 |
$(DBLATEX) --output=$@ --param=draft.mode=$(draftmode) $<
|
| 142 |
|
| 143 |
# Can't we just drop PS in favour of PDF?
|
| 144 |
%.ps: %.fo
|
| 145 |
$(XMLROFF) --format postscript -o $@ $<
|
| 146 |
|
| 147 |
%.ps: %.xml
|
| 148 |
$(DBLATEX) --output=$@ --ps --param=draft.mode=$(draftmode) $<
|
| 149 |
|
| 150 |
txt: $(LINGUA)/$(manual).$(architecture).txt
|
| 151 |
$(LINGUA)/$(manual).$(architecture).txt: \
|
| 152 |
$(LINGUA)/$(manual).$(architecture).xml txt.xsl
|
| 153 |
$(XP) --stringparam draft.mode $(draftmode) $(DBK2HTML1) $< \
|
| 154 |
| w3m -cols 70 -dump -no-graph -T text/html > $@
|
| 155 |
|
| 156 |
# profiling for architecture, needed by all output formats
|
| 157 |
condition := ;
|
| 158 |
ifeq "$(DRAFT)" "1"
|
| 159 |
condition := fixme
|
| 160 |
endif
|
| 161 |
space := $(undef) $(undef)
|
| 162 |
semic := $(undef);$(undef)
|
| 163 |
otherarchs := $(subst $(space),$(semic), \
|
| 164 |
$(addprefix not-,$(filter-out $(architecture),$(arches))))
|
| 165 |
ifneq "$(filter $(architecture),i386 amd64 powerpc)" ""
|
| 166 |
condition := $(condition);g-i
|
| 167 |
endif
|
| 168 |
|
| 169 |
ifneq "$(filter $(architecture),mips mipsel)" ""
|
| 170 |
initrd := $(condition);no-initrd
|
| 171 |
else
|
| 172 |
initrd := $(condition);uses-initrd
|
| 173 |
endif
|
| 174 |
|
| 175 |
$(LINGUA)/$(manual).$(architecture).xml: \
|
| 176 |
$(patsubst en/%,$(LINGUA)/%,$(SOURCES))
|
| 177 |
$(XP) --stringparam profile.arch "$(architecture)$(otherarchs)" \
|
| 178 |
--stringparam profile.condition "$(condition)" \
|
| 179 |
$(PROFILE) $(@D)/$(manual).dbk > $@
|
| 180 |
endif
|
| 181 |
|
| 182 |
# There must be an easier way than recursive make!
|
| 183 |
.PRECIOUS: %.dbk %.ent
|
| 184 |
ifndef LINGUA
|
| 185 |
%.dbk %.ent: FORCE
|
| 186 |
$(MAKE) $@ LINGUA=`basename $(@D)`
|
| 187 |
|
| 188 |
FORCE:
|
| 189 |
else
|
| 190 |
ifneq "$(LINGUA)" "en"
|
| 191 |
$(LINGUA)/%.dbk: en/%.dbk $(LINGUA)/%.po
|
| 192 |
$(TRANSLATE) --master $< --po $(@:.dbk=.po) --localized $@
|
| 193 |
endif
|
| 194 |
endif
|
| 195 |
|
| 196 |
ifdef LINGUA
|
| 197 |
.PHONY: updatepo
|
| 198 |
updatepo: $(patsubst en/%.dbk,$(LINGUA)/%.po,$(wildcard en/*.dbk))
|
| 199 |
$(LINGUA)/%.po: en/%.dbk
|
| 200 |
[ "$(LINGUA)" = "en" ] || $(UPDATEPO) --master $< --po $@
|
| 201 |
|
| 202 |
validate: $(patsubst en/%,$(LINGUA)/%,$(SOURCES))
|
| 203 |
$(XL) $(LINGUA)/$(manual).dbk
|
| 204 |
endif
|
| 205 |
|
| 206 |
tidypo:
|
| 207 |
for po in $(wildcard */*.po); do \
|
| 208 |
msgcat $$po > $$po.tmp && mv $$po.tmp $$po; \
|
| 209 |
done
|
| 210 |
|
| 211 |
ifndef LINGUA
|
| 212 |
%:
|
| 213 |
for l in $(LANGUAGES); do \
|
| 214 |
$(MAKE) $@ LINGUA=$$l; \
|
| 215 |
done
|
| 216 |
endif
|
| 217 |
|
| 218 |
clean::
|
| 219 |
rm -f relnotes.tar.bz2
|
| 220 |
find -maxdepth 1 -name '$(manual)-*' -type d -exec rm -fr {} \;
|
| 221 |
clean:: $(LANGUAGES-clean)
|
| 222 |
|
| 223 |
$(LANGUAGES-clean):
|
| 224 |
cd $(subst -clean,,$@); \
|
| 225 |
rm -rf *~ .*~ $(manual).*.html $(manual).*.txt $(manual).*.pdf \
|
| 226 |
$(manual).*.ps $(manual).*.xml
|
| 227 |
|
| 228 |
printarches:
|
| 229 |
@echo $(arches)
|