help-make
[Top][All Lists]
Advanced

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

make: *** No rule to make target 'dir/bar', needed by 'foobar'. Stop.


From: Brian J. Murrell
Subject: make: *** No rule to make target 'dir/bar', needed by 'foobar'. Stop.
Date: Thu, 28 Jan 2021 13:09:42 -0500
User-agent: Evolution 3.36.5 (3.36.5-2.fc32)

I wonder if somebody can explain to me why this Makefile:

foo:
        touch foo
        touch bar

%/:
        mkdir -p $@

dir/%: % | dir/
        rm -f $@
        ln $< $@

foobar: dir/foo dir/bar


doesn't work as one might think it should:

$ rm -rf dir foo bar; make foobar
touch foo
touch bar
mkdir -p dir/
rm -f dir/foo
ln foo dir/foo
make: *** No rule to make target 'dir/bar', needed by 'foobar'.  Stop.

Everything looks good for dir/bar to be created:

$ ls -l foo bar dir/
-rw-rw-r--. 1 brian brian    0 Jan 28 12:53 bar
-rw-rw-r--. 2 brian brian    0 Jan 28 12:53 foo

dir/:
total 0
-rw-rw-r--. 2 brian brian 0 Jan 28 12:53 foo

Subsequently trying to create dir/bar even works:

$ make dir/bar
rm -f dir/bar
ln bar dir/bar

Any ideas?  What am I missing?

Cheers,
b.

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

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