Skip to contentSkip to conversation

buildsys: Move ui/usb library cflags/libs to per object

PATCH In review Fam Zheng 4 participants 19 messages Sep 7, 2017 – Sep 8, 2017

lore
Share & tools
lore

Fam Zheng

author
#0 lore raw

cover buildsys: Move ui/usb library cflags/libs to per object

Hi Gerd,

This is part two of the QEMU_CFLAGS and libs_softmmu cleanup series, including ui/, audio/ and hw/usb/. Please review.

Fam Zheng (9):
buildsys: Move gtk/vte cflags/libs to per object
buildsys: Move sdl cflags/libs to per object
buildsys: Move vnc cflags/libs to per object
buildsys: Move audio libs to per object
buildsys: Move curese cflags/libs to per object
buildsys: Move opengl cflags to per object
buildsys: Move libcacard cflags/libs to per object
buildsys: Move libusb cflags/libs to per object
buildsys: Move usb redir cflags/libs to per object

 audio/Makefile.objs  |  6 ++++++
 configure            | 54 ++++++++++++++++++++++++++++++----------------------
 hw/usb/Makefile.objs | 13 +++++++++++--
 ui/Makefile.objs     | 37 ++++++++++++++++++++++-------------
 4 files changed, 72 insertions(+), 38 deletions(-)
Signature · 1 line
2.13.5
author
#1 lore raw

PATCH 1/9 buildsys: Move gtk/vte cflags/libs to per object

---
 configure        | 3 +--
 ui/Makefile.objs | 4 ++++
 2 files changed, 5 insertions(+), 2 deletions(-)
configure +1 -2
index b37cd54bda..e27a4bd683 100755
@@ -2437,7 +2437,6 @@ if test "$gtk" != "no"; then
             gtk_cflags="$gtk_cflags $x11_cflags"
             gtk_libs="$gtk_libs $x11_libs"
         fi
-        libs_softmmu="$gtk_libs $libs_softmmu"
         gtk="yes"
     elif test "$gtk" = "yes"; then
         feature_not_found "gtk" "Install gtk3-devel"
@@ -2678,7 +2677,6 @@ if test "$vte" != "no"; then
         vte_cflags=$($pkg_config --cflags $vtepackage)
         vte_libs=$($pkg_config --libs $vtepackage)
         vteversion=$($pkg_config --modversion $vtepackage)
-        libs_softmmu="$vte_libs $libs_softmmu"
         vte="yes"
     elif test "$vte" = "yes"; then
         if test "$gtkabi" = "3.0"; then
@@ -5750,6 +5748,7 @@ fi
 if test "$vte" = "yes" ; then
   echo "CONFIG_VTE=y" >> $config_host_mak
   echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak
+  echo "VTE_LIBS=$vte_libs" >> $config_host_mak
 fi
 if test "$virglrenderer" = "yes" ; then
   echo "CONFIG_VIRGL=y" >> $config_host_mak
ui/Makefile.objs +4 -0
index 3369451285..146a8ce062 100644
@@ -45,6 +45,10 @@ gtk.o-cflags := $(GTK_CFLAGS) $(VTE_CFLAGS)
 gtk-egl.o-cflags := $(GTK_CFLAGS) $(VTE_CFLAGS)
 gtk-gl-area.o-cflags := $(GTK_CFLAGS) $(VTE_CFLAGS)
 
+gtk.o-libs := $(GTK_LIBS) $(VTE_LIBS)
+gtk-egl.o-libs := $(GTK_LIBS) $(VTE_LIBS)
+gtk-gl-area.o-libs := $(GTK_LIBS) $(VTE_LIBS)
+
 gtk-egl.o-libs += $(OPENGL_LIBS)
 shader.o-libs += $(OPENGL_LIBS)
 console-gl.o-libs += $(OPENGL_LIBS)
Signature · 1 line
2.13.5
#2 lore raw

Re: [Qemu-devel] [PATCH 1/9] buildsys: Move gtk/vte cflags/libs to per object

Quoted 39 lines · Fam Zheng
---
  configure        | 3 +--
  ui/Makefile.objs | 4 ++++
  2 files changed, 5 insertions(+), 2 deletions(-)
configure +1 -2
index b37cd54bda..e27a4bd683 100755
@@ -2437,7 +2437,6 @@ if test "$gtk" != "no"; then
              gtk_cflags="$gtk_cflags $x11_cflags"
              gtk_libs="$gtk_libs $x11_libs"
          fi
-        libs_softmmu="$gtk_libs $libs_softmmu"
          gtk="yes"
      elif test "$gtk" = "yes"; then
          feature_not_found "gtk" "Install gtk3-devel"
@@ -2678,7 +2677,6 @@ if test "$vte" != "no"; then
          vte_cflags=$($pkg_config --cflags $vtepackage)
          vte_libs=$($pkg_config --libs $vtepackage)
          vteversion=$($pkg_config --modversion $vtepackage)
-        libs_softmmu="$vte_libs $libs_softmmu"
          vte="yes"
      elif test "$vte" = "yes"; then
          if test "$gtkabi" = "3.0"; then
@@ -5750,6 +5748,7 @@ fi
  if test "$vte" = "yes" ; then
    echo "CONFIG_VTE=y" >> $config_host_mak
    echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak
+  echo "VTE_LIBS=$vte_libs" >> $config_host_mak
  fi
  if test "$virglrenderer" = "yes" ; then
    echo "CONFIG_VIRGL=y" >> $config_host_mak
ui/Makefile.objs +0 -0
index 3369451285..146a8ce062 100644

ui/Makefile.objs gtk.o-cflags := $(GTK_CFLAGS) $(VTE_CFLAGS) · line 50

Quoted 6 lines
ui/Makefile.objs +3 -0
@@ -45,6 +45,10 @@ gtk.o-cflags := $(GTK_CFLAGS) $(VTE_CFLAGS)
  gtk-egl.o-cflags := $(GTK_CFLAGS) $(VTE_CFLAGS)
  gtk-gl-area.o-cflags := $(GTK_CFLAGS) $(VTE_CFLAGS)
 
+gtk.o-libs := $(GTK_LIBS) $(VTE_LIBS)
+gtk-egl.o-libs := $(GTK_LIBS) $(VTE_LIBS)
+gtk-gl-area.o-libs := $(GTK_LIBS) $(VTE_LIBS)
$(foreach x, gtk gtk-egl gtk-gl-area, \
    $(eval $x.o-libs += $(GTK_LIBS) $(VTE_LIBS)) \
    $(eval $x.o-cflags += $(GTK_CFLAGS) $(VTE_CFLAGS)) \

)

Quoted 5 lines
ui/Makefile.objs +1 -0
+
  gtk-egl.o-libs += $(OPENGL_LIBS)
  shader.o-libs += $(OPENGL_LIBS)
  console-gl.o-libs += $(OPENGL_LIBS)
#3 lore raw

Re: [Qemu-devel] [PATCH 1/9] buildsys: Move gtk/vte cflags/libs to per object

Quoted 17 lines · Philippe Mathieu-Daudé

ui/Makefile.objs gtk.o-cflags := $(GTK_CFLAGS) $(VTE_CFLAGS) · line 49

Quoted 10 lines · Fam Zheng
ui/Makefile.objs +2 -0
index 3369451285..146a8ce062 100644
@@ -45,6 +45,10 @@ gtk.o-cflags := $(GTK_CFLAGS) $(VTE_CFLAGS)
  gtk-egl.o-cflags := $(GTK_CFLAGS) $(VTE_CFLAGS)
  gtk-gl-area.o-cflags := $(GTK_CFLAGS) $(VTE_CFLAGS)
  +gtk.o-libs := $(GTK_LIBS) $(VTE_LIBS)
+gtk-egl.o-libs := $(GTK_LIBS) $(VTE_LIBS)
+gtk-gl-area.o-libs := $(GTK_LIBS) $(VTE_LIBS)
$(foreach x, gtk gtk-egl gtk-gl-area, \
    $(eval $x.o-libs += $(GTK_LIBS) $(VTE_LIBS)) \
    $(eval $x.o-cflags += $(GTK_CFLAGS) $(VTE_CFLAGS)) \
Quoted 1 line

)

I think that's worse, personally. Most developers don't touch the makefiles very often and so doing the simple straightforward thing is better. Then it's clearer to people who come along later how they need to add a new file to the makefiles (a surprisingly common question).

thanks
-- PMM

author
#4 lore raw

PATCH 2/9 buildsys: Move sdl cflags/libs to per object

In reply to Fam Zheng
---
 audio/Makefile.objs | 1 +
 configure           | 2 +-
 ui/Makefile.objs    | 1 +
 3 files changed, 3 insertions(+), 1 deletion(-)
audio/Makefile.objs +1 -0
index 481d1aa30e..c20695668f 100644
@@ -11,3 +11,4 @@ common-obj-$(CONFIG_AUDIO_WIN_INT) += audio_win_int.o
 common-obj-y += wavcapture.o
 
 sdlaudio.o-cflags := $(SDL_CFLAGS)
