automake
[Top][All Lists]
Advanced

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

Re: installing a whole directory


From: Ralf Wildenhues
Subject: Re: installing a whole directory
Date: Wed, 15 Apr 2009 08:15:05 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

Hello Laura, Lorenzo,

* Laura Hughes (lahughes) wrote on Tue, Apr 14, 2009 at 06:08:58PM CEST:
> 
> There may be a better way to do it so I'm looking forward to hearing how
> others did this, but I did this by creating an install hook like this:

If you are installing a list of files only, then I can only recommend to
you to let Automake do it.  It will be easier to use if you know the
rules, and more correct, too (and faster, too, once you switch to 1.10b
or newer).  For example, your rule does not use $(DESTDIR) correctly,
and "make distcheck" should be able to point out to you, as well as the
missing uninstall-local rule.

For data files to be installed, you can use something like

  foodir = <where everything is to be installed>
  foo_DATA = <list of files>

which will be sufficient to let the list of files be installed below
$(foodir).  You can replace "foo" with other names; if the "foo" name
contains "exec", then things will be installed by "install-exec".
See the chapter "info Automake Install" for more information.
(You can write dist_foo_DATA instead of foo_DATA if you want these files
distributed as well).

> install-data-hook:
>       (mkdir -p $(help_dir) ; \
>       cp -f *_help.txt $(help_dir))

For example, I'd write this as

## This rule requires Autoconf 2.62 or newer.
install-data-local:
        @$(NORMAL_INSTALL)
        $(MKDIR_P) $(DESTDIR)$(help_dir)
        $(INSTALL_DATA) *_help.txt $(DESTDIR)$(help_dir)

## Warning: the following rule assumes that this package is the
## sole owner of files below $(help_dir)!
uninstall-local:
        @$(NORMAL_UNINSTALL)
        rm -f $(DESTDIR)$(help_dir)/*_help.txt

(with Autoconf 2.62 or newer, you can be sure that $(INSTALL_DATA) is
able to handle multiple files at once; with earlier, you'd need to use
something like "cp -f", but then you still don't allow your users to
override permissions, or owner, or use "install-sh -C" or so here).

Hope that helps.

Cheers,
Ralf




reply via email to

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