bug-make
[Top][All Lists]
Advanced

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

RE: canonicalization/stripping of leading ./


From: Martin Dorey
Subject: RE: canonicalization/stripping of leading ./
Date: Wed, 28 Nov 2007 19:01:27 -0800

> Its nice that the two are considered the same -- when we are
determining 
> dependencies.  It is not so nice when this changes the command line.

Yeah, "are canonicalized to be identical" is only one way of
implementing "are considered the same".  I think you've made a good case
for implementing it a different way but there may be counter-arguments.

...

Ah, and he who would know of said counter-arguments, and would have to
implement the different way agrees with you, saying (in one of the bugs
you mentioned):

https://savannah.gnu.org/bugs/index.php?func=detailitem&item_id=10708

>> $@, etc. should probably always be the exact target name, without any
of 
>> the internal translations performed

Paul's the maintainer, so you've a good chance of getting this behavior
changed.  It might, however, be a while.

-----Original Message-----
From: address@hidden
[mailto:address@hidden On Behalf Of
address@hidden
Sent: Wednesday, November 28, 2007 14:42
To: address@hidden
Subject: RE: canonicalization/stripping of leading ./

On Wed, 28 Nov 2007, Martin Dorey wrote:

> http://www.gnu.org/software/make/manual/make.html#Makefile-Basics
> suggests you follow your final suggestion, as you (seem to) have a
> $(srcdir) variable.  It suggests ./ otherwise, although I've tripped
> over doing that and generally use $(CURDIR)/ myself.

Thanks for the link; I knew I'd read something like that before.


> It's helpful elsewhere that ./file and file are considered to be the
> same file.

Its nice that the two are considered the same -- when we are determining

dependencies.  It is not so nice when this changes the command line.

It still seems reasonable to expect that

cat <<_EOF > Makefile
test.out: $(srcdir)/script.sh
        $< > $@
_EOF

should work in all cases -- not just when '.' is in $PATH or $(srcdir)
is 
other than '.'.  Though I guess

cat <<_EOF > Makefile
test.out: script.sh
        $(srcdir)/$< > $@
_EOF

isn't too bad, now that I know to use it.

If it is decided that canonicalization of automatic variables is The
Right 
Thing(TM), then their section in the manual should probably be updated
to 
make that clear.  Having read that section a few times, I never guessed 
they were being filtered.
http://www.gnu.org/software/make/manual/html_node/Automatic-Variables.ht
ml

It would also be good to close the relevant bug reports as "invalid" or 
"won't fix" and leave a note as to the correct makefile syntax (e.g. use

$(srcdir) in the rules; not in the prerequisites).

Later,
Daniel


> -----Original Message-----
> From: address@hidden
> [mailto:address@hidden On Behalf Of
> address@hidden
> Sent: Wednesday, November 28, 2007 12:53
> To: address@hidden
> Subject: canonicalization/stripping of leading ./
>
> Here's an example makefile:
>
> cat <<_EOF > Makefile
> test.out: ./script.sh
>        $< > $@
> _EOF
>
> Now when I run make, it executes
> `script.sh > test.out`
> instead of
> `./script.sh > test.out`
>
> This is all fine when 'PATH=.:<stuff>', and sometimes acceptable when
> 'PATH=<stuff>:.'; but in the general case, its very bad.
>
> I'm working around this by changing my makefiles to
>
> cat <<_EOF > Makefile
> test.out: ./script.sh
>        ./$< > $@
> _EOF
>
> but that doesn't seem too good either; maybe it should always be
>
> cat <<_EOF > Makefile
> test.out: $(srcdir)/script.sh
>        $(srcdir)/$< > $@
> _EOF
>
> ??
>
> Bug reports #15338 and #17230 cover this same issue, but I haven't
seen
> any followup, neither on Savannah nor on these lists.
>
> The closest discussion I could find was #10708, mentioned in
> http://lists.gnu.org/archive/html/help-make/2006-03/msg00231.html
>
> What's the official scoop?  Are there plans to fix/change this
behavior?
>
> In the meantime, how should I code the above Makefile (where an output
> file should be rebuilt whenever its script changes)?
>
> Thanks,
> Daniel


_______________________________________________
Bug-make mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/bug-make




reply via email to

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