Skip to contentSkip to conversation

buildsys: Convert SDL_CFLAGS to .mo-cflags

PATCH Applied Fam Zheng 2 participants 4 messages Oct 28, 2014 – Oct 29, 2014

lore
Share & tools
lore

Fam Zheng

author
#0 lore raw

cover buildsys: Convert SDL_CFLAGS to .mo-cflags

This is actually the first user of the *.mo rule syntax. It's the recommended way to specify per object flags, which also makes the sophisticated rules in rules.mak less likely to bit rot.

Fam

Fam Zheng (2):
rules.mak: Allow .mo-objs and .mo-cflags in -y variables
ui: Use the new ".mo-cflags" rule syntax for SDL_CFLAGS

 rules.mak        | 5 +++++
 ui/Makefile.objs | 5 +++--
 2 files changed, 8 insertions(+), 2 deletions(-)
Signature · 1 line
1.9.3
author
#1 lore raw

PATCH 1/2 rules.mak: Allow .mo-objs and .mo-cflags in -y variables

Expand %.mo-objs in -y nested objects, so that we can write combined object -cflags rules like what will be done in the coming patch.

---
 rules.mak | 5 +++++
 1 file changed, 5 insertions(+)
rules.mak +5 -0
index cf76b88..f500fef 100644
@@ -362,4 +362,9 @@ define unnest-vars
         # Include all the .d files
         $(eval -include $(addsuffix *.d, $(sort $(dir $($v)))))
         $(eval $v := $(filter-out %/,$($v))))
+
+    # For all %.mo objects that are directly added into -y, expand them to %.mo-objs
+    $(foreach v,$2,
+        $(eval $v := $(foreach o,$($v),$(if $($o-objs),$($o-objs),$o))))
+
 endef
Signature · 1 line
1.9.3
author
#2 lore raw

PATCH 2/2 ui: Use the new ".mo-cflags" rule syntax for SDL_CFLAGS

In reply to Fam Zheng
---
 ui/Makefile.objs | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
ui/Makefile.objs +3 -2
index 6afb52a..801cba2 100644
@@ -10,12 +10,13 @@ vnc-obj-y += vnc-jobs.o
 common-obj-y += keymaps.o console.o cursor.o qemu-pixman.o
 common-obj-y += input.o input-keymap.o input-legacy.o
 common-obj-$(CONFIG_SPICE) += spice-core.o spice-input.o spice-display.o
-common-obj-$(CONFIG_SDL) += sdl.o sdl_zoom.o x_keymap.o sdl2.o
+common-obj-$(CONFIG_SDL) += sdl.mo x_keymap.o
 common-obj-$(CONFIG_COCOA) += cocoa.o
 common-obj-$(CONFIG_CURSES) += curses.o
 common-obj-$(CONFIG_VNC) += $(vnc-obj-y)
 common-obj-$(CONFIG_GTK) += gtk.o x_keymap.o
 
-$(obj)/sdl.o $(obj)/sdl_zoom.o $(obj)/sdl2.o: QEMU_CFLAGS += $(SDL_CFLAGS)
+sdl.mo-objs := sdl.o sdl_zoom.o sdl2.o
+sdl.mo-cflags := $(SDL_CFLAGS)
 
 gtk.o-cflags := $(GTK_CFLAGS) $(VTE_CFLAGS)
Signature · 1 line
1.9.3
#3 lore raw
In reply to Fam Zheng
Quoted 3 lines · Fam Zheng

This is actually the first user of the *.mo rule syntax. It's the recommended way to specify per object flags, which also makes the sophisticated rules in rules.mak less likely to bit rot.

Applied, thanks.

Paolo

Quoted 12 lines

Fam

Fam Zheng (2):
rules.mak: Allow .mo-objs and .mo-cflags in -y variables
ui: Use the new ".mo-cflags" rule syntax for SDL_CFLAGS

 rules.mak        | 5 +++++
 ui/Makefile.objs | 5 +++--
 2 files changed, 8 insertions(+), 2 deletions(-)