[Top][All Lists]

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

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

From: Jonny Grant
Subject: Re: GNU Make 4.1 carrying on after -f missingfile.mak
Date: Wed, 24 May 2017 20:15:57 +1200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1

On 24/05/17 20:11, Edward Welbourne wrote:
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


Hi Eddy

Thank you for your reply.

So if missingfile.mak was generated? Would make then read it in and process it?

I guess I thought it would just be better for make to halt and exit after that line
make: missingfile.mak: No such file or directory

Thank you anyway

reply via email to

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