can "vpath" be used to simplify some makefiles? please?

Bernhard Fischer rep.nop at aon.at
Sun May 14 13:12:40 UTC 2006


On Sun, May 14, 2006 at 03:05:08PM +0200, Bernhard Fischer wrote:
>On Thu, May 11, 2006 at 07:05:14AM -0400, Robert P. J. Day wrote:
>>
>>  at the moment, the included makefile libbb/Makefile.in is
>>unnecessarily ugly because of the constant qualification of source
>>file names with "$(srcdir)/".  is there a reason that this can't be
>>simplified with a trivial use of "vpath"?  i mean, really, that's the
>>whole rationale for vpath.
>>
>>  and it's not like vpath is not already being used elsewhere, as in
>>the top-level BB Makefile:
>>
>>	export srctree=$(top_srcdir)
>>	vpath %/Config.in $(srctree)
>>
>>  so, is there any major objection to this kind of change?
>
>I'm not too pleased by that idea.
>Even the above line is buggy for the situation where your source-dir is
>not clean (it contains e.g. a .config) and you want to use the very
>same source-dir as source for building out of tree. e.g:
># /src/bb contains a distclean copy, /obj/bb is empty
># Let's assume that you have ¹) applied, so we don't have to pass
># top_srcdir=/src/bb in.
>
>cd /src/busybox ; make allnoconfig

Of course I ment:
cd /src/bb ; make allnoconfig

>cd /obj/bb ; make -f /src/bb/Makefile defconfig && make
>
>For the second invocation (in /obj), you will pull in the .config from
>allnoconfig instead of the defconfig from CWD.
>
>Strictly speaking, the vpath you point at is broken in it's current form.

At least i *think* that the vpath is the culprit for the abovementioned
defect. I didn't try to track this one down, though, so it may very well
be something completely different that is causing the wrong behaviour of
pulling in the $(top_srcdir)/.config instead of the
$(top_builddir)/.config

I'm aware that this line instructs to look for "Config.in", no notion of
.config. As said, i didn't look closely.
>
>See?
>
>¹)
>
>Index: Makefile
>===================================================================
>--- Makefile    (revision 14650)
>+++ Makefile    (working copy)
>@@ -15,11 +15,18 @@ noconfig_targets := menuconfig config ol
>
> # the toplevel sourcedir
> ifndef top_srcdir
>-top_srcdir=$(CURDIR)
>+# make-3.79.1 didn't support MAKEFILE_LIST
>+# for building out-of-tree, users of make-3.79.1 still have to pass top_srcdir=
>+# to make: make -f /srcs/busybox/Makefile top_srcdir=/srcs/busybox
>+ifdef MAKEFILE_LIST
>+top_srcdir:=$(shell cd $(dir $(firstword $(MAKEFILE_LIST))) && pwd)
>+else
>+top_srcdir:=$(CURDIR)
>+endif
> endif
> # toplevel directory of the object-tree
> ifndef top_builddir
>-top_builddir=$(CURDIR)
>+top_builddir:=$(CURDIR)
> endif
>
> export srctree=$(top_srcdir)
>
>>
>>rday
>>
>>_______________________________________________
>>busybox mailing list
>>busybox at busybox.net
>>http://busybox.net/cgi-bin/mailman/listinfo/busybox
>>
>_______________________________________________
>busybox mailing list
>busybox at busybox.net
>http://busybox.net/cgi-bin/mailman/listinfo/busybox
>



More information about the busybox mailing list