Reputation: 360
I have this Makefile.am:
AUTOMAKE_OPTIONS = subdir-objects
sbin_PROGRAMS = foo
foo_SOURCES = foo.c
install-exec-hook:
chmod +s $(sbindir)/foo
everything works well except for the target distcheck which gives this error:
> make distcheck
...
...
...
Making install in sub-module
make[2]: Entering directory '/home/users/a/myproj/_build/sub-module'
make[3]: Entering directory '/home/users/a/myproj/_build/sub-module'
../../install-sh -c -d '/var/folders/pp/jbr_vq091s7gd8x9scrc7drw0000gn/T//am-dc-71151//home/users/a/myproj/_inst/sbin'
/bin/sh ../libtool --mode=install /usr/bin/install -c foo '/var/folders/pp/jbr_vq091s7gd8x9scrc7drw0000gn/T//am-dc-71151//home/users/a/myproj/_inst/sbin'
libtool: install: /usr/bin/install -c foo /var/folders/pp/jbr_vq091s7gd8x9scrc7drw0000gn/T//am-dc-71151//home/users/a/myproj/_inst/sbin/foo
make install-exec-hook
make[4]: Entering directory '/home/users/a/myproj/_build/sub-module'
chmod +s /home/users/a/myproj/_inst/sbin/foo
chmod: /home/users/a/myproj/_inst/sbin/foo: No such file or directory
Makefile:645: recipe for target 'install-exec-hook' failed
make[4]: *** [install-exec-hook] Error 1
it looks like the foo binary is copied to some temp directory (/var/folders/pp/jbr_vq091s7gd8x9scrc7drw0000gn/T//am-dc-71151//home/users/a/myproj/_inst/sbin) and not to where it is looked at in the install-exec-hook target (/home/users/a/myproj/_inst/sbin)
What am I missing??
Upvotes: 0
Views: 1317
Reputation: 22549
You didn't say how you configured or the exact command you used for make install
. This matters for two reasons:
Automake supports renaming files at install time via configure's --program-prefix
and related options;
Automake supports setting DESTDIR
at installation-time.
So maybe one of these is having an effect.
Fixing the renaming issue is a bit involved -- see the Autoconf documentation -- but dealing with DESTDIR
at least is simple:
install-exec-hook:
chmod +s $(DESTDIR)$(sbindir)/foo
Note the lack of a directory separator between the two variables. That is intentional.
If this doesn't help then you need to investigate earlier to find where that strange prefix is coming from. I don't believe there is anything in Automake that would add it.
Upvotes: 1