bug-make
[Top][All Lists]
Advanced

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

[Bug report] Make doesn't know $@ when referenced in the prerequisites


From: Alejandro García Vallejo
Subject: [Bug report] Make doesn't know $@ when referenced in the prerequisites
Date: Sun, 19 Mar 2017 01:51:51 +0000

Hi,

(NOTE: For details on versions used and whatnot see the end of the e-mail, should apply to all of them, AFAIK.)

I know that this is a corner case, but given a Makefile such as this one:

"""
Makefile
"""
bar: $(@:%r=foo%z)
        @echo End

foobaz:
        @echo The

"""
GNU Make Output:
End

NetBSD Make Output:
The
End

Make fails to read $@ (aka, it's empty). I suppose you set all the special variables $@, $^, $< and some other I might be forgeting about after checking the prerequisites, so that they can all be set in one go. That behaviour breaks this kind of construct. (Curiously enough it works in bmake. I didn't expect it to, as it uses pattern matching expansion)

Furthermore, it can be taken further away. See for example this other Makefile
.
"""
Makefile
"""
bar: $(@:%r=foo%z) $(<:%z=%r)
        @echo End

foobar:
        @echo Very

foobaz:
        @echo The


"""
GNU Make Output:
End

NetBSD Make Output:
The
End
"""

Here NetBSD Make screws it too, as they both ignore $< that could be set up by the time it's requested (will report it to them too, when I find the time).

For the sake of giving details, I'm using GNU Make 4.2.1 and bmake 20170201-1 as reported by an updated ArchLinux x86_64.

I have no idea how easy or hard this edges are to fix, but it would be very cool if they were.
If you need anything else, don't hesitate to contact me.

Cheers,
Alejandro

reply via email to

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