%% Manoj Srivastava <[EMAIL PROTECTED]> writes: ms> In some cases, GNU make ignores some double-colon rules when dry-run.
ms> Assumed this Makefile is given ms> install.man:: foo.1 ms> @echo install foo.1 ms> install.man:: foo.2 ms> @echo install foo.2 ms> install.man:: ms> @echo install done ms> I've got the following results ms> % make -n install.man ms> echo install foo.1 ms> echo install done ms> I expect "echo install foo.2", but make dry-run shows not to ms> run "install foo.2". ms> However, if I run make actually ms> % make install.man ms> install foo.1 ms> install foo.2 ms> install done ms> "install foo.2" is executed. Is this an intentional behavior or a ms> bug of GNU make? It is intentional behavior. When GNU make runs with -n it must assume that your command script does what you say it will do: since it doesn't run the script itself it can't know what the script _really_ does. For a rule like this: install.man:: foo.1 <some script> GNU make _must_ assume that <some script> updates the target "install.man"... how can it know that it really doesn't? So, when you run with -n it assumes that the target is now updated, which automatically makes it newer than "foo.2", so the rule depending on "foo.2" does not get run. The last install.man rule is run because there is a special condition for double-colon rules, that if they have no prerequisites the command is run even if the target exists (see the section "Double-Colon Rules" in the GNU make manual). However, double-colon rules that _DO_ have prerequisites are only invoked if the prerequisites are newer than the target, just as with normal rules. You can see the behavior "make -n" is emulating without using -n if you have your scripts actually create the target your makefile says it will: install.man:: foo.1 @echo install foo.1 touch $@ install.man:: foo.2 @echo install foo.2 touch $@ install.man:: @echo install done touch $@ $ make -n install foo.1 install done $ make install foo.1 install done ms> Note that pmake run as I expected ms> % pmake -n install.man ms> echo install foo.1 ms> echo install foo.2 ms> echo install done Most likely pmake behaves differently; it may always run all double-colon scripts, even if there's a satisfied prerequisite relationship. Try the above makefile with the touch lines in it: does it run all three rules even though the touch lines exist? -- ------------------------------------------------------------------------------- Paul D. Smith <[EMAIL PROTECTED]> Find some GNU make tips at: http://www.gnu.org http://make.paulandlesley.org "Please remain calm...I may be mad, but I am a professional." --Mad Scientist _______________________________________________ Bug-make mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-make