|
|
9ae3a8 |
From ef6f26bb4a43131a7a3de4109aa9aeb145ad139a Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Fam Zheng <famz@redhat.com>
|
|
|
9ae3a8 |
Date: Wed, 16 Jul 2014 02:20:27 -0500
|
|
|
9ae3a8 |
Subject: [CHANGE 27/29] rules.mak: allow per object cflags and libs
|
|
|
9ae3a8 |
To: rhvirt-patches@redhat.com,
|
|
|
9ae3a8 |
jen@redhat.com
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Fam Zheng <famz@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1405477228-11490-4-git-send-email-famz@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 59917
|
|
|
9ae3a8 |
O-Subject: [RHEL-7 qemu-kvm PATCH 3/4] rules.mak: allow per object cflags and libs
|
|
|
9ae3a8 |
Bugzilla: 1017685
|
|
|
9ae3a8 |
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Adds extract-libs in LINK to expand any "per object libs", the syntax to define
|
|
|
9ae3a8 |
such a libs options is like:
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
foo.o-libs := $(CURL_LIBS)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
in block/Makefile.objs.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Similarly,
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
foo.o-cflags := $(FOO_CFLAGS)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
is also supported.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
"foo.o" must be listed in a nested var (e.g. common-obj-y) to make the
|
|
|
9ae3a8 |
option variables effective.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Fam Zheng <famz@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
(cherry picked from commit 5c0d52bcd3aada33e274ea7dad75955f98bc2636)
|
|
|
9ae3a8 |
Signed-off-by: Fam Zheng <famz@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
rules.mak | 19 ++++++++++++++++---
|
|
|
9ae3a8 |
1 file changed, 16 insertions(+), 3 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: jen <jen@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
rules.mak | 19 ++++++++++++++++---
|
|
|
9ae3a8 |
1 file changed, 16 insertions(+), 3 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/rules.mak b/rules.mak
|
|
|
9ae3a8 |
index 0c5125d..355c275 100644
|
|
|
9ae3a8 |
--- a/rules.mak
|
|
|
9ae3a8 |
+++ b/rules.mak
|
|
|
9ae3a8 |
@@ -17,15 +17,17 @@ QEMU_DGFLAGS += -MMD -MP -MT $@ -MF $(*D)/$(*F).d
|
|
|
9ae3a8 |
# Same as -I$(SRC_PATH) -I., but for the nested source/object directories
|
|
|
9ae3a8 |
QEMU_INCLUDES += -I$(
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+extract-libs = $(strip $(foreach o,$1,$($o-libs)))
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
%.o: %.c
|
|
|
9ae3a8 |
- $(call quiet-command,$(CC) $(QEMU_INCLUDES) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<," CC $(TARGET_DIR)$@")
|
|
|
9ae3a8 |
+ $(call quiet-command,$(CC) $(QEMU_INCLUDES) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) $($@-cflags) -c -o $@ $<," CC $(TARGET_DIR)$@")
|
|
|
9ae3a8 |
%.o: %.rc
|
|
|
9ae3a8 |
$(call quiet-command,$(WINDRES) -I. -o $@ $<," RC $(TARGET_DIR)$@")
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
ifeq ($(LIBTOOL),)
|
|
|
9ae3a8 |
LINK = $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ \
|
|
|
9ae3a8 |
$(sort $(filter %.o, $1)) $(filter-out %.o, $1) $(version-obj-y) \
|
|
|
9ae3a8 |
- $(LIBS)," LINK $(TARGET_DIR)$@")
|
|
|
9ae3a8 |
+ $(call extract-libs,$^) $(LIBS)," LINK $(TARGET_DIR)$@")
|
|
|
9ae3a8 |
else
|
|
|
9ae3a8 |
LIBTOOL += $(if $(V),,--quiet)
|
|
|
9ae3a8 |
%.lo: %.c
|
|
|
9ae3a8 |
@@ -41,7 +43,7 @@ LINK = $(call quiet-command,\
|
|
|
9ae3a8 |
$(sort $(filter %.o, $1)) $(filter-out %.o, $1) \
|
|
|
9ae3a8 |
$(if $(filter %.lo %.la,$^),$(version-lobj-y),$(version-obj-y)) \
|
|
|
9ae3a8 |
$(if $(filter %.lo %.la,$^),$(LIBTOOLFLAGS)) \
|
|
|
9ae3a8 |
- $(LIBS),$(if $(filter %.lo %.la,$^),"lt LINK ", " LINK ")"$(TARGET_DIR)$@")
|
|
|
9ae3a8 |
+ $(call extract-libs,$^) $(LIBS),$(if $(filter %.lo %.la,$^),"lt LINK ", " LINK ")"$(TARGET_DIR)$@")
|
|
|
9ae3a8 |
endif
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
%.asm: %.S
|
|
|
9ae3a8 |
@@ -114,11 +116,22 @@ $(eval $1 = $(value save-$2-$1) $$(subdir-$2-$1))
|
|
|
9ae3a8 |
$(eval save-$2-$1 :=)
|
|
|
9ae3a8 |
endef
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+define fix-obj-vars
|
|
|
9ae3a8 |
+$(foreach v,$($1), \
|
|
|
9ae3a8 |
+ $(if $($v-cflags), \
|
|
|
9ae3a8 |
+ $(eval $2$v-cflags := $($v-cflags)) \
|
|
|
9ae3a8 |
+ $(eval $v-cflags := )) \
|
|
|
9ae3a8 |
+ $(if $($v-libs), \
|
|
|
9ae3a8 |
+ $(eval $2$v-libs := $($v-libs)) \
|
|
|
9ae3a8 |
+ $(eval $v-libs := )))
|
|
|
9ae3a8 |
+endef
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
define unnest-dir
|
|
|
9ae3a8 |
$(foreach var,$(nested-vars),$(call push-var,$(var),$1/))
|
|
|
9ae3a8 |
$(eval obj-parent-$1 := $(obj))
|
|
|
9ae3a8 |
$(eval obj := $(if $(obj),$(obj)/$1,$1))
|
|
|
9ae3a8 |
$(eval include $(SRC_PATH)/$1/Makefile.objs)
|
|
|
9ae3a8 |
+$(foreach v,$(nested-vars),$(call fix-obj-vars,$v,$(if $(obj),$(obj)/)))
|
|
|
9ae3a8 |
$(eval obj := $(obj-parent-$1))
|
|
|
9ae3a8 |
$(eval obj-parent-$1 := )
|
|
|
9ae3a8 |
$(foreach var,$(nested-vars),$(call pop-var,$(var),$1/))
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.9.3
|
|
|
9ae3a8 |
|