Jonny Grant (24 May 2017 09:40) > $ make -f missingfile.mak > make: missingfile.mak: No such file or directory > make: *** No rule to make target 'missingfile.mak'. Stop. > > Shouldn't Make exit after the missing file? > > Make appears to be carrying on, and then treating the makefile as a target.
That's by design. If one make-file tries to include another, that doesn't exist, make checks to see if it has a rule to make it from things that do exist; if that succeeds, it restarts itself and picks up the missing file on the next pass. That's sometimes used to boot-strap a build by identifying dependencies or gathering source-lists, most usually with rules that are present in the make-files that do exist. Here, you're just seeing make apply the same approach to the top-level make-file: after all, make has lots of built-in rules, one of which might be able to make the file you asked for from something that exists - e.g., it could have ('though I don't think it does) a built-in rule like %: %.m4 m4 < $< > $@ and a missingfile.mak.m4 would let it succeed. Or it could exercise one of its built-in rules for version-control systems (RCS and SCCS) to check out the missing file. There's no reason for make to treat the top-level make-file you specify with -f any differently than the subject of an include directive, so it does its best to do what you asked for. I trust it still fails, so the only difference from what you expected is a little more output to stderr, Eddy. _______________________________________________ Bug-make mailing list Bug-make@gnu.org https://lists.gnu.org/mailman/listinfo/bug-make