Reputation: 2886
Most likely it is not but I've been struggling with this one for an hour now:
$ cat Makefile
${FILE1}:
touch $@
a: ${FILE1}
${FILE2}: a
touch $@
$ make FILE1=foo FILE2=bar bar
touch foo
touch bar
$ ls
bar foo Makefile
$ make FILE1=foo FILE2=bar bar
touch bar
Why is the bar
rule still activated?
If I change Makefile
to:
${FILE1}:
touch $@
${FILE2}: ${FILE1}
touch $@
Everything works, i.e. bar
is not touched again.
Upvotes: 1
Views: 36
Reputation: 99124
The target bar
has a prerequisite, a
. You have a rule for a
, but it does not actually build a file named "a". So every time you ask Make to rebuild bar
(if necessary), Make sees that the prerequisite a
does not exist, and therefore it must attempt to rebuild both targets.
Upvotes: 1