Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Korsgaard <jacmet@uclibc.org>
To: buildroot@busybox.net
Subject: [Buildroot] *Tons* of BR warnings like "package/Makefile.autotools.in:179: warning: overriding commands for target `/home/bjornfor/raid/forks/buildroot/output'"
Date: Sun, 13 Dec 2009 22:28:56 +0100	[thread overview]
Message-ID: <87pr6isgvb.fsf@macbook.be.48ers.dk> (raw)
In-Reply-To: <5f2b60912131251r647113bfj454cbf17c7bca57e@mail.gmail.com> ("Bjørn Forsman"'s message of "Sun, 13 Dec 2009 21:51:35 +0100")

>>>>> "Bj?rn" == Bj?rn Forsman <bjorn.forsman@gmail.com> writes:

Hi,

 Bj?rn> I finally found the bug. (Thanks a lot for the hint, Peter.)
 Bj?rn> BASE_DIR ends up containing the Buildroot output directory *two*
 Bj?rn> times (separated by a space). And it happends because I use the
 Bj?rn> CDPATH environment variable.

 Bj?rn> Let me demonstrate:

 Bj?rn> $ mkdir dir
 Bj?rn> $ (CDPATH= cd dir/)      # no output
 Bj?rn> $ (CDPATH=.:.. cd dir/)  # output!
 Bj?rn> /tmp/directory/dir

Ahh - I use zsh dir hashes for that kind of stuff instead.

 Bj?rn> This means that when the top Makefile in BR says:

 Bj?rn>   BASE_DIR := $(shell mkdir -p $(O) && cd $(O) && pwd)

 Bj?rn> both 'cd' and 'pwd' will print out the same path (when CDPATH is
 Bj?rn> non-empty), BASE_DIR will be containing two identical paths. Make freaks
 Bj?rn> out and BR fails.

 Bj?rn> So to fix this issue I thought it would be easy to remove CDPATH from
 Bj?rn> the Buildroot environment. But how? I tried:

 Bj?rn> export CDPATH:=
 Bj?rn> unexport CDPATH

 Bj?rn> in the top Makefile but neither worked.

It does work, but only for stuff running inside the make rules:

cat Makefile
export CDPATH:=
all:
        set|grep CDPATH

export CDPATH=.:~
make
set|grep CDPATH
BASH_EXECUTION_STRING='set|grep CDPATH'
CDPATH=

sed -i 's/export/#export/' Makefile
make
set|grep CDPATH
BASH_EXECUTION_STRING='set|grep CDPATH'
CDPATH=.:/home/peko

But if you instead have something using $(shell ) it won't work:

cat Makefile
export CDPATH:=
DUMMY:=$(shell set|grep CDPATH >&2)
all:
        set|grep CDPATH

make
BASH_EXECUTION_STRING='set|grep CDPATH >&2'
CDPATH=.:/home/peko
set|grep CDPATH
BASH_EXECUTION_STRING='set|grep CDPATH'
CDPATH=

E.G. the export doesn't effect the environment of $(shell ).

So the proper fix is to do:

unset CDPATH:=
and explicitly work around if for BASE_DIR, E.G.:

BASE_DIR := $(shell mkdir -p $(O) && cd $(O) >/dev/null && pwd)

I'll fix that in git.

 Bj?rn> It is also possible to use absolute paths when defining BASE_DIR. But I
 Bj?rn> don't know how to do that when the output variable O can be relative or
 Bj?rn> absolute:

 Bj?rn>   $ make O=/tmp/output
 Bj?rn>   $ make O=output

Well, that's the point of the 'cd $(O) >/dev/null && pwd' part (convert
to absolute path).

-- 
Bye, Peter Korsgaard

  reply	other threads:[~2009-12-13 21:28 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-10 20:34 [Buildroot] *Tons* of BR warnings like "package/Makefile.autotools.in:179: warning: overriding commands for target `/home/bjornfor/raid/forks/buildroot/output'" Bjørn Forsman
2009-12-11 10:09 ` Kieran Bingham
2009-12-11 10:36   ` Bjørn Forsman
2009-12-11 11:16     ` Peter Korsgaard
2009-12-11 13:14       ` Bjørn Forsman
2009-12-11 13:59         ` Peter Korsgaard
2009-12-11 14:53           ` Bjørn Forsman
2009-12-11 15:23             ` Peter Korsgaard
2009-12-13 20:51               ` Bjørn Forsman
2009-12-13 21:28                 ` Peter Korsgaard [this message]
2009-12-14  9:25                   ` Bjørn Forsman
2009-12-11 11:18     ` Thomas Petazzoni
2009-12-11 13:23       ` Bjørn Forsman
2009-12-11 13:35         ` Marc Egli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pr6isgvb.fsf@macbook.be.48ers.dk \
    --to=jacmet@uclibc.org \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox