automake
[Top][All Lists]
Advanced

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

Re: how to install data directories


From: Ralf Wildenhues
Subject: Re: how to install data directories
Date: Sun, 31 Aug 2008 05:16:12 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

Hello Matej, Remco,

First off, please do not top-post, and do not full-quote the messages
you reply to, unless you address each of the quoted bits.  Otherwise,
you will have a hard time getting useful comments on this list.  Thanks.

* Matej Tyc wrote on Sat, Aug 30, 2008 at 03:04:58PM CEST:
> On Fri, 2008-08-29 at 18:17 +0200, Remco Bras wrote:
> > you could do something like this in Makefile.am:
> > 
> > dirs = some_data_dir some_other_data_dir
> > install-data-local:
> >     for d in $(dirs); hing. \
> >       do\
> >             cp -Rv $d $(datadir)\
> >       done
> > 
> > Would this solution be acceptable?

Not really.  First off, there is an extra 'hing.' coming from somewhere,
that will cause a syntax error.  Likewise the missing semicolon after
the cp command.  Second, it is not portable to pass the option -v to cp.
Then, the rule is not $(DESTDIR) proof.  Next, the rule does not ensure
that $(DESTDIR)$(datadir) exists before files are copied to it.  The
rule fails to fail when, say, the first cp invocation fails.  The rule
will fail if $(DESTDIR)$(datadir) contains white space.

As a matter of following GNU Coding Standards, the rule should be using
the `install' program, preferably as $(INSTALL_DATA), rather than plain
cp.  Also, it should be prepended with a command line containing
        @$(NORMAL_INSTALL)

but that's one of the finer points of the GCS.

As Matej already remarked, the rule also lacks an accompanying uninstall
rule.

For what it's worth, the Automake way of doing this would be to list
every file in the Makefile.am (or maybe in an included, generated
Makefile.am snippet).  That way you ensure to not install any CVS files
or directories, backup files, other unwanted stuff.  (There is more
reasoning about this in the manual.)

> 1. What about `make uninstall`? Will the files be removed if they were
> installed in that way?

Exactly.  A 'make distcheck' would have told you this quite early.

> 2. This requires the user to write shell scripts in Makefile.am, which
> is, if I understand this correctly, a file mainly for declaration of
> intentions that should be as readable as possible. I think that it is
> highly inapropriate to write a low-level script to achieve a really
> trivial and common task.

This is a common misconception.  The contents of Makefile.am get copied,
almost verbatim, into the Makefile generated from it.  That means, for
everything where there exists no Automake-provided way of doing things,
you typically write rules for yourself, just as you would in a plain
Makefile.

> And a second one: What about a wiki? I relly miss that! Manuals are
> good, but solutions of problems like this one should be summarized in
> some centralized place so others could learn from it and maintain it as
> autotools evolve...

You keep going back to this point.  If anything, this thread has been an
argument against a wiki.  Come back with a couple of solutions that work
and are portable and usable for more than one issue, then we'll gladly
put them in the FAQ section in the manual.  Show that you can create
good solutions yourself without review, and you'll have a case for a
wiki.  Note that I don't count myself in that latter category.

Hope that helps.

Cheers,
Ralf




reply via email to

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