Commit d071c091 authored by Josip Rodin's avatar Josip Rodin

this should be a working implementation of proper .mo dependencies :) i just...

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
parent f3d92c8f
...@@ -12,8 +12,19 @@ RELHTMLBASE := ../../www ...@@ -12,8 +12,19 @@ RELHTMLBASE := ../../www
HTMLDIR = $(WMLBASE)/$(RELHTMLBASE)/$(CUR_DIR) HTMLDIR = $(WMLBASE)/$(RELHTMLBASE)/$(CUR_DIR)
LOCALEDIR := $(WMLBASE)/../locale/$(LANGUAGE)/LC_MESSAGES 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" ifneq "$(LANGUAGE)" "en"
GETTEXTDEP := $(LOCALEDIR)/templates.mo $(LOCALEDIR)/countries.mo $(LOCALEDIR)/langs.mo $(LOCALEDIR)/date.mo
ifneq "$(GETTEXTFILES)" "" ifneq "$(GETTEXTFILES)" ""
GETTEXTDEP += $(addprefix $(LOCALEDIR)/,$(GETTEXTFILES)) GETTEXTDEP += $(addprefix $(LOCALEDIR)/,$(GETTEXTFILES))
endif endif
...@@ -106,11 +117,18 @@ ifeq ($(LANGUAGE),en) ...@@ -106,11 +117,18 @@ ifeq ($(LANGUAGE),en)
endif endif
endif endif
LOCALEDESTFILES := $(patsubst $(ENGLISHDIR)/po/%.pot,$(LOCALEDIR)/%.mo,$(wildcard $(ENGLISHDIR)/po/*.pot))
ifneq "$(LANGUAGE)" "en"
# Ensure that MO files do exist # Ensure that MO files do exist
# Translators have to run make under webwml/<lang>/po if they # Translators have to run make under webwml/<lang>/po if they
# want it updated, it cannot be automatically performed. # want it updated, it cannot be automatically performed.
$(LOCALEDIR)/templates.mo: $(LOCALEDESTFILES): $(LOCALEDIR)/%.mo: $(WMLBASE)/po/%.$(LANGUAGE).po
$(MAKE) -C $(WMLBASE)/po install $(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)/%: % $(OTHERDESTFILES): $(HTMLDIR)/%: %
@test -d $(HTMLDIR) || mkdir -m g+w -p $(HTMLDIR) @test -d $(HTMLDIR) || mkdir -m g+w -p $(HTMLDIR)
...@@ -122,7 +140,13 @@ endif ...@@ -122,7 +140,13 @@ endif
# template dependencies # template dependencies
$(TEMPLDIR)/%.wml: $(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: gendep:
@for f in $(TEMPLDIR)/*.wml $(TEMPLDIR)/weeklynews/*.wml; do \ @for f in $(TEMPLDIR)/*.wml $(TEMPLDIR)/weeklynews/*.wml; do \
...@@ -148,36 +172,45 @@ $(TEMPLDIR)/basic.wml: $(TEMPLDIR)/common_translation.wml \ ...@@ -148,36 +172,45 @@ $(TEMPLDIR)/basic.wml: $(TEMPLDIR)/common_translation.wml \
$(TEMPLDIR)/navbar.wml $(TEMPLDIR)/navbar.wml
$(TEMPLDIR)/cdimage.wml: $(TEMPLDIR)/common_translation.wml \ $(TEMPLDIR)/cdimage.wml: $(TEMPLDIR)/common_translation.wml \
$(TEMPLDIR)/common_tags.wml $(TEMPLDIR)/languages.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)/common_translation.wml: $(TEMPLDIR)/common_tags.wml
$(TEMPLDIR)/consultant.wml: $(TEMPLDIR)/common_tags.wml \ $(TEMPLDIR)/consultant.wml: $(TEMPLDIR)/common_tags.wml \
$(TEMPLDIR)/basic.wml $(TEMPLDIR)/languages.wml $(TEMPLDIR)/basic.wml $(TEMPLDIR)/languages.wml \
$(TEMPLDIR)/countries.wml: $(TEMPLDIR)/common_tags.wml $(call locale,consultants)
$(TEMPLDIR)/countries.wml: $(TEMPLDIR)/common_tags.wml\
$(call locale,countries)
$(TEMPLDIR)/countries_all.wml: $(TEMPLDIR)/countries.wml $(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)/ddp.wml: $(TEMPLDIR)/basic.wml \
$(TEMPLDIR)/common_translation.wml $(TEMPLDIR)/languages.wml $(TEMPLDIR)/common_translation.wml $(TEMPLDIR)/languages.wml
$(TEMPLDIR)/debian-cdd.wml: $(TEMPLDIR)/common_tags.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)/event.wml: $(TEMPLDIR)/events_common.wml \
$(TEMPLDIR)/basic.wml $(TEMPLDIR)/languages.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)/fixes_link.wml: $(TEMPLDIR)/common_tags.wml
$(TEMPLDIR)/footer.wml: $(TEMPLDIR)/ctime.wml \ $(TEMPLDIR)/footer.wml: $(TEMPLDIR)/ctime.wml \
$(TEMPLDIR)/common_tags.wml $(TEMPLDIR)/common_tags.wml
$(TEMPLDIR)/header.wml: $(TEMPLDIR)/common_translation.wml $(TEMPLDIR)/header.wml: $(TEMPLDIR)/common_translation.wml
$(TEMPLDIR)/installer.wml: $(TEMPLDIR)/release_data.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)/languages.wml: $(TEMPLDIR)/common_tags.wml \
$(TEMPLDIR)/language_names.wml $(TEMPLDIR)/language_names.wml
$(TEMPLDIR)/legal.wml: $(TEMPLDIR)/common_tags.wml \ $(TEMPLDIR)/legal.wml: $(TEMPLDIR)/common_tags.wml \
$(TEMPLDIR)/common_translation.wml $(TEMPLDIR)/languages.wml \ $(TEMPLDIR)/common_translation.wml $(TEMPLDIR)/languages.wml \
$(TEMPLDIR)/ctime.wml $(TEMPLDIR)/submenu.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)/legal_lists.wml: $(TEMPLDIR)/ctime.wml \
$(TEMPLDIR)/common_tags.wml $(TEMPLDIR)/legal_tags.wml $(TEMPLDIR)/common_tags.wml $(TEMPLDIR)/legal_tags.wml
$(TEMPLDIR)/legal_tags.wml: $(TEMPLDIR)/common_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)/links.tags.wml: $(TEMPLDIR)/common_tags.wml
$(TEMPLDIR)/mainpage.wml: $(TEMPLDIR)/common_translation.wml \ $(TEMPLDIR)/mainpage.wml: $(TEMPLDIR)/common_translation.wml \
$(TEMPLDIR)/basic.wml $(TEMPLDIR)/links.tags.wml \ $(TEMPLDIR)/basic.wml $(TEMPLDIR)/links.tags.wml \
...@@ -188,7 +221,8 @@ $(TEMPLDIR)/navbar.wml: $(TEMPLDIR)/common_translation.wml \ ...@@ -188,7 +221,8 @@ $(TEMPLDIR)/navbar.wml: $(TEMPLDIR)/common_translation.wml \
$(TEMPLDIR)/mirrors.wml $(TEMPLDIR)/mirrors.wml
$(TEMPLDIR)/news.wml: $(TEMPLDIR)/common_translation.wml \ $(TEMPLDIR)/news.wml: $(TEMPLDIR)/common_translation.wml \
$(TEMPLDIR)/common_tags.wml $(TEMPLDIR)/languages.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)/past_event.wml: $(TEMPLDIR)/events_common.wml \
$(TEMPLDIR)/basic.wml $(TEMPLDIR)/languages.wml $(TEMPLDIR)/basic.wml $(TEMPLDIR)/languages.wml
$(TEMPLDIR)/recent_list.wml: $(TEMPLDIR)/ctime.wml \ $(TEMPLDIR)/recent_list.wml: $(TEMPLDIR)/ctime.wml \
...@@ -201,9 +235,11 @@ $(TEMPLDIR)/release_images.wml: $(TEMPLDIR)/installer.wml \ ...@@ -201,9 +235,11 @@ $(TEMPLDIR)/release_images.wml: $(TEMPLDIR)/installer.wml \
$(TEMPLDIR)/security.wml: $(TEMPLDIR)/common_tags.wml \ $(TEMPLDIR)/security.wml: $(TEMPLDIR)/common_tags.wml \
$(TEMPLDIR)/common_translation.wml $(TEMPLDIR)/fixes_link.wml \ $(TEMPLDIR)/common_translation.wml $(TEMPLDIR)/fixes_link.wml \
$(TEMPLDIR)/languages.wml $(TEMPLDIR)/ctime.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)/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)/template.wml: $(TEMPLDIR)/basic.wml \
$(TEMPLDIR)/languages.wml $(TEMPLDIR)/languages.wml
$(TEMPLDIR)/todoitem.wml: $(TEMPLDIR)/common_tags.wml $(TEMPLDIR)/todoitem.wml: $(TEMPLDIR)/common_tags.wml
...@@ -211,9 +247,12 @@ $(TEMPLDIR)/translation-check.wml: $(TEMPLDIR)/languages.wml \ ...@@ -211,9 +247,12 @@ $(TEMPLDIR)/translation-check.wml: $(TEMPLDIR)/languages.wml \
$(TEMPLDIR)/common_tags.wml $(TEMPLDIR)/common_tags.wml
$(TEMPLDIR)/url.wml: $(TEMPLDIR)/common_tags.wml $(TEMPLDIR)/url.wml: $(TEMPLDIR)/common_tags.wml
$(TEMPLDIR)/votebar.wml: $(TEMPLDIR)/languages.wml \ $(TEMPLDIR)/votebar.wml: $(TEMPLDIR)/languages.wml \
$(TEMPLDIR)/common_tags.wml $(TEMPLDIR)/common_tags.wml \
$(TEMPLDIR)/wnpp.wml: $(TEMPLDIR)/common_tags.wml $(call locale,vote)
$(TEMPLDIR)/weeklynews/footer.wml: $(TEMPLDIR)/common_tags.wml $(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)/weeklynews/header.wml: $(TEMPLDIR)/common_tags.wml \
$(TEMPLDIR)/ctime.wml $(TEMPLDIR)/links.tags.wml \ $(TEMPLDIR)/ctime.wml $(TEMPLDIR)/links.tags.wml \
$(TEMPLDIR)/template.wml $(TEMPLDIR)/template.wml
......
...@@ -53,7 +53,7 @@ others_FILES = $(ENGLISHDIR)/banners/index.tags \ ...@@ -53,7 +53,7 @@ others_FILES = $(ENGLISHDIR)/banners/index.tags \
$(ENGLISHDIR)/misc/hardware.def \ $(ENGLISHDIR)/misc/hardware.def \
$(ENGLISHDIR)/mirror/submit.inc $(ENGLISHDIR)/mirror/submit.inc
templates_FILES = $(addprefix $(TEMPLDIR)/, \ 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 \ ddp.wml fixes_link.wml footer.wml languages.wml \
links.tags.wml mirrors.wml recent_list.wml \ links.tags.wml mirrors.wml recent_list.wml \
todoitem.wml translation-check.wml url.wml users.wml) todoitem.wml translation-check.wml url.wml users.wml)
...@@ -174,12 +174,12 @@ cvsupdate: ...@@ -174,12 +174,12 @@ cvsupdate:
else # not english else # not english
# This target prevents breakage when a new .pot file is added %.$(LANGUAGE).po: $(ENGLISHDIR)/po/%.pot
%.$(LANGUAGE).po: # this prevents breakage when a new .pot file is added
cp $(ENGLISHDIR)/po/$*.pot $@ @[ -f $@ ] || cp $(ENGLISHDIR)/po/$*.pot $@
%.mo: %.$(LANGUAGE).po $(ENGLISHDIR)/po/%.pot %.mo: %.$(LANGUAGE).po
msgmerge -q $*.$(LANGUAGE).po $(ENGLISHDIR)/po/$*.pot |\ msgmerge -q $*.$(LANGUAGE).po $(ENGLISHDIR)/po/$*.pot | \
msgfmt --statistics -o $@ - msgfmt --statistics -o $@ -
init-po: init-po:
...@@ -193,11 +193,20 @@ update-po: $(POTFILES) ...@@ -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; \ 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 done
install-mo: $(MOFILES) # can't have this here, it's like that in Makefile.common
[ -d $(LOCALEROOT)/$(LANGUAGE)/LC_MESSAGES ] || mkdir -p $(LOCALEROOT)/$(LANGUAGE)/LC_MESSAGES # DESTMOFILES := $(addprefix $(LOCALEROOT)/$(LANGUAGE)/LC_MESSAGES/,$(MOFILES))
for d in $(DOMAINS); do \ #
cp -vu $$d.mo $(LOCALEROOT)/$(LANGUAGE)/LC_MESSAGES/$$d.mo; \ # $(DESTMOFILES): $(LOCALEROOT)/$(LANGUAGE)/LC_MESSAGES/%.mo: %.mo
done # @[ -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:: clean::
rm -f *.mo rm -f *.mo
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment