[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Installing and locating scripts
- From: William Ahern <william@...>
- Date: Mon, 4 Mar 2013 19:59:20 -0800
On Tue, Mar 05, 2013 at 12:00:01AM -0300, Hisham wrote:
<snip>
> Here's a document I wrote a while ago collecting recommendations for
> Makefiles based on feedback from project authors when submitting
> packages to LuaRocks. Most of it deals with handling C code, but I
> guess some parts may still apply:
>
> http://luarocks.org/en/Recommended_practices_for_Makefiles
>
> (Suggestions, criticism and requests for clarifications are welcome.)
Regarding
Some packagers recommend prepending an empty $(DESTDIR) variable to
all target paths in your install rule, but that's not strictly
necessary if your paths are all set into variables, which can be
redefined for the "make install" run, like in the example above.
I would remark that a properly written Makefile SHOULD NOT require two
separate invocations--one to build and another to install. If it's written
correctly, a simple `make [VARS] install' should suffice, with any build
prequisites handled properly. (It should also work with separate build and
install target invocations, of course.)
However, if it's embedding installation paths into build targets, then it
needs to be able to differentiate, e.g., $(DESTDIR)$(prefix) from $(prefix)
when building prerequisites triggered by an install target.
Thus, I would not recommend that authors exclude the use of DESTDIR. It may
seem verbose, but it's verbose for a good reason. And in any event, it's how
package maintainers expect it to work.
Regarding variable names, I see a lot of ad hoc stuff floating around. The
GNU coding style has documented a long list of path names at
http://www.gnu.org/prep/standards/standards.html#Directory-Variables
Personally, instead of $(INCDIR) I would recommend $(includedir) or
$(INCLUDEDIR) (and $(foo_includedir) or $(FOO_INCLUDEDIR)). I use the
lowercase because that's how it's documented, that's the variable name in
automake, and that's how you would otherwise pass it on a ./configure line.
But I realize people seem to prefer the upper case.
Why the GNU standard? Whatever your opinion of GNU or the FSF, it is a
long-standing style which everybody mimics, if poorly. It's the de facto
standard. Why not just use the names the way they're documented? Anything
else is just chaos.