diff options
author | Josip Rodin <joy> | 2008-08-17 04:04:59 +0000 |
---|---|---|
committer | Josip Rodin <joy> | 2008-08-17 04:04:59 +0000 |
commit | d071c091f0e73168239b934574a5d44ffe2632f1 (patch) | |
tree | 79d74e957f3a21e0599c2082391a62f2cea193df | |
parent | f3d92c8fce847904ac5489f087f7dc6346c1dccb (diff) |
this should be a working implementation of proper .mo dependencies :) i just had to add a couple of small kludges here and there, for English missing .mo files, for the %.mo install rules not to conflict between the two makefiles, to avoid excess cross-language touching of templates, and finally avoiding overwriting .po with .pot :)
CVS version numbers
Makefile.common: 1.95 -> 1.96
english/po/Makefile: 1.70 -> 1.71
-rw-r--r-- | Makefile.common | 77 | ||||
-rw-r--r-- | english/po/Makefile | 31 |
2 files changed, 78 insertions, 30 deletions
diff --git a/Makefile.common b/Makefile.common index 81c3fa6cd1f..65db381989a 100644 --- a/Makefile.common +++ b/Makefile.common @@ -12,8 +12,19 @@ RELHTMLBASE := ../../www HTMLDIR = $(WMLBASE)/$(RELHTMLBASE)/$(CUR_DIR) LOCALEDIR := $(WMLBASE)/../locale/$(LANGUAGE)/LC_MESSAGES +essential-locale-files := templates countries langs date +ifeq "$(LANGUAGE)" "en" +locale = $(addsuffix .pot, $(addprefix $(ENGLISHDIR)/po/, $(1))) +$(ENGLISHDIR)/po/%.pot: + touch $@ # because of $(?F) +else +locale = $(addsuffix .mo, $(addprefix $(LOCALEDIR)/, $(1))) +$(LOCALEDIR)/%.mo: + touch $@ # because of $(?F) +endif +GETTEXTDEP := $(call locale, $(essential-locale-files) ) + ifneq "$(LANGUAGE)" "en" -GETTEXTDEP := $(LOCALEDIR)/templates.mo $(LOCALEDIR)/countries.mo $(LOCALEDIR)/langs.mo $(LOCALEDIR)/date.mo ifneq "$(GETTEXTFILES)" "" GETTEXTDEP += $(addprefix $(LOCALEDIR)/,$(GETTEXTFILES)) endif @@ -106,11 +117,18 @@ ifeq ($(LANGUAGE),en) endif endif +LOCALEDESTFILES := $(patsubst $(ENGLISHDIR)/po/%.pot,$(LOCALEDIR)/%.mo,$(wildcard $(ENGLISHDIR)/po/*.pot)) + +ifneq "$(LANGUAGE)" "en" # Ensure that MO files do exist # Translators have to run make under webwml/<lang>/po if they # want it updated, it cannot be automatically performed. -$(LOCALEDIR)/templates.mo: - $(MAKE) -C $(WMLBASE)/po install +$(LOCALEDESTFILES): $(LOCALEDIR)/%.mo: $(WMLBASE)/po/%.$(LANGUAGE).po + $(MAKE) -C $(WMLBASE)/po install-$*.mo +else +# English doesn't generate those .mo files, so just fake them +$(LOCALEDESTFILES): $(LOCALEDIR)/%.mo: $(ENGLISHDIR)/po/%.pot +endif $(OTHERDESTFILES): $(HTMLDIR)/%: % @test -d $(HTMLDIR) || mkdir -m g+w -p $(HTMLDIR) @@ -122,7 +140,13 @@ endif # template dependencies $(TEMPLDIR)/%.wml: - touch $@ +ifeq "$(LANGUAGE)" "en" + touch $@ # because of $(?F) +else + @if [ "$(findstring .mo,$(?F))" = "" ]; then \ + touch $@; echo "touch $@ # because of $(?F)"; \ + fi +endif gendep: @for f in $(TEMPLDIR)/*.wml $(TEMPLDIR)/weeklynews/*.wml; do \ @@ -148,36 +172,45 @@ $(TEMPLDIR)/basic.wml: $(TEMPLDIR)/common_translation.wml \ $(TEMPLDIR)/navbar.wml $(TEMPLDIR)/cdimage.wml: $(TEMPLDIR)/common_translation.wml \ $(TEMPLDIR)/common_tags.wml $(TEMPLDIR)/languages.wml \ - $(TEMPLDIR)/links.tags.wml $(TEMPLDIR)/basic.wml + $(TEMPLDIR)/links.tags.wml $(TEMPLDIR)/basic.wml \ + $(call locale,cdimage) $(TEMPLDIR)/common_translation.wml: $(TEMPLDIR)/common_tags.wml $(TEMPLDIR)/consultant.wml: $(TEMPLDIR)/common_tags.wml \ - $(TEMPLDIR)/basic.wml $(TEMPLDIR)/languages.wml -$(TEMPLDIR)/countries.wml: $(TEMPLDIR)/common_tags.wml + $(TEMPLDIR)/basic.wml $(TEMPLDIR)/languages.wml \ + $(call locale,consultants) +$(TEMPLDIR)/countries.wml: $(TEMPLDIR)/common_tags.wml\ + $(call locale,countries) $(TEMPLDIR)/countries_all.wml: $(TEMPLDIR)/countries.wml -$(TEMPLDIR)/ctime.wml: $(TEMPLDIR)/common_tags.wml +$(TEMPLDIR)/ctime.wml: $(TEMPLDIR)/common_tags.wml\ + $(call locale,date) $(TEMPLDIR)/ddp.wml: $(TEMPLDIR)/basic.wml \ $(TEMPLDIR)/common_translation.wml $(TEMPLDIR)/languages.wml $(TEMPLDIR)/debian-cdd.wml: $(TEMPLDIR)/common_tags.wml \ - $(TEMPLDIR)/template.wml + $(TEMPLDIR)/template.wml\ + $(call locale,debian-cdd) $(TEMPLDIR)/event.wml: $(TEMPLDIR)/events_common.wml \ $(TEMPLDIR)/basic.wml $(TEMPLDIR)/languages.wml -$(TEMPLDIR)/events_common.wml: $(TEMPLDIR)/common_translation.wml +$(TEMPLDIR)/events_common.wml: $(TEMPLDIR)/common_translation.wml \ + $(call locale,legal) $(TEMPLDIR)/fixes_link.wml: $(TEMPLDIR)/common_tags.wml $(TEMPLDIR)/footer.wml: $(TEMPLDIR)/ctime.wml \ $(TEMPLDIR)/common_tags.wml $(TEMPLDIR)/header.wml: $(TEMPLDIR)/common_translation.wml $(TEMPLDIR)/installer.wml: $(TEMPLDIR)/release_data.wml -$(TEMPLDIR)/language_names.wml: $(TEMPLDIR)/common_tags.wml +$(TEMPLDIR)/language_names.wml: $(TEMPLDIR)/common_tags.wml \ + $(call locale,langs) $(TEMPLDIR)/languages.wml: $(TEMPLDIR)/common_tags.wml \ $(TEMPLDIR)/language_names.wml $(TEMPLDIR)/legal.wml: $(TEMPLDIR)/common_tags.wml \ $(TEMPLDIR)/common_translation.wml $(TEMPLDIR)/languages.wml \ $(TEMPLDIR)/ctime.wml $(TEMPLDIR)/submenu.wml \ - $(TEMPLDIR)/legal_tags.wml $(TEMPLDIR)/basic.wml + $(TEMPLDIR)/legal_tags.wml $(TEMPLDIR)/basic.wml \ + $(call locale,legal) $(TEMPLDIR)/legal_lists.wml: $(TEMPLDIR)/ctime.wml \ $(TEMPLDIR)/common_tags.wml $(TEMPLDIR)/legal_tags.wml $(TEMPLDIR)/legal_tags.wml: $(TEMPLDIR)/common_tags.wml \ - $(TEMPLDIR)/common_translation.wml + $(TEMPLDIR)/common_translation.wml \ + $(call locale,legal) $(TEMPLDIR)/links.tags.wml: $(TEMPLDIR)/common_tags.wml $(TEMPLDIR)/mainpage.wml: $(TEMPLDIR)/common_translation.wml \ $(TEMPLDIR)/basic.wml $(TEMPLDIR)/links.tags.wml \ @@ -188,7 +221,8 @@ $(TEMPLDIR)/navbar.wml: $(TEMPLDIR)/common_translation.wml \ $(TEMPLDIR)/mirrors.wml $(TEMPLDIR)/news.wml: $(TEMPLDIR)/common_translation.wml \ $(TEMPLDIR)/common_tags.wml $(TEMPLDIR)/languages.wml \ - $(TEMPLDIR)/ctime.wml $(TEMPLDIR)/basic.wml + $(TEMPLDIR)/ctime.wml $(TEMPLDIR)/basic.wml \ + $(call locale,legal) $(TEMPLDIR)/past_event.wml: $(TEMPLDIR)/events_common.wml \ $(TEMPLDIR)/basic.wml $(TEMPLDIR)/languages.wml $(TEMPLDIR)/recent_list.wml: $(TEMPLDIR)/ctime.wml \ @@ -201,9 +235,11 @@ $(TEMPLDIR)/release_images.wml: $(TEMPLDIR)/installer.wml \ $(TEMPLDIR)/security.wml: $(TEMPLDIR)/common_tags.wml \ $(TEMPLDIR)/common_translation.wml $(TEMPLDIR)/fixes_link.wml \ $(TEMPLDIR)/languages.wml $(TEMPLDIR)/ctime.wml \ - $(TEMPLDIR)/securityreferences.wml $(TEMPLDIR)/basic.wml + $(TEMPLDIR)/securityreferences.wml $(TEMPLDIR)/basic.wml \ + $(call locale,security) $(TEMPLDIR)/speakers.wml: $(TEMPLDIR)/common_tags.wml \ - $(TEMPLDIR)/basic.wml $(TEMPLDIR)/languages.wml + $(TEMPLDIR)/basic.wml $(TEMPLDIR)/languages.wml \ + $(call locale,legal) $(TEMPLDIR)/template.wml: $(TEMPLDIR)/basic.wml \ $(TEMPLDIR)/languages.wml $(TEMPLDIR)/todoitem.wml: $(TEMPLDIR)/common_tags.wml @@ -211,9 +247,12 @@ $(TEMPLDIR)/translation-check.wml: $(TEMPLDIR)/languages.wml \ $(TEMPLDIR)/common_tags.wml $(TEMPLDIR)/url.wml: $(TEMPLDIR)/common_tags.wml $(TEMPLDIR)/votebar.wml: $(TEMPLDIR)/languages.wml \ - $(TEMPLDIR)/common_tags.wml -$(TEMPLDIR)/wnpp.wml: $(TEMPLDIR)/common_tags.wml -$(TEMPLDIR)/weeklynews/footer.wml: $(TEMPLDIR)/common_tags.wml + $(TEMPLDIR)/common_tags.wml \ + $(call locale,vote) +$(TEMPLDIR)/wnpp.wml: $(TEMPLDIR)/common_tags.wml \ + $(call locale,wnpp) +$(TEMPLDIR)/weeklynews/footer.wml: $(TEMPLDIR)/common_tags.wml \ + $(call locale,newsevents) $(TEMPLDIR)/weeklynews/header.wml: $(TEMPLDIR)/common_tags.wml \ $(TEMPLDIR)/ctime.wml $(TEMPLDIR)/links.tags.wml \ $(TEMPLDIR)/template.wml diff --git a/english/po/Makefile b/english/po/Makefile index 1cebb1432fa..09ecd860779 100644 --- a/english/po/Makefile +++ b/english/po/Makefile @@ -53,7 +53,7 @@ others_FILES = $(ENGLISHDIR)/banners/index.tags \ $(ENGLISHDIR)/misc/hardware.def \ $(ENGLISHDIR)/mirror/submit.inc templates_FILES = $(addprefix $(TEMPLDIR)/, \ - cdimage.wml common_tags.wml common_translation.wml \ + common_tags.wml common_translation.wml \ ddp.wml fixes_link.wml footer.wml languages.wml \ links.tags.wml mirrors.wml recent_list.wml \ todoitem.wml translation-check.wml url.wml users.wml) @@ -174,12 +174,12 @@ cvsupdate: else # not english -# This target prevents breakage when a new .pot file is added -%.$(LANGUAGE).po: - cp $(ENGLISHDIR)/po/$*.pot $@ +%.$(LANGUAGE).po: $(ENGLISHDIR)/po/%.pot +# this prevents breakage when a new .pot file is added + @[ -f $@ ] || cp $(ENGLISHDIR)/po/$*.pot $@ -%.mo: %.$(LANGUAGE).po $(ENGLISHDIR)/po/%.pot - msgmerge -q $*.$(LANGUAGE).po $(ENGLISHDIR)/po/$*.pot |\ +%.mo: %.$(LANGUAGE).po + msgmerge -q $*.$(LANGUAGE).po $(ENGLISHDIR)/po/$*.pot | \ msgfmt --statistics -o $@ - init-po: @@ -193,11 +193,20 @@ update-po: $(POTFILES) msgmerge --previous -F -q $$d.$(LANGUAGE).po $(ENGLISHDIR)/po/$$d.pot -o $$d.$(LANGUAGE).po.new && mv $$d.$(LANGUAGE).po.new $$d.$(LANGUAGE).po; \ done -install-mo: $(MOFILES) - [ -d $(LOCALEROOT)/$(LANGUAGE)/LC_MESSAGES ] || mkdir -p $(LOCALEROOT)/$(LANGUAGE)/LC_MESSAGES - for d in $(DOMAINS); do \ - cp -vu $$d.mo $(LOCALEROOT)/$(LANGUAGE)/LC_MESSAGES/$$d.mo; \ - done +# can't have this here, it's like that in Makefile.common +# DESTMOFILES := $(addprefix $(LOCALEROOT)/$(LANGUAGE)/LC_MESSAGES/,$(MOFILES)) +# +# $(DESTMOFILES): $(LOCALEROOT)/$(LANGUAGE)/LC_MESSAGES/%.mo: %.mo +# @[ -d $(LOCALEROOT)/$(LANGUAGE)/LC_MESSAGES ] || mkdir -p $(LOCALEROOT)/$(LANGUAGE)/LC_MESSAGES +# @cp -vu $< $(LOCALEROOT)/$(LANGUAGE)/LC_MESSAGES/$< + +INSTMOFILES := $(addprefix install-,$(MOFILES)) + +$(INSTMOFILES): install-%.mo: %.mo + @[ -d $(LOCALEROOT)/$(LANGUAGE)/LC_MESSAGES ] || mkdir -p $(LOCALEROOT)/$(LANGUAGE)/LC_MESSAGES + @cp -vu $< $(LOCALEROOT)/$(LANGUAGE)/LC_MESSAGES/$< + +install-mo: $(INSTMOFILES) clean:: rm -f *.mo |