Kalle Olavi Niemitalo <[EMAIL PROTECTED]> writes:

> Here is a simple patch that makes po/Makefile.am tell msgfmt to
> store the *.gmo files in the source directory, rather than in the
> build directory.  This is a good idea for two reasons:

Apparently, this has not been applied.  Here is a new patch
relative to a recent version from GIT.

I changed the %.gmo rule to use $@ instead of a shell variable,
and made various tweaks in it to better support strange file names,
e.g. spaces in $(srcdir).  I suppose other makefiles in ELinks
do not support those, but one must start somewhere.  I don't think
it will ever be feasible to support backslashes and quotes without
horrible contortions, but spaces should be doable.

I have also taken the liberty to remove the SUFFIXES variable and
the .SUFFIXES rule.  According to the documentation, GNU Make
uses them only for suffix rules, which have been replaced with
pattern rules in po/Makefile.  The makefiles included by
po/Makefile do not define suffix rules, either.

The dist target in po/Makefile does not work, because it depends
on distdir, for which there is no rule.  I did not remove it yet,
because I don't know if some is working on it.

diff --git a/po/Makefile b/po/Makefile
index 092cd12..b6c207c 100644
--- a/po/Makefile
+++ b/po/Makefile
@@ -1,6 +1,9 @@
 top_builddir=..
 include $(top_builddir)/Makefile.config
 
+# The CATALOGS, GMOFILES, PO, and lang variables do not include any directory
+# names.  Instead, this Makefile adds $(srcdir)/ explicitly where needed.
+
 # Where to install the catalog files.
 localedir = $(datadir)/locale
 
@@ -12,13 +15,12 @@ MSGMERGE = msgmerge
 POTFILES_ABS_LIST = potfiles.list
 
 
-SUFFIXES = .po .gmo .mo
-.SUFFIXES: .gmo .mo .po
-
-%.gmo: $(srcdir)/%.po
-       @file=`echo $* | sed 's,.*/,,'`.gmo \
-         && rm -f $$file && echo -n $*": " \
-         && $(GMSGFMT) --statistics -o $$file $<
+# Generate *.gmo files in the source directory, not in the build directory.
+# elinks-*.tar.gz includes the *.gmo files so that people can compile ELinks
+# without first installing the Gettext utilities.
+$(srcdir)/%.gmo: $(srcdir)/%.po
+       rm -f -- "$@" && printf "%s: " "$*" \
+         && $(GMSGFMT) --statistics -o "$@" -- "$<"
 
 
 ### The default rule
@@ -35,7 +37,7 @@ SUFFIXES = .po .gmo .mo
 #
 # $(CATALOGS) is empty if --disable-nls. Beats using *-(yes|no) targets.
 
-all-local: $(CATALOGS)
+all-local: $(addprefix $(srcdir)/,$(CATALOGS))
 
 
 ### Creating the template po template file
@@ -68,8 +70,8 @@ update-po: Makefile $(srcdir)/$(PACKAGE)
        @cd $(srcdir)
        @$(foreach lang,$(basename $(if $(strip $(PO)),$(PO),$(GMOFILES))), \
          echo -n "$(lang): "; \
-         if $(MSGMERGE) $(lang).po $(PACKAGE).pot -o $(lang).new.po; then \
-           mv -f $(lang).new.po $(lang).po; \
+         if $(MSGMERGE) $(srcdir)/$(lang).po $(srcdir)/$(PACKAGE).pot -o 
$(lang).new.po; then \
+           mv -f $(lang).new.po $(srcdir)/$(lang).po; \
          else \
            echo "msgmerge failed!"; \
            rm -f $(lang).new.po; \
@@ -77,7 +79,7 @@ update-po: Makefile $(srcdir)/$(PACKAGE)
        )
        $(MAKE) update-gmo
 
-update-gmo: Makefile $(GMOFILES)
+update-gmo: Makefile $(addprefix $(srcdir)/,$(GMOFILES))
        @:
 
 
@@ -87,7 +89,7 @@ update-gmo: Makefile $(GMOFILES)
 check-po:
        @$(foreach lang,$(basename $(if $(strip $(PO)),$(PO),$(GMOFILES))), \
          echo -n "$(lang): "; \
-         $(GMSGFMT) --check --check-accelerators=~ --verbose --statistics -o 
/dev/null $(lang).po; \
+         $(GMSGFMT) --check --check-accelerators=~ --verbose --statistics -o 
/dev/null $(srcdir)/$(lang).po; \
        )
 
 ### Installation and distribution
@@ -98,7 +100,7 @@ install-local: all-local
        $(MKINSTALLDIRS) $(DESTDIR)$(localedir)
        @$(foreach lang,$(basename $(if $(strip $(PO)),$(PO),$(CATALOGS))), \
                $(MKINSTALLDIRS) $(DESTDIR)$(localedir)/$(lang)/LC_MESSAGES; \
-               $(call 
ncmd,installdata,$(lang).gmo,$(DESTDIR)$(localedir)/$(lang)/LC_MESSAGES/$(PACKAGE).mo);
 \
+               $(call 
ncmd,installdata,$(srcdir)/$(lang).gmo,$(DESTDIR)$(localedir)/$(lang)/LC_MESSAGES/$(PACKAGE).mo);
 \
        )
 
 # Steal the `dist' target so that .po and .gmo files will be properly updated

Attachment: pgpeMkB3JPQ1N.pgp
Description: PGP signature

_______________________________________________
elinks-dev mailing list
[email protected]
http://linuxfromscratch.org/mailman/listinfo/elinks-dev

Reply via email to