diff mbox

Makefile: Fix per-object variables for Makefile.target

Message ID 1398742157-29553-1-git-send-email-famz@redhat.com
State New
Headers show

Commit Message

Fam Zheng April 29, 2014, 3:29 a.m. UTC
The compiling is done in a subdir, so the extraction of per-object libs
and cflags are referencing objects with ../ prefixed. So prefix the
per-object variables "foo.o-cflags" and "foo.o-libs" to
"../foo.o-cflags" and "../foo.o-libs".

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 Makefile.target | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

Comments

Michael Tokarev April 29, 2014, 5:19 a.m. UTC | #1
29.04.2014 07:29, Fam Zheng wrote:
> The compiling is done in a subdir, so the extraction of per-object libs
> and cflags are referencing objects with ../ prefixed. So prefix the
> per-object variables "foo.o-cflags" and "foo.o-libs" to
> "../foo.o-cflags" and "../foo.o-libs".
> 
> Signed-off-by: Fam Zheng <famz@redhat.com>

Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>

This keeps target-specific object variables working, too.

But seriously, guys, this complexity/trickery is just insane.
We don't have that many objects in our tree, maybe, just maybe,
it will be better to return back to our old idea where all
objects are specified by their full path within source tree,
like block/foo.o, instead of stripping the subdir part within
a subdir and adding it back using this trickery?

To my opinion, the amount of work required to maintain the
trickery, and the fact that no one, even Fam, actually
understands how it works, way outperforms time/enegry
needed to support flat, trickery-less, full-path object
lists.

I will gladly give some time to re-write the build system
to make it subdir-ful trickery-less, and at the same time
keep it bisectable, if the agreement will be to do that.

Because, really, the current system is insane...

Thanks,

/mjt
diff mbox

Patch

diff --git a/Makefile.target b/Makefile.target
index ba12340..3a30aad 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -146,11 +146,12 @@  obj-y-save := $(obj-y)
 block-obj-y :=
 common-obj-y :=
 include $(SRC_PATH)/Makefile.objs
-dummy := $(call unnest-vars,.., \
-               block-obj-y \
-               block-obj-m \
-               common-obj-y \
-               common-obj-m)
+vars := block-obj-y \
+        block-obj-m \
+        common-obj-y \
+        common-obj-m
+dummy := $(foreach v,$(vars),$(call fix-obj-vars,$v,../))
+dummy := $(call unnest-vars,.., $(vars))
 
 # Now restore obj-y
 obj-y := $(obj-y-save)