help-make
[Top][All Lists]
Advanced

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

Re: make not setting SCCS-retrieved .sh files executable


From: Philip Guenther
Subject: Re: make not setting SCCS-retrieved .sh files executable
Date: Fri, 10 Mar 2006 20:40:28 -0700

On 3/10/06, Peter Welte <address@hidden> wrote:
> I created a shell script (foo.sh), checked it into sccs (sccs create foo.sh),
> but then if I do 'sccs clean' then make with the following makefile, make gets
> a copy of foo.sh, but doesn't set it executable:
>
> makefile is this:
>
> foo: foo.sh
>   foo.sh
...
> SCCS
>     Any file `n' is extracted if necessary from an SCCS file named either 
> `s.n'
> or `SCCS/s.n' ... For the benefit of SCCS, a file `n' is copied from `n.sh' 
> and
> made executable (by everyone). This is for shell scripts that are checked into
> SCCS.

I believe that's a reference to GNU make's built in pattern rule

%: %.sh
        cat $< >$@
        chmod a+x $@

That is, that text is trying to say "we added this otherwise silly
pattern rule because SCCS can't preserve the execute bit".  (The text
that immediately follows your quote can be summarized "Here's a
nickle; get a real source-control system!")

If that is indeed what the cited text was referring to, then your
"foo: foo.sh" rule has effectively overriden the pattern rule.  You
should replace it with something like

run-foo: foo
        # use ./foo instead of just 'foo' in case there's another foo
in the path
        # or PATH is lacking the current directory
        ./foo

...and then either make 'run-foo' a .PHONY rule or add "touch $@" to
its command, depending on whether it should be run every time it's a
target or only when foo has changed.


(The text you cited could be clearer by not implying that the %:%.sh
rule is only applied to SCCS files or that it's automatically applied
whenever the SCCS source file ends with .sh)


Philip Guenther




reply via email to

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