[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
trans-coord/gnun/server/gnun GNUmakefile Change...
From: |
Pavel Kharitonov |
Subject: |
trans-coord/gnun/server/gnun GNUmakefile Change... |
Date: |
Sat, 24 Nov 2012 12:26:52 +0000 |
CVSROOT: /sources/trans-coord
Module name: trans-coord
Changes by: Pavel Kharitonov <ineiev> 12/11/24 12:26:51
Modified files:
gnun/server/gnun: GNUmakefile ChangeLog NEWS
Log message:
Improve parallel buildability. Minor cleanups.
* GNUmakefile (all, no-grace-items): Add respective lists
of translations as a dependency.
(substitute-localized-urls): Depend on $(home-translated)
$(articles-translated).
(merge-empty-lines, post-generate-html, template-dir-rules):
New functions.
(rules for templates): Redefine without pattern rules, call
a function for each template file instead. Replace sed
invocation with `merge-empty-lines'.
(regen-whatsnew-translist): Remove target.
($(template-dir)/po/whatsnew.proto):
($(template-dir)/po/whatsnew.%.html): Don't rebuild
whatsnew.translist. The targets gradually lose maintenance.
(home-rules): Remove gnuflashes localizing substitution;
they haven't been used on the home page for quite a while.
(home-rules, article-rules): Replace sed invocations with
`post-generate-html'.
(article-pot-rules, article-rules): When generating .proto,
only call `generate-translinks' if the list of translations
doesn't exist yet.
(article-pot-rules): Add a separate rule for $(1).translist.
(vcs-add-always): Depend on the added files and
`substitute-localized-urls'; invoke `vcs' once with a list
of all files.
* NEWS: Update.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/GNUmakefile?cvsroot=trans-coord&r1=1.142&r2=1.143
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/ChangeLog?cvsroot=trans-coord&r1=1.305&r2=1.306
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/NEWS?cvsroot=trans-coord&r1=1.69&r2=1.70
Patches:
Index: GNUmakefile
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/GNUmakefile,v
retrieving revision 1.142
retrieving revision 1.143
diff -u -b -r1.142 -r1.143
--- GNUmakefile 5 Oct 2012 16:32:18 -0000 1.142
+++ GNUmakefile 24 Nov 2012 12:26:51 -0000 1.143
@@ -206,11 +206,12 @@
else
all: compendia $(template-pots) $(template-translated) $(gnunews) \
$(home-translated) $(ALL_POTS) \
- $(articles-translated) final-stage
+ $(articles-translated) $(patsubst %.pot,%.translist,$(ALL_POTS)) \
+ final-stage
endif
no-grace-items: $(template-pots) $(template-translated) \
- $(home-translated) \
- $(no-grace-translated) final-stage
+ $(home-translated) $(no-grace-translated) \
+ $(patsubst %.pot,%.translist,$(no-grace-pot)) final-stage
.PHONY: substitute-localized-urls update-localized-URLs final-stage
@@ -223,7 +224,7 @@
-include localized-urls.mk
# Substitute and unsubstitute localised URLs in translations.
-substitute-localized-urls:
+substitute-localized-urls: $(home-translated) $(articles-translated)
$(foreach source, ${localized-url-sources}, \
langs=$$(echo ${rootdir}/${source}.*.html | \
$(SED) 's%${rootdir}/${source}\.%%g;s/\.html//g;s/\*//'); \
@@ -476,6 +477,21 @@
$(call substitute-localized-includes,$(1)) $(3)
endef
+# Eliminate more than 1 subsequent empty lines before comments in file $(1).
+define merge-empty-lines
+$(SED) --in-place \
+ ':egin;N;$$$$!begin;s/\([ \t]*\n[ \t]*\)\{3,\}<!--/\n\n<!--/g' $(1)
+endef
+
+# Prepare the intermediate file $(1) generated by `generate-html' for $(M4).
+# $(2) is language code.
+define post-generate-html
+$(SED) --in-place \
+ "s/\(<gnun>m4_include(\`.*\)\([.]html')<\/gnun>\)/\1.$(2)\2/g" $(1); \
+ $(SED) --in-place "s/<gnun>\(.*\)<\/gnun>/\1/g" $(1); \
+ $(call merge-empty-lines,$(1))
+endef
+
comma := ,
# Generate diff file against latest translated revision
# when available.
@@ -736,19 +752,9 @@
$(eval $(call generic-rules,$(g-lang))))
### Specific rules for the templates ###
-.PRECIOUS: $(template-dir)/po/%.pot $(template-dir)/po/%.proto
-
-$(template-dir)/po/%.proto: $(template-dir)/%.html
- cp $< $@
- $(add-gnun-tags)
-
-$(template-dir)/po/%.pot: $(template-dir)/po/%.proto
- $(addfile)
- $(generate-pot)
-
define template-rules
-.PRECIOUS: $(template-dir)/po/%.$(1).po
-$(template-dir)/po/%.$(1).po: $(template-dir)/po/%.pot $(MASTER-$(1))
+.PRECIOUS: $(template-dir)/po/$(1).$(2).po
+$(template-dir)/po/$(1).$(2).po: $(template-dir)/po/$(1).pot $(MASTER-$(2))
# If the POT is new, it is natural that teams cannot translate it at
# once. Create a copy for every PO file in TEMPLATE_LINGUAS so that
# the build can continue without errors.
@@ -759,25 +765,38 @@
# an old version of gettext. The HTML validation errors should be
# clear even if the bug is in the server templates translations.
-PO=$$@ ; $(check-po)
- $(call update-po,$$@,$$<,$(1))
+ $(call update-po,$$@,$$<,$(2))
-$(template-dir)/%.$(1).html: $(template-dir)/%.html \
- $(template-dir)/po/%.$(1).po
+$(template-dir)/$(1).$(2).html: $(template-dir)/$(1).html \
+ $(template-dir)/po/$(1).$(2).po
# If the PO file is invalid and is not fixed within the next GNUN
# build, touch the proper prerequisite to trigger another rebuild.
# Otherwise, next time make doesn't execute the recipe as it considers
# the target up-to-date. This safeguards against sneaking of an empty
# and/or corrupt articles which are then #include'd in others thus
# rendering them invalid.
- PO=$(template-dir)/po/$$(*F).$(1).po ; $(check-po) \
+ PO=$(template-dir)/po/$(1).$(2).po ; $(check-po) \
|| (touch $$$$PO ; exit 1)
$$(addfile)
- $(call generate-html,$(1),$(template-dir)/po/$$(*F).$(1).po,$$@)
- $(SED) --in-place \
- ':egin;N;$$$$!begin;s/\([ \t]*\n[ \t]*\)\{3,\}<!--/\n\n<!--/g' $$@
+ $(call generate-html,$(2),$(template-dir)/po/$(1).$(2).po,$$@)
+ $(call merge-empty-lines,$$@)
+endef
+
+define template-dir-rules
+$(template-dir)/po/$(1).proto: $(template-dir)/$(1).html
+ cp $$< $$@
+ $$(add-gnun-tags)
+
+$(template-dir)/po/$(1).pot: $(template-dir)/po/$(1).proto
+ $$(addfile)
+ $$(generate-pot)
+
+$(foreach t-lang,$(TEMPLATE_LINGUAS), \
+ $(eval $(call template-rules,$(1),$(t-lang))))
endef
-$(foreach t-lang,$(TEMPLATE_LINGUAS),$(eval $(call template-rules,$(t-lang))))
+$(foreach t-file,$(template-files), \
+ $(eval $(call template-dir-rules,$(t-file))))
### End of the templates-specific rules ###
### Specific rules for extra templates ###
@@ -795,8 +814,7 @@
PO=$(1).$(2).po ; $(check-po) || (touch $$$$PO ; exit 1)
$$(addfile)
$(call generate-html,$(2),$(1).$(2).po,$$@)
- $(SED) --in-place \
- ':egin;N;$$$$!begin;s/\([ \t]*\n[ \t]*\)\{3,\}<!--/\n\n<!--/g' $$@
+ $(call merge-empty-lines,$$@)
endef
define extra-template-rules
@@ -829,8 +847,7 @@
$(1).$(2).po
PO=$(1).$(2).po ; $(check-po) || (touch $$$$PO ; exit 1)
$(call generate-html,$(2),$(1).$(2).po,$$@,$(1).pot.opt)
- $(SED) --in-place \
- ':egin;N;$$$$!begin;s/\([ \t]*\n[ \t]*\)\{3,\}<!--/\n\n<!--/g' $$@
+ $(call merge-empty-lines,$$@)
endif #eq ($(wildcard $(1).$(2).po),)
endef
@@ -860,16 +877,6 @@
### End of rules for extra templates ###
-# generate-translinks is desined to be used from eval'ed expression,
-# this is why we can't invoke it from whatsnew rules and rather
-# indirectly define a rule to build the file.
-define whatsnew-translist-rule
-.PHONY: regen-whatsnew-translist
-regen-whatsnew-translist:
- $(call generate-translinks,$(template-dir)/po/whatsnew)
-endef
-$(eval $(whatsnew-translist-rule))
-
### Specific rules for the What's New system (a.k.a. GNU news) ###
# There is a lot of duplication with article-rules, but at least one
# command in every recipe has to be different. Also, we don't want
@@ -880,7 +887,6 @@
$(template-dir)/po/whatsnew.proto: $(template-dir)/whatsnew.html
$(VALIDATESKIP) $(VALIDATE-HTML-NOTIFY) $(NOTIFYSKIP) $(web-addr) $<
$(generate-proto)
- $(MAKE) regen-whatsnew-translist
$(template-dir)/po/whatsnew.pot: $(template-dir)/po/whatsnew.proto \
$(template-dir)/whatsnew.include
@@ -987,7 +993,6 @@
$@ || (PO=$(template-dir)/po/whatsnew.$*.po ; $(touch-hook))
# Copy the target where it belongs.
cp $@ $(template-dir)
- $(MAKE) regen-whatsnew-translist
### End of the whatsnew-specific rules ###
### Specific rules for the homepages ###
@@ -1029,17 +1034,7 @@
PO=$(rootdir)/po/$(2).$(1).po ; $(check-po) || (touch $$$$PO ; exit 1)
$(call generate-html,$(1), \
$(rootdir)/po/$(2).$(1).po,$(rootdir)/po/$(2).$(1).m4)
- $(SED) --in-place \
- "s/\(<gnun>m4_include(\`.*\)\([.]html')<\/gnun>\)/\1.$(1)\2/g" \
- $(rootdir)/po/$(2).$(1).m4
- $(SED) --in-place "s/<gnun>\(.*\)<\/gnun>/\1/g" \
- $(rootdir)/po/$(2).$(1).m4
- $(SED) --in-place \
- ':egin;N;$$$$!begin;s/\([ \t]*\n[ \t]*\)\{3,\}<!--/\n\n<!--/g' \
- $(rootdir)/po/$(2).$(1).m4
- [ ! -f $(rootdir)/gnusflashes.$(1).include ] || $(SED) --in-place \
- "s/\(<!--#include file=\"gnusflashes*\)\(.include\"
-->\)/\1.$(1)\2/g" \
- $(rootdir)/po/$(2).$(1).m4
+ $(call post-generate-html,$(rootdir)/po/$(2).$(1).m4,$(1))
$(call extract-outdated-date,$(rootdir)/po/$(2).$(1).po) > /dev/null \
|| ($(call add-file,$(rootdir)/po/$(2).$(1)-en.html); \
cp $(rootdir)/$(2).html $(rootdir)/po/$(2).$(1)-en.html)
@@ -1062,7 +1057,7 @@
ifneq ($(1), $(findstring $(1),$(no-validate-articles)))
$(VALIDATESKIP) $(VALIDATE-HTML-NOTIFY) $(NOTIFYSKIP) $(web-addr) $$<
endif
- $(call generate-translinks,$(1))
+ test -f $(1).translist || $(call generate-translinks,$(1))
$(call update-translinks-include,$(1))
$$(generate-proto)
@@ -1070,6 +1065,14 @@
$$(addfile)
$$(fixperm)
$$(generate-pot)
+
+# We assume that updating the .translist doesn't affect validity
+# of the HTML files that include it; if this is not the case,
+# validate-all will complain.
+# It might depend on the POs, but then it could be rebuilt too early,
+# before some HTML, and therefore contain a wrong list.
+$(1).translist: $(wildcard $(subst /po/,/,$(1)).*.html)
+ $(call generate-translinks,$1)
endef
# Produce article HTML file and validate it if needed.
@@ -1112,12 +1115,7 @@
endif
PO=$(1).po; $(check-po) || (touch $$$$PO; exit 1)
$(call generate-html,$(2),$(1).po,$(1).m4)
- $(SED) --in-place \
- "s/\(<gnun>m4_include(\`.*\)\([.]html')<\/gnun>\)/\1.$(2)\2/g" $(1).m4
- $(SED) --in-place "s/<gnun>\(.*\)<\/gnun>/\1/g" $(1).m4
- $(SED) --in-place \
- ':egin;N;$$$$!begin;s/\([ \t]*\n[ \t]*\)\{3,\}<!--/\n\n<!--/g' \
- $(1).m4
+ $(call post-generate-html,$(1).m4,$(2))
-$(RM) address@hidden
# If GRACE is not defined, which is the usual case for local manual
# builds, update the target and validate the result.
@@ -1158,7 +1156,6 @@
&& $(call grace-is-over,$(1).po,$(OUTDATED-GRACE)); then \
PO=$(1).po; $(call mark-outdated,$$@,$(2)); \
fi)
- $(call generate-translinks,$(basename $(1)))
$(call extract-outdated-date,$(1).po) > /dev/null \
|| ($(call add-file,$(1)-en.html); \
cp $(subst /po/,/,$(1:.$(2)=).html) $(1)-en.html)
@@ -1172,12 +1169,12 @@
# If VCS=always, add all necessary files. The templates' POT are not
# handled for the moment, but they are more or less stable. Also,
# there is no sense in adding home.pot as this should happen only once.
-# WARNING: This is horribly slow and is implemented just in case.
+# WARNING: This is implemented just in case.
ifneq (,$(findstring always,$(VCS)))
-vcs-add-always:
- for file in $(template-translated) $(home-translated) $(ALL_POTS) \
- $(articles-translated) $(gnunews) $(wildcard generic.*.html); do \
- ($(vcs) add $$file ; exit 0) ; done
+vcs-add-always: $(template-translated) $(home-translated) $(ALL_POTS) \
+ $(articles-translated) $(gnunews) $(wildcard generic.*.html) \
+ substitute-localized-urls
+ -$(vcs) add $(filter-out substitute-localized-urls,$^)
else
vcs-add-always: ;
endif
Index: ChangeLog
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/ChangeLog,v
retrieving revision 1.305
retrieving revision 1.306
diff -u -b -r1.305 -r1.306
--- ChangeLog 23 Nov 2012 05:25:52 -0000 1.305
+++ ChangeLog 24 Nov 2012 12:26:51 -0000 1.306
@@ -1,3 +1,33 @@
+2012-11-24 Pavel Kharitonov <address@hidden>
+
+ Improve parallel buildability. Minor cleanups.
+
+ * GNUmakefile (all, no-grace-items): Add respective lists
+ of translations as a dependency.
+ (substitute-localized-urls): Depend on $(home-translated)
+ $(articles-translated).
+ (merge-empty-lines, post-generate-html, template-dir-rules):
+ New functions.
+ (rules for templates): Redefine without pattern rules, call
+ a function for each template file instead. Replace sed
+ invocation with `merge-empty-lines'.
+ (regen-whatsnew-translist): Remove target.
+ ($(template-dir)/po/whatsnew.proto):
+ ($(template-dir)/po/whatsnew.%.html): Don't rebuild
+ whatsnew.translist. The targets gradually lose maintenance.
+ (home-rules): Remove gnuflashes localizing substitution;
+ they haven't been used on the home page for quite a while.
+ (home-rules, article-rules): Replace sed invocations with
+ `post-generate-html'.
+ (article-pot-rules, article-rules): When generating .proto,
+ only call `generate-translinks' if the list of translations
+ doesn't exist yet.
+ (article-pot-rules): Add a separate rule for $(1).translist.
+ (vcs-add-always): Depend on the added files and
+ `substitute-localized-urls'; invoke `vcs' once with a list
+ of all files.
+ * NEWS: Update.
+
2012-11-23 Pavel Kharitonov <address@hidden>
* GNUmakefile.team (TEAM): Autodetect the language code.
Index: NEWS
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/NEWS,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -b -r1.69 -r1.70
--- NEWS 19 Nov 2012 15:14:26 -0000 1.69
+++ NEWS 24 Nov 2012 12:26:51 -0000 1.70
@@ -37,6 +37,8 @@
** Bugs fixed in 0.7.
+*** Parallel builds must work again (broken since 0.5).
+
*** The `report' target didn't take into account the subdirectories of
`important' directories.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- trans-coord/gnun/server/gnun GNUmakefile Change...,
Pavel Kharitonov <=