[patch] Use $@ to simplify a rule, and try to nullify metacharacters.

Kalle Olavi Niemitalo <[email protected]>
Newsgroups gmane.comp.web.links
Message-ID <[email protected]>
Kalle Olavi Niemitalo <[email protected]> writes:

> OK; I'll post one patch to remove the SUFFIXES, another to fix
> po/Makefile for builddir!=srcdir while keeping po/*.gmo in builddir,
> a third one for other po/Makefile changes, and then we can keep
> discussing (arguing?) where po/*.gmo should be.

Here is the third one.  Unlike the others, this doesn't normally
affect the visible behaviour, so I won't be shocked if you choose
not to apply this.  (But please tell me if you do, so that I can
revert these changes from my repository and avoid future conflicts.)

Use $@ to simplify a rule, and try to nullify metacharacters.

I changed the %.gmo rule in po/Makefile 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
and other rules in po/Makefile 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 and
dashes should be doable.

I also quoted the ~ in --check-accelerators=~ in case some shell
might want to expand it as the home directory.  Bash 3.00.16(1)
doesn't because the word contains dashes.

---
commit dd5511649f0224bc03c3f1b17d7499885bed33e1
tree 8f164bfaaeb3f153884b4d413ab66524915551a9
parent 18a69857be001bbbcfb388d93a42e3344f30585d
author Kalle Olavi Niemitalo <[email protected]> Tue, 06 Dec 2005 19:12:49 +0200
committer Kalle Olavi Niemitalo <[email protected]> Tue, 06 Dec 2005 19:12:49 +0200

 po/Makefile |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/po/Makefile b/po/Makefile
index 57b2bdd..be41774 100644
--- a/po/Makefile
+++ b/po/Makefile
@@ -17,9 +17,8 @@ POTFILES_ABS_LIST = potfiles.list
 # However, if srcdir != builddir, then this Makefile ignores the *.gmo
 # files in the srcdir and builds new ones in the builddir.
 %.gmo: $(srcdir)/%.po
-	@file=`echo $* | sed 's,.*/,,'`.gmo \
-	  && rm -f $$file && echo -n $*": " \
-	  && $(GMSGFMT) --statistics -o $$file $<
+	@rm -f -- "$@" && printf "%s: " "$*" \
+	  && $(GMSGFMT) --statistics -o "$@" -- "$<"
 
 
 ### The default rule
@@ -88,7 +87,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 $(srcdir)/$(lang).po; \
+	  $(GMSGFMT) --check --check-accelerators="~" --verbose --statistics -o /dev/null $(srcdir)/$(lang).po; \
 	)
 
 ### Installation and distribution

_______________________________________________
elinks-dev mailing list
[email protected]
http://linuxfromscratch.org/mailman/listinfo/elinks-dev
signature.asc (application/pgp-signature, 188 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQBDlcgaHm9IGt60eMgRAv3AAKDDMl0ER8ZX3hJ1j1vTbg58EUJA8ACfZHn3
k12BKRCeymCLqCAMxxVa5ek=
=xN/t
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.