Possible Duplicate:
GNU Makefile rule generating a few targets from a single source file
If I have a Makefile rule like this:
a b c:
echo "Creating a b c"
touch a b c
output: a b c
cat a b c > output
and I run make -j9 output
make sees the 3 dependencies (a,b,c), looks for how to produce them: (the "a b c" rule above), but what happens next? Should it not realize that the "a b c" rule only needs to be run once to create all 3 targets?
This is what make actually does:
[pavel@orianna test]$ make -j9 output -n
echo "Creating a b c"
touch a b c
echo "Creating a b c"
touch a b c
echo "Creating a b c"
touch a b c
cat a b c > output
[pavel@orianna test]$
The same recipe is run 3 times, once for each dependency to rule "output"!
Does anyone know why it behaves this way?