Bug in make?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Bug in make?

Alexander Khomyak
Hello,

Why "Grouped targets recipe"in the following Makefile

targets = target1 target2

all : $(targets)

$(targets) &:
    @echo "Grouped targets recipe"
    @echo $@ > target1
    @echo $@ > target2

clean :
    rm -rf $(targets)

runs one time using command 'make' and two times using command 'make -j2'?

Regards,
AkexK
Reply | Threaded
Open this post in threaded view
|

Re: Bug in make?

Paul Smith-20
On Tue, 2020-02-18 at 23:00 +0300, Alexander Khomyak wrote:

> Why "Grouped targets recipe"in the following Makefile
>
> targets = target1 target2
>
> all : $(targets)
>
> $(targets) &:
>     @echo "Grouped targets recipe"
>     @echo $@ > target1
>     @echo $@ > target2
>
> clean :
>     rm -rf $(targets)
>
>
> runs one time using command 'make' and two times using command 'make
> -j2'?

What version of GNU make are you using?

Grouped targets are a new feature in GNU make 4.3 so if you don't have
that version, this won't work as you expect.