Il 23/05/2014 15:33, Fam Zheng ha scritto:
On Fri, 05/23 15:22, Paolo Bonzini wrote:
Just one question:
+# fix-paths
+# Usage: $(call fix-paths, obj_path, src_path, vars)
+# Add prefix @obj_path to all objects in @vars, and add prefix @src_path to all
+# directories in @vars.
+define fix-paths
+ $(foreach v,$3,
+ $(foreach o,$($v),
+ $(if $($o-libs),
+ $(eval $1$o-libs := $(value $o-libs)))
+ $(if $($o-cflags),
+ $(eval $1$o-cflags := $(value $o-cflags)))
+ $(if $($o-objs),
+ $(eval $1$o-objs := $(addprefix $1,$(value $o-objs)))))
+ $(eval $v := $(addprefix $1,$(filter-out %/,$(value $v))) \
+ $(addprefix $2,$(filter %/,$(value $v)))))
Why $(value $v) here in? I think you need to expand the variable,
especially in the last assignment but possibly also in the others. For
example if you have
OBJECTS = foo1.o foo2.o
foo.mo-objs = $(OBJECTS)
the addprefix would set
foo.mo-objs = dir/$(OBJECTS)
which is wrong.
Good catch! I'll fix this.
Thanks for reviewing!
Since you'll send v2, please indent with 4 spaces too!
Paolo