[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: libexecdir/datadir used incorrectly

From: Alexandre Duret-Lutz
Subject: Re: libexecdir/datadir used incorrectly
Date: Wed, 09 Feb 2005 23:40:47 +0100
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3.50 (gnu/linux)

>>> "Karl" == Karl Berry <address@hidden> writes:

 >> +pkgdatadir = @datadir@/awk
 >> I think it's better to use $(datadir) instead.  

I agree.

 Karl> But the coding standards say to use @datadir@ (when Autoconf is used).
 Karl> Not for pkgdatadir, of course, since that isn't in in the standards, but
 Karl> for all the other variables.

You should use address@hidden@' when defining `FOODIR'.  That's what the
standard does.  But here we are not defining FOODIR.

It's better to use `$(FOODIR)' everywhere else, so that when a
user run `make FOODIR=bar', all uses are redefined.  If you were
using @FOODIR@ in some other place than the FOODIR redefinition,
you would still be using this value after `make FOODIR=bar'.

If pkgdatadir was specified, it would be specified as
address@hidden@ when using autoconf, and $(datadir)/PKGNAME otherwise.
(See how docdir is defined.)

BTW, nowadays there is usually no reason to use *any* @XYZ@
substitution in a Makefile.am.  Those are better replaced by
$(XYZ).  In the past, such @usages@ were necessary because
Automake could not see all AC_SUBST calls performed by a
configure.ac (especially those done inside other Autoconf
macros, or using computed arguments).  Since Automake 1.7, all
AC_SUBSTs are traced accurately, and the Makefile.ins are
populated with `XYZ = @XYZ@' definitions for every substitution.
You can use $(XYZ) safely.

I think the only reason one would want to use @XYZ@ in a
Makefile.am is in a place where users should not be allowed to
modify the value.  ISTR Bruno mentioned such uses in Gettext.

FWIW, coreutils has the following snippet in Makefile.maint.

# Ensure that we use only the standard $(VAR) notation,
# not @...@ in Makefile.am, now that we can rely on automake
# to emit a definition for each substituted variable.
        grep -E '@[A-Z_0-9]+@' `find . -name Makefile.am` \
          && { echo 'Makefile.maint: use $(...), not @...@' 1>&2; exit 1; } || :
Alexandre Duret-Lutz

reply via email to

[Prev in Thread] Current Thread [Next in Thread]