[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: dealing with executable shell scripts
From: |
Andrew W. Nosenko |
Subject: |
Re: dealing with executable shell scripts |
Date: |
Tue, 20 Mar 2012 16:01:37 +0200 |
On Tue, Mar 20, 2012 at 15:47, Nick Bowler <address@hidden> wrote:
> On 2012-03-20 07:00 +0900, Miles Bader wrote:
>> Is there a recommended way for dealing with binaries that are simple
>> shell scripts in automake? I currently use something like the
>> following:
>>
>> bin_PROGRAMS = myprog
>>
>> myprog_SOURCES = myprog.sh
>> myprog: myprog.sh
>>
>> %: %.sh
>> $(shbin_verbose)cp $< $@; chmod +x $@
>
> Notwithstanding what others have already said, the above rule has some
> issues of its own:
>
> (1) If the "chmod" command fails: the failure will be noticed (make
> will stop), but the target file has already been created at this
> point. The target will thus be considered up-to-date on a
> subsequent make run, despite the fact that it was not created
> correctly.
>
> (2) If the "cp" command fails: the chmod is still attempted, which may
> succeed if the target file exists but is out-of-date. If chmod
> succeeds, the failure will not be noticed by make, and the build
> will continue using an out-of-date target.
>
> Moreover, the use of GNU make-specific pattern rules here is pointless
> because the same can be accomplished by a more portable single-suffix
> rule.
>
> Better to write it as follows:
>
> SUFFIXES = .sh
>
> .sh:
> $(shbin_verbose) cp $< address@hidden
> $(AM_V_at) chmod +x address@hidden
> $(AM_V_at) mv -f address@hidden $@
>
Why do not use install(1) instead of cp(1)+chmod(1) or cp(1)+chmod(1)+mv(1)?
--
Andrew W. Nosenko <address@hidden>
- Re: dealing with executable shell scripts, (continued)
- Re: dealing with executable shell scripts, Miles Bader, 2012/03/22
- Re: dealing with executable shell scripts, NightStrike, 2012/03/22
- Re: dealing with executable shell scripts, Miles Bader, 2012/03/22
- Re: dealing with executable shell scripts, Nick Bowler, 2012/03/22
- Re: dealing with executable shell scripts, NightStrike, 2012/03/21
Re: dealing with executable shell scripts, Nick Bowler, 2012/03/20
- Re: dealing with executable shell scripts,
Andrew W. Nosenko <=