+sdlaudio.o-libs := $(SDL_LIBS)
configure +1 -1
index e27a4bd683..812a1ce615 100755
@@ -2794,7 +2794,6 @@ EOF
     sdl_cflags="$sdl_cflags $x11_cflags"
     sdl_libs="$sdl_libs $x11_libs"
   fi
-  libs_softmmu="$sdl_libs $libs_softmmu"
 fi
 
 ##########################################
@@ -5593,6 +5592,7 @@ if test "$sdl" = "yes" ; then
   echo "CONFIG_SDL=y" >> $config_host_mak
   echo "CONFIG_SDLABI=$sdlabi" >> $config_host_mak
   echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
+  echo "SDL_LIBS=$sdl_libs" >> $config_host_mak
 fi
 if test "$cocoa" = "yes" ; then
   echo "CONFIG_COCOA=y" >> $config_host_mak
ui/Makefile.objs +1 -0
index 146a8ce062..b3e29e21f0 100644
@@ -27,6 +27,7 @@ sdl.mo-objs += sdl2-gl.o
 endif
 endif
 sdl.mo-cflags := $(SDL_CFLAGS)
+sdl.mo-libs := $(SDL_LIBS)
 
 ifeq ($(CONFIG_OPENGL),y)
 common-obj-y += shader.o
Signature · 1 line
2.13.5
author
#5 lore raw

PATCH 3/9 buildsys: Move vnc cflags/libs to per object

In reply to Fam Zheng
---
 configure        | 14 ++++++++------
 ui/Makefile.objs | 21 ++++++++++++---------
 2 files changed, 20 insertions(+), 15 deletions(-)
configure +8 -6
index 812a1ce615..9b0eb91a9b 100755
@@ -2834,8 +2834,8 @@ EOF
   vnc_sasl_libs="-lsasl2"
   if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
     vnc_sasl=yes
-    libs_softmmu="$vnc_sasl_libs $libs_softmmu"
-    QEMU_CFLAGS="$QEMU_CFLAGS $vnc_sasl_cflags"
+    vnc_libs="$vnc_libs $vnc_sasl_libs"
+    vnc_cflags="$vnc_cflags $vnc_sasl_cflags"
   else
     if test "$vnc_sasl" = "yes" ; then
       feature_not_found "vnc-sasl" "Install Cyrus SASL devel"
@@ -2856,8 +2856,8 @@ EOF
     vnc_jpeg_libs="-ljpeg"
   if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
     vnc_jpeg=yes
-    libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
-    QEMU_CFLAGS="$QEMU_CFLAGS $vnc_jpeg_cflags"
+    vnc_libs="$vnc_libs $vnc_jpeg_libs"
+    vnc_cflags="$vnc_cflags $vnc_jpeg_cflags"
   else
     if test "$vnc_jpeg" = "yes" ; then
       feature_not_found "vnc-jpeg" "Install libjpeg-turbo devel"
@@ -2888,8 +2888,8 @@ EOF
   fi
   if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
     vnc_png=yes
-    libs_softmmu="$vnc_png_libs $libs_softmmu"
-    QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags"
+    vnc_libs="$vnc_libs $vnc_png_libs"
+    vnc_cflags="$vnc_cflags $vnc_png_cflags"
   else
     if test "$vnc_png" = "yes" ; then
       feature_not_found "vnc-png" "Install libpng devel"
@@ -5558,6 +5558,8 @@ echo "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak
 echo "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak
 if test "$vnc" = "yes" ; then
   echo "CONFIG_VNC=y" >> $config_host_mak
+  echo "VNC_CFLAGS=$vnc_cflags" >> $config_host_mak
+  echo "VNC_LIBS=$vnc_libs" >> $config_host_mak
 fi
 if test "$vnc_sasl" = "yes" ; then
   echo "CONFIG_VNC_SASL=y" >> $config_host_mak
