bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GNU Make 4.1 carrying on after -f missingfile.mak


From: Edward Welbourne
Subject: Re: GNU Make 4.1 carrying on after -f missingfile.mak
Date: Wed, 24 May 2017 08:11:56 +0000

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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]