diff mbox series

[1/1] Makefile: set HOST*_NOCCACHE variables only if unset

Message ID 20210928195533.1736944-2-mmayer@broadcom.com
State Accepted
Headers show
Series Build issue related to "command -v" | expand

Commit Message

yegorslists--- via buildroot Sept. 28, 2021, 7:55 p.m. UTC
Set HOSTCC_NOCCACHE and HOSTCXX_NOCCACHE only if they are not set. This
allows recursive calls to "make" to work as intended in the presence of
ccache.

Without guarding these variables, a recursive invocation of make would
re-define
    HOSTCC_NOCCACHE := $(HOSTCC)
and
    HOSTCXX_NOCCACHE := $(HOSTCXX)
at a point in time when HOSTCC and HOSTCXX already point to ccache.

Signed-off-by: Markus Mayer <mmayer@broadcom.com>
---
 Makefile | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Petr Vorel Sept. 29, 2021, 7:27 p.m. UTC | #1
Reviewed-by: Petr Vorel <petr.vorel@gmail.com>

Kind regards,
Petr
Thomas Petazzoni Dec. 28, 2021, 9:18 p.m. UTC | #2
On Tue, 28 Sep 2021 12:55:33 -0700
Markus Mayer via buildroot <buildroot@buildroot.org> wrote:

> Set HOSTCC_NOCCACHE and HOSTCXX_NOCCACHE only if they are not set. This
> allows recursive calls to "make" to work as intended in the presence of
> ccache.
> 
> Without guarding these variables, a recursive invocation of make would
> re-define

What is the use-case for a recursive invocation of make, reparsing the
Buildroot Makefile?

Thomas
Nicolas Cavallari Dec. 28, 2021, 9:26 p.m. UTC | #3
On 28/12/2021 22:18, Thomas Petazzoni wrote:
> On Tue, 28 Sep 2021 12:55:33 -0700
> Markus Mayer via buildroot <buildroot@buildroot.org> wrote:
> 
>> Set HOSTCC_NOCCACHE and HOSTCXX_NOCCACHE only if they are not set. This
>> allows recursive calls to "make" to work as intended in the presence of
>> ccache.
>>
>> Without guarding these variables, a recursive invocation of make would
>> re-define
> 
> What is the use-case for a recursive invocation of make, reparsing the
> Buildroot Makefile?

The cover text mentions it: calling make legal-info inside a post-build 
script (or package, actually) to somehow include the result in the image.
Thomas Petazzoni Dec. 29, 2021, 9 a.m. UTC | #4
On Tue, 28 Dec 2021 22:26:35 +0100
Nicolas Cavallari <nicolas.cavallari@green-communications.fr> wrote:

> The cover text mentions it: calling make legal-info inside a post-build 
> script (or package, actually) to somehow include the result in the image.

Many thanks for pointing it out, because the cover letter obviously
contains all the details.

I am looking at patches through patchwork, so I tend to only see the
patches themselves and not necessarily an associated cover letter.
Especially for single patches, where a cover letter is rarely present,
and therefore I rarely tend to search for such a cover letter in the
mailing list.

Best regards,

Thomas
Thomas Petazzoni Dec. 29, 2021, 9:12 a.m. UTC | #5
Hello Markus,

On Tue, 28 Sep 2021 12:55:33 -0700
Markus Mayer via buildroot <buildroot@buildroot.org> wrote:

> Set HOSTCC_NOCCACHE and HOSTCXX_NOCCACHE only if they are not set. This
> allows recursive calls to "make" to work as intended in the presence of
> ccache.
> 
> Without guarding these variables, a recursive invocation of make would
> re-define
>     HOSTCC_NOCCACHE := $(HOSTCC)
> and
>     HOSTCXX_NOCCACHE := $(HOSTCXX)
> at a point in time when HOSTCC and HOSTCXX already point to ccache.
> 
> Signed-off-by: Markus Mayer <mmayer@broadcom.com>
> ---
>  Makefile | 4 ++++
>  1 file changed, 4 insertions(+)

I have extended the commit log somewhat to give more details, and
applied!

Thanks a lot,

Thomas
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index d248bd76b2..71c0577030 100644
--- a/Makefile
+++ b/Makefile
@@ -286,12 +286,16 @@  ifndef HOSTCC
 HOSTCC := gcc
 HOSTCC := $(shell command -v $(HOSTCC) || type -p $(HOSTCC) || echo gcc)
 endif
+ifndef HOSTCC_NOCCACHE
 HOSTCC_NOCCACHE := $(HOSTCC)
+endif
 ifndef HOSTCXX
 HOSTCXX := g++
 HOSTCXX := $(shell command -v $(HOSTCXX) || type -p $(HOSTCXX) || echo g++)
 endif
+ifndef HOSTCXX_NOCCACHE
 HOSTCXX_NOCCACHE := $(HOSTCXX)
+endif
 ifndef HOSTCPP
 HOSTCPP := cpp
 endif