help-make
[Top][All Lists]
Advanced

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

Re: not sure about value of "$(lastword $(MAKEFILE_LIST))" in this examp


From: Kaz Kylheku (gmake)
Subject: Re: not sure about value of "$(lastword $(MAKEFILE_LIST))" in this example
Date: Tue, 15 Oct 2019 09:55:18 -0700
User-agent: Roundcube Webmail/0.9.2

On 2019-10-15 08:59, Robert P. J. Day wrote:
i'm not sure what to make of this since there is only one Makefile in
play in this directory, and the docker container has its working
directory set to this directory, and all of the targets being invoked
are defined in the same Makefile.

It allows the containing file to re-invoke itself regardless of its
name. Even if it is the only makefile in the directory, this would
be required if its name isn't "dir.mk".  It's also required if it does
happen to be invoked from somewhere else.

Basically this is using copy-and-paste boilerplate for "calculate
my own name" to try to be strictly correct.

  so, while adding "-f $(THIS_FILE)" to those make commands doesn't
hurt, i can't see what value that adds.

The value is that it's "future-proof".  Suppose things change so that
the build system doesn't chdir into that directory to run that
makefile. If that file tries to re-invoke itself as just $(MAKE), it
will likely succeed by running the the wrong Makefile. Someone will
have a lot of fun debugging that.




reply via email to

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