ui/Makefile.objs +12 -9
index b3e29e21f0..a0b3c15a28 100644
@@ -1,11 +1,14 @@
-vnc-obj-y += vnc.o
-vnc-obj-y += vnc-enc-zlib.o vnc-enc-hextile.o
-vnc-obj-y += vnc-enc-tight.o vnc-palette.o
-vnc-obj-y += vnc-enc-zrle.o
-vnc-obj-y += vnc-auth-vencrypt.o
-vnc-obj-$(CONFIG_VNC_SASL) += vnc-auth-sasl.o
-vnc-obj-y += vnc-ws.o
-vnc-obj-y += vnc-jobs.o
+vnc.mo-objs += vnc.o
+vnc.mo-objs += vnc-enc-zlib.o vnc-enc-hextile.o
+vnc.mo-objs += vnc-enc-tight.o vnc-palette.o
+vnc.mo-objs += vnc-enc-zrle.o
+vnc.mo-objs += vnc-auth-vencrypt.o
+vnc.mo-objs += $(if $(CONFIG_VNC_SASL), vnc-auth-sasl.o)
+vnc.mo-objs += vnc-ws.o
+vnc.mo-objs += vnc-jobs.o
+
+vnc.mo-cflags := $(VNC_CFLAGS)
+vnc.mo-libs := $(VNC_LIBS)
 
 common-obj-y += keymaps.o console.o cursor.o qemu-pixman.o
 common-obj-y += input.o input-keymap.o input-legacy.o
@@ -14,7 +17,7 @@ common-obj-$(CONFIG_SPICE) += spice-core.o spice-input.o spice-display.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_VNC) += vnc.mo
 common-obj-$(CONFIG_GTK) += gtk.o x_keymap.o
 
 ifeq ($(CONFIG_SDLABI),1.2)
Signature · 1 line
2.13.5
author
#6 lore raw

PATCH 4/9 buildsys: Move audio libs to per object

In reply to Fam Zheng
---
 audio/Makefile.objs |  5 +++++
 configure           | 15 ++++++++++-----
 2 files changed, 15 insertions(+), 5 deletions(-)
audio/Makefile.objs +5 -0
index c20695668f..8a5ede6e2b 100644
@@ -12,3 +12,8 @@ common-obj-y += wavcapture.o
 
 sdlaudio.o-cflags := $(SDL_CFLAGS)
 sdlaudio.o-libs := $(SDL_LIBS)
+alsaaudio.o-libs := $(ALSA_LIBS)
+paaudio.o-libs := $(PULSE_LIBS)
+coreaudio.o-libs := $(COREAUDIO_LIBS)
+dsoundaudio.o-libs := $(DSOUND_LIBS)
+ossaudio.o-libs := $(OSS_LIBS)
configure +10 -5
index 9b0eb91a9b..71fa9717ff 100755
@@ -3040,13 +3040,13 @@ for drv in $audio_drv_list; do
     alsa)
     audio_drv_probe $drv alsa/asoundlib.h -lasound \
         "return snd_pcm_close((snd_pcm_t *)0);"
-    libs_softmmu="-lasound $libs_softmmu"
+    alsa_libs="-lasound"
     ;;
 
     pa)
     audio_drv_probe $drv pulse/pulseaudio.h "-lpulse" \
         "pa_context_set_source_output_volume(NULL, 0, NULL, NULL, NULL); return 0;"
-    libs_softmmu="-lpulse $libs_softmmu"
+    pulse_libs="-lpulse"
     audio_pt_int="yes"
     ;;
 
@@ -3057,16 +3057,16 @@ for drv in $audio_drv_list; do
     ;;
 
     coreaudio)
-      libs_softmmu="-framework CoreAudio $libs_softmmu"
+      coreaudio_libs="-framework CoreAudio"
     ;;
 
     dsound)
-      libs_softmmu="-lole32 -ldxguid $libs_softmmu"
+      dsound_libs="-lole32 -ldxguid"
       audio_win_int="yes"
     ;;
 
     oss)
-      libs_softmmu="$oss_lib $libs_softmmu"
+      oss_libs="$oss_lib"
     ;;
 
     wav)
@@ -5548,6 +5548,11 @@ for drv in $audio_drv_list; do
     def=CONFIG_$(echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]')
     echo "$def=y" >> $config_host_mak
 done
+echo "ALSA_LIBS=$alsa_libs" >> $config_host_mak
+echo "PULSE_LIBS=$pulse_libs" >> $config_host_mak
+echo "COREAUDIO_LIBS=$coreaudio_libs" >> $config_host_mak
+echo "DSOUND_LIBS=$dsound_libs" >> $config_host_mak
+echo "OSS_LIBS=$oss_libs" >> $config_host_mak
 if test "$audio_pt_int" = "yes" ; then
   echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
 fi
Signature · 1 line
2.13.5
author
#7 lore raw

PATCH 5/9 buildsys: Move curese cflags/libs to per object

In reply to Fam Zheng
---
 configure        | 6 ++++--
 ui/Makefile.objs | 3 +++
 2 files changed, 7 insertions(+), 2 deletions(-)
configure +4 -2
index 71fa9717ff..b08cb4ce02 100755
@@ -3137,8 +3137,8 @@ EOF
       unset IFS
       if compile_prog "$curses_inc" "$curses_lib" ; then
         curses_found=yes
-        QEMU_CFLAGS="$curses_inc $QEMU_CFLAGS"
-        libs_softmmu="$curses_lib $libs_softmmu"
+        curses_cflags="$curses_inc $curses_cflags"
+        curses_libs="$curses_lib $curses_libs"
         break
       fi
     done
@@ -5606,6 +5606,8 @@ if test "$cocoa" = "yes" ; then
 fi
 if test "$curses" = "yes" ; then
   echo "CONFIG_CURSES=y" >> $config_host_mak
+  echo "CURSES_CFLAGS=$curses_cflags" >> $config_host_mak
+  echo "CURSES_LIBS=$curses_libs" >> $config_host_mak
 fi
 if test "$pipe2" = "yes" ; then
   echo "CONFIG_PIPE2=y" >> $config_host_mak
ui/Makefile.objs +3 -0
index a0b3c15a28..e3403b698b 100644
@@ -57,3 +57,6 @@ gtk-egl.o-libs += $(OPENGL_LIBS)
 shader.o-libs += $(OPENGL_LIBS)
 console-gl.o-libs += $(OPENGL_LIBS)
 egl-helpers.o-libs += $(OPENGL_LIBS)
+
+curses.o-cflags := $(CURSES_CFLAGS)
+curses.o-libs := $(CURSES_LIBS)
Signature · 1 line
2.13.5
author
#8 lore raw

PATCH 6/9 buildsys: Move opengl cflags to per object

In reply to Fam Zheng

Opengl libs are already moved to per object, do so for the cflags as well.

---
 configure        | 2 +-
 ui/Makefile.objs | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)
configure +1 -1
index b08cb4ce02..b1320b1994 100755
@@ -3623,7 +3623,6 @@ if test "$opengl" != "no" ; then
     if test "$gtk" = "yes" && $pkg_config --exists "$gtkpackage >= 3.16"; then
         gtk_gl="yes"
     fi
-    QEMU_CFLAGS="$QEMU_CFLAGS $opengl_cflags"
   else
     if test "$opengl" = "yes" ; then
       feature_not_found "opengl" "Please install opengl (mesa) devel pkgs: $opengl_pkgs"
@@ -5844,6 +5843,7 @@ fi
 
 if test "$opengl" = "yes" ; then
   echo "CONFIG_OPENGL=y" >> $config_host_mak
+  echo "OPENGL_CFLAGS=$opengl_cflags" >> $config_host_mak
   echo "OPENGL_LIBS=$opengl_libs" >> $config_host_mak
   if test "$opengl_dmabuf" = "yes" ; then
     echo "CONFIG_OPENGL_DMABUF=y" >> $config_host_mak
ui/Makefile.objs +4 -4
index e3403b698b..95943d9c33 100644
@@ -53,10 +53,10 @@ gtk.o-libs := $(GTK_LIBS) $(VTE_LIBS)
 gtk-egl.o-libs := $(GTK_LIBS) $(VTE_LIBS)
 gtk-gl-area.o-libs := $(GTK_LIBS) $(VTE_LIBS)
 
-gtk-egl.o-libs += $(OPENGL_LIBS)
-shader.o-libs += $(OPENGL_LIBS)
-console-gl.o-libs += $(OPENGL_LIBS)
-egl-helpers.o-libs += $(OPENGL_LIBS)
+$(foreach x, gtk-egl shader console egl-helpers, \
+	$(eval $x.o-libs += $(OPENGL_LIBS)) \
+	$(eval $x.o-cflags += $(OPENGL_CFLAGS)) \
+)
 
 curses.o-cflags := $(CURSES_CFLAGS)
 curses.o-libs := $(CURSES_LIBS)
Signature · 1 line
2.13.5
author
#9 lore raw

PATCH 7/9 buildsys: Move libcacard cflags/libs to per object

In reply to Fam Zheng
---
 configure            | 4 ++--
 hw/usb/Makefile.objs | 6 ++++--
 2 files changed, 6 insertions(+), 4 deletions(-)
configure +2 -2
index b1320b1994..85fef3d16f 100755
@@ -4237,8 +4237,6 @@ if test "$smartcard" != "no"; then
     if $pkg_config libcacard; then
         libcacard_cflags=$($pkg_config --cflags libcacard)
         libcacard_libs=$($pkg_config --libs libcacard)
-        QEMU_CFLAGS="$QEMU_CFLAGS $libcacard_cflags"
-        libs_softmmu="$libs_softmmu $libcacard_libs"
         smartcard="yes"
     else
         if test "$smartcard" = "yes"; then
@@ -5831,6 +5829,8 @@ fi
 
 if test "$smartcard" = "yes" ; then
   echo "CONFIG_SMARTCARD=y" >> $config_host_mak
+  echo "SMARTCARD_CFLAGS=$libcacard_cflags" >> $config_host_mak
+  echo "SMARTCARD_LIBS=$libcacard_libs" >> $config_host_mak
 fi
 
 if test "$libusb" = "yes" ; then
hw/usb/Makefile.objs +4 -2
index 97f1c4561a..795ff25a5e 100644
@@ -26,8 +26,10 @@ common-obj-$(CONFIG_USB_BLUETOOTH)    += dev-bluetooth.o
 
 ifeq ($(CONFIG_USB_SMARTCARD),y)
 common-obj-y                          += dev-smartcard-reader.o
-common-obj-$(CONFIG_SMARTCARD)        += ccid-card-passthru.o
-common-obj-$(CONFIG_SMARTCARD)        += ccid-card-emulated.o
+common-obj-$(CONFIG_SMARTCARD)        += smartcard.mo
+smartcard.mo-objs := ccid-card-passthru.o ccid-card-emulated.o
+smartcard.mo-cflags := $(SMARTCARD_CFLAGS)
+smartcard.mo-libs := $(SMARTCARD_LIBS)
 endif
 
 ifeq ($(CONFIG_POSIX),y)
Signature · 1 line
2.13.5
#10 lore raw

Re: [Qemu-devel] [PATCH 7/9] buildsys: Move libcacard cflags/libs to per object

Quoted 33 lines · Fam Zheng
---
  configure            | 4 ++--
  hw/usb/Makefile.objs | 6 ++++--
  2 files changed, 6 insertions(+), 4 deletions(-)
configure +2 -2
index b1320b1994..85fef3d16f 100755
@@ -4237,8 +4237,6 @@ if test "$smartcard" != "no"; then
      if $pkg_config libcacard; then
          libcacard_cflags=$($pkg_config --cflags libcacard)
          libcacard_libs=$($pkg_config --libs libcacard)
-        QEMU_CFLAGS="$QEMU_CFLAGS $libcacard_cflags"
-        libs_softmmu="$libs_softmmu $libcacard_libs"
          smartcard="yes"
      else
          if test "$smartcard" = "yes"; then
@@ -5831,6 +5829,8 @@ fi
 
  if test "$smartcard" = "yes" ; then
    echo "CONFIG_SMARTCARD=y" >> $config_host_mak
+  echo "SMARTCARD_CFLAGS=$libcacard_cflags" >> $config_host_mak
+  echo "SMARTCARD_LIBS=$libcacard_libs" >> $config_host_mak
  fi
 
  if test "$libusb" = "yes" ; then
hw/usb/Makefile.objs +0 -0
index 97f1c4561a..795ff25a5e 100644

hw/usb/Makefile.objs common-obj-$(CONFIG_USB_BLUETOOTH) += dev-bluetooth.o · line 32

Quoted 9 lines
hw/usb/Makefile.objs +4 -2
@@ -26,8 +26,10 @@ common-obj-$(CONFIG_USB_BLUETOOTH)    += dev-bluetooth.o
 
  ifeq ($(CONFIG_USB_SMARTCARD),y)
  common-obj-y                          += dev-smartcard-reader.o
-common-obj-$(CONFIG_SMARTCARD)        += ccid-card-passthru.o
-common-obj-$(CONFIG_SMARTCARD)        += ccid-card-emulated.o
+common-obj-$(CONFIG_SMARTCARD)        += smartcard.mo
+smartcard.mo-objs := ccid-card-passthru.o ccid-card-emulated.o
+smartcard.mo-cflags := $(SMARTCARD_CFLAGS)
+smartcard.mo-libs := $(SMARTCARD_LIBS)

this line here looks more natural to me:

common-obj-$(CONFIG_SMARTCARD) += smartcard.mo

Quoted 4 lines
hw/usb/Makefile.objs +0 -0
  endif
 
  ifeq ($(CONFIG_POSIX),y)
author
#11 lore raw

Re: [Qemu-devel] [PATCH 7/9] buildsys: Move libcacard cflags/libs to per object

Quoted 45 lines · Philippe Mathieu-Daudé
Quoted 31 lines · Fam Zheng
---
  configure            | 4 ++--
  hw/usb/Makefile.objs | 6 ++++--
  2 files changed, 6 insertions(+), 4 deletions(-)
configure +2 -2
index b1320b1994..85fef3d16f 100755
@@ -4237,8 +4237,6 @@ if test "$smartcard" != "no"; then
      if $pkg_config libcacard; then
          libcacard_cflags=$($pkg_config --cflags libcacard)
          libcacard_libs=$($pkg_config --libs libcacard)
-        QEMU_CFLAGS="$QEMU_CFLAGS $libcacard_cflags"
-        libs_softmmu="$libs_softmmu $libcacard_libs"
          smartcard="yes"
      else
          if test "$smartcard" = "yes"; then
@@ -5831,6 +5829,8 @@ fi
  if test "$smartcard" = "yes" ; then
    echo "CONFIG_SMARTCARD=y" >> $config_host_mak
+  echo "SMARTCARD_CFLAGS=$libcacard_cflags" >> $config_host_mak
+  echo "SMARTCARD_LIBS=$libcacard_libs" >> $config_host_mak
  fi
  if test "$libusb" = "yes" ; then
hw/usb/Makefile.objs +0 -0
index 97f1c4561a..795ff25a5e 100644

hw/usb/Makefile.objs common-obj-$(CONFIG_USB_BLUETOOTH) += dev-bluetooth.o · line 31

Quoted 8 lines
hw/usb/Makefile.objs +4 -2
@@ -26,8 +26,10 @@ common-obj-$(CONFIG_USB_BLUETOOTH)    += dev-bluetooth.o
  ifeq ($(CONFIG_USB_SMARTCARD),y)
  common-obj-y                          += dev-smartcard-reader.o
-common-obj-$(CONFIG_SMARTCARD)        += ccid-card-passthru.o
-common-obj-$(CONFIG_SMARTCARD)        += ccid-card-emulated.o
+common-obj-$(CONFIG_SMARTCARD)        += smartcard.mo
+smartcard.mo-objs := ccid-card-passthru.o ccid-card-emulated.o
+smartcard.mo-cflags := $(SMARTCARD_CFLAGS)
+smartcard.mo-libs := $(SMARTCARD_LIBS)

this line here looks more natural to me:

Quoted 1 line

common-obj-$(CONFIG_SMARTCARD) += smartcard.mo

Do you mean to move this line *after* the .mo variables? I personally find the current (top-down) order easier to understand, and it more common.

Fam

Quoted 5 lines
Quoted 4 lines
hw/usb/Makefile.objs +0 -0
  endif
  ifeq ($(CONFIG_POSIX),y)
 
author
#12 lore raw

PATCH 8/9 buildsys: Move libusb cflags/libs to per object

In reply to Fam Zheng
---
 configure            | 4 ++--
 hw/usb/Makefile.objs | 5 +++++
 2 files changed, 7 insertions(+), 2 deletions(-)
configure +2 -2
index 85fef3d16f..bee1302155 100755
@@ -4252,8 +4252,6 @@ if test "$libusb" != "no" ; then
         libusb="yes"
         libusb_cflags=$($pkg_config --cflags libusb-1.0)
         libusb_libs=$($pkg_config --libs libusb-1.0)
-        QEMU_CFLAGS="$QEMU_CFLAGS $libusb_cflags"
-        libs_softmmu="$libs_softmmu $libusb_libs"
     else
         if test "$libusb" = "yes"; then
             feature_not_found "libusb" "Install libusb devel >= 1.0.13"
@@ -5835,6 +5833,8 @@ fi
 
 if test "$libusb" = "yes" ; then
   echo "CONFIG_USB_LIBUSB=y" >> $config_host_mak
+  echo "LIBUSB_CFLAGS=$libusb_cflags" >> $config_host_mak
+  echo "LIBUSB_LIBS=$libusb_libs" >> $config_host_mak
 fi
 
 if test "$usb_redir" = "yes" ; then
hw/usb/Makefile.objs +5 -0
index 795ff25a5e..9ce9eadb47 100644
@@ -42,6 +42,11 @@ common-obj-$(CONFIG_USB_REDIR) += redirect.o quirks.o
 # usb pass-through
 common-obj-y += $(patsubst %,host-%.o,$(HOST_USB))
 
+host-libusb.o-cflags := $(LIBUSB_CFLAGS)
+host-libusb.o-libs := $(LIBUSB_LIBS)
+
 ifeq ($(CONFIG_USB_LIBUSB),y)
 common-obj-$(CONFIG_XEN) += xen-usb.o
+xen-usb.o-cflags := $(LIBUSB_CFLAGS)
+xen-usb.o-libs := $(LIBUSB_LIBS)
 endif
Signature · 1 line
2.13.5
author
#13 lore raw

PATCH 9/9 buildsys: Move usb redir cflags/libs to per object

In reply to Fam Zheng
---
 configure            | 4 ++--
 hw/usb/Makefile.objs | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)
configure +2 -2
index bee1302155..763a65f156 100755
@@ -4266,8 +4266,6 @@ if test "$usb_redir" != "no" ; then
         usb_redir="yes"
         usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5)
         usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5)
-        QEMU_CFLAGS="$QEMU_CFLAGS $usb_redir_cflags"
-        libs_softmmu="$libs_softmmu $usb_redir_libs"
     else
         if test "$usb_redir" = "yes"; then
             feature_not_found "usb-redir" "Install usbredir devel"
@@ -5839,6 +5837,8 @@ fi
 
 if test "$usb_redir" = "yes" ; then
   echo "CONFIG_USB_REDIR=y" >> $config_host_mak
+  echo "USB_REDIR_CFLAGS=$usb_redir_cflags" >> $config_host_mak
+  echo "USB_REDIR_LIBS=$usb_redir_libs" >> $config_host_mak
 fi
 
 if test "$opengl" = "yes" ; then
hw/usb/Makefile.objs +2 -0
index 9ce9eadb47..92eb199697 100644
@@ -38,6 +38,8 @@ endif
 
 # usb redirection
 common-obj-$(CONFIG_USB_REDIR) += redirect.o quirks.o
+redirect.o-cflags = $(USB_REDIR_CFLAGS)
+redirect.o-libs = $(USB_REDIR_LIBS)
 
 # usb pass-through
 common-obj-y += $(patsubst %,host-%.o,$(HOST_USB))
Signature · 1 line
2.13.5
author
#15 lore raw
Quoted 10 lines · Gerd Hoffmann
Quoted 5 lines · Fam Zheng

Hi Gerd,

This is part two of the QEMU_CFLAGS and libs_softmmu cleanup series, including
ui/, audio/ and hw/usb/. Please review.

Looks good, survived a test build.

Thanks for the quick review! Do you want to queue this in your tree? If not I can include it in my next pull request for "build and test automation" patches.

Fam

#16 lore raw
Quoted 8 lines · Fam Zheng
Quoted 7 lines · Gerd Hoffmann
Quoted 5 lines · Fam Zheng

Hi Gerd,

This is part two of the QEMU_CFLAGS and libs_softmmu cleanup series, including
ui/, audio/ and hw/usb/. Please review.

Quoted 6 lines
Quoted 3 lines

Looks good, survived a test build.

Thanks for the quick review! Do you want to queue this in your tree? If not I can include it in my next pull request for "build and test automation" patches.

+1 for "build and test automation"

this series:

Also Fam I recommend you to use scripts/git.orderfile it is easier to read the ./configure before the Makefiles.

Regards,

Phil.

#17 lore raw
In reply to Fam Zheng
Quoted 9 lines · Fam Zheng
Quoted 8 lines · Gerd Hoffmann
Quoted 6 lines · Fam Zheng

Hi Gerd,

This is part two of the QEMU_CFLAGS and libs_softmmu cleanup series,
including
ui/, audio/ and hw/usb/. Please review.

Quoted 8 lines
Quoted 3 lines

Looks good, survived a test build.

Thanks for the quick review! Do you want to queue this in your tree? If not I
can include it in my next pull request for "build and test automation" patches.

Feel free do include it in your pull. I assumed that is your intention anyway as you've asked for review not merge ;)

cheers,
Gerd

author
#18 lore raw
Quoted 14 lines · Gerd Hoffmann
Quoted 13 lines · Fam Zheng
Quoted 11 lines · Gerd Hoffmann
Quoted 6 lines · Fam Zheng

Hi Gerd,

This is part two of the QEMU_CFLAGS and libs_softmmu cleanup series,
including
ui/, audio/ and hw/usb/. Please review.

Looks good, survived a test build.

Quoted 7 lines
Quoted 4 lines

Thanks for the quick review! Do you want to queue this in your tree? If not I
can include it in my next pull request for "build and test automation" patches.

Feel free do include it in your pull. I assumed that is your intention anyway as you've asked for review not merge ;)

Thanks, I'll send a pull request later. (I thought asking for review first is a necessary step before talking about merging :)

Fam