Suppose I have a Makefile like this
B1.txt: A1.txt
python big_long_program.py A1.txt > $@
correct1.txt: B1.txt reference.txt
diff -q B1.txt reference.txt
touch $@
Then the output when I make correct1.txt is pretty well what I would expect:
python big_long_program.py A1.txt > B1.txt
diff -q B1.txt reference.txt
touch correct1.txt
Now if I have lots of files, B1.txt, B2.txt, B3.txt etc, so create an implicit rule:
B%.txt: A%.txt
python big_long_program.py A$*.txt > $@
correct%.txt: B%.txt reference.txt
diff -q B$*.txt reference.txt
touch $@
Instead this happens when I make correct1.txt:
python big_long_program.py A1.txt > B1.txt
diff -q B1.txt reference.txt
touch correct1.txt
rm B1.txt
i.e. there difference is that now the file B1.txt has been deleted, which in many cases is really bad.
So why are implicit rules different? Or am I doing something wrong?