Next: , Up: Other objects



8.1 Executable Scripts

It is possible to define and install programs that are scripts. Such programs are listed using the SCRIPTS primary name. Automake doesn't define any dependencies for scripts; the Makefile.am should include the appropriate rules. Automake does not assume that scripts are derived objects; such objects must be deleted by hand (see Clean).

The automake program itself is a Perl script that is generated from automake.in. Here is how this is handled:

     bin_SCRIPTS = automake
     CLEANFILES = $(bin_SCRIPTS)
     
     do_subst = sed -e 's,[@]datadir[@],$(datadir),g' \
                 -e 's,[@]PERL[@],$(PERL),g' \
                 -e 's,[@]PACKAGE[@],$(PACKAGE),g' \
                 -e 's,[@]VERSION[@],$(VERSION),g' \
                 ...
     
     automake: automake.in Makefile
             $(do_subst) < $(srcdir)/automake.in > automake
             chmod +x automake

Because—as we have just seen—scripts can be built, they are not distributed by default. Scripts that should be distributed can be specified using a dist_ prefix as in other primaries. For instance, the following Makefile.am declares that my_script should be distributed and installed in $(sbindir).

     dist_sbin_SCRIPTS = my_script

Script objects can be installed in bindir, sbindir, libexecdir, or pkgdatadir.

Scripts that need not being installed can be listed in noinst_SCRIPTS, and among them, those which are needed only by make check should go in check_SCRIPTS.