Hello Craig,
On 2019-03-13, Craig Sanders <address@hidden> wrote:
Is it possible to set the permission bits used by the default install
target in a Makefile.am?
To help try and illustrate what I mean, I present a code snippet from one
of my Makefie.am files.
Begin code snippet >>>>>>>>>>
gimpdir = ${prefix}
gimp_SCRIPTS = scaleAndSetSize.py \
ScaleAndSetSizeClass.py
.PHONY: install
install:
mkdir -p ${prefix}
${INSTALL} -m 544 scaleAndSetSize.py ${prefix}
${INSTALL} -m 444 ScaleAndSetSizeClass.py ${prefix}
<<<<<<<<<< End code snippet <<<<<<<<<<
My problem with this code snippet is - I don't like the fact that I have
overridden the default install target to get the files installed with the
permission bits set the way I want. Rather, I'd like to have the default
install target do the install work for me, using permission bits that I
would like to specify. Does anybody know if this is possible?
Automake uses INSTALL_SCRIPT to install scripts, which is normally provided
by AC_PROG_INSTALL from Autoconf (and is set to INSTALL). You can set
this explicitly in Makefile.am to something different (or change the
value in configure).
However, that's probably a pain because you want different permissions
for different files.
One option would be to use both xxx_DATA and xxx_SCRIPTS, which are
installed by INSTALL_DATA and INSTALL_SCRIPT, respectively (this is the
only practical difference between xxx_DATA and xxx_SCRIPTS). You can
then adjust those variables separately as desired.
Alternately you can use install-local[1] instead, to get more flexibility
but without replacing the standard "install" target. Try to respect
DESTDIR as well, and prefer $(MKDIR_P) over open-coding mkdir -p.
For example (totally untested):
544_scripts = scaleAndSetSize.py
444_scripts = ScaleAndSetSizeClass.py
install-local: install-my-scripts
install-my-scripts:
$(MKDIR_P) "$(DESTDIR)$(gimpdir)"
$(INSTALL) -m 544 $(544_scripts) "$(DESTDIR)$(gimpdir)"
$(INSTALL) -m 444 $(444_scripts) "$(DESTDIR)$(gimpdir)"
.PHONY: install-my-scripts