diff mbox

[v2,02/19] bsd-user: add HOST_ABI_DIR for the various *BSD dependent code.

Message ID 1383928417-38009-3-git-send-email-sson@FreeBSD.org
State New
Headers show

Commit Message

Stacey Son Nov. 8, 2013, 4:33 p.m. UTC
This change adds HOST_ABI_DIR (similar to TARGET_ABI_DIR) so the various
BSD OS dependent code can be seperated into its own directories rather
than using #ifdef's.

Signed-off-by: Stacey Son <sson@FreeBSD.org>
---
 Makefile.target |    3 ++-
 configure       |   11 +++++++++++
 2 files changed, 13 insertions(+), 1 deletions(-)

Comments

Paolo Bonzini Nov. 27, 2013, 11:27 a.m. UTC | #1
Il 08/11/2013 17:33, Stacey Son ha scritto:
> This change adds HOST_ABI_DIR (similar to TARGET_ABI_DIR) so the various
> BSD OS dependent code can be seperated into its own directories rather
> than using #ifdef's.

I would say this is not exactly an ABI, so it would be better to call it
HOST_VARIANT_DIR.

Also, is it really host-dependent?  If you had hypothetically a qemu
that ran OpenBSD targets on FreeBSD, would it use bsd-user/freebsd or
bsd-user/openbsd?

So, this should be either HOST_VARIANT_DIR or TARGET_VARIANT_DIR,
depending on the answer to the above question.

Apart from this, the patch looks good.

Paolo

> Signed-off-by: Stacey Son <sson@FreeBSD.org>
> ---
>  Makefile.target |    3 ++-
>  configure       |   11 +++++++++++
>  2 files changed, 13 insertions(+), 1 deletions(-)
> 
> diff --git a/Makefile.target b/Makefile.target
> index af6ac7e..82ae8cb 100644
> --- a/Makefile.target
> +++ b/Makefile.target
> @@ -99,7 +99,8 @@ endif #CONFIG_LINUX_USER
>  
>  ifdef CONFIG_BSD_USER
>  
> -QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ABI_DIR)
> +QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ABI_DIR) \
> +			 -I$(SRC_PATH)/bsd-user/$(HOST_ABI_DIR)
>  
>  obj-y += bsd-user/
>  obj-y += gdbstub.o user-exec.o
> diff --git a/configure b/configure
> index 91372f9..14571c6 100755
> --- a/configure
> +++ b/configure
> @@ -449,6 +449,9 @@ fi
>  
>  # OS specific
>  
> +# host *BSD for user mode
> +HOST_ABI_DIR=""
> +
>  case $targetos in
>  CYGWIN*)
>    mingw32="yes"
> @@ -473,12 +476,14 @@ FreeBSD)
>    audio_possible_drivers="oss sdl esd pa"
>    # needed for kinfo_getvmmap(3) in libutil.h
>    LIBS="-lutil $LIBS"
> +  HOST_ABI_DIR="freebsd"
>  ;;
>  DragonFly)
>    bsd="yes"
>    make="${MAKE-gmake}"
>    audio_drv_list="oss"
>    audio_possible_drivers="oss sdl esd pa"
> +  HOST_ABI_DIR="dragonfly"
>  ;;
>  NetBSD)
>    bsd="yes"
> @@ -486,12 +491,14 @@ NetBSD)
>    audio_drv_list="oss"
>    audio_possible_drivers="oss sdl esd"
>    oss_lib="-lossaudio"
> +  HOST_ABI_DIR="netbsd"
>  ;;
>  OpenBSD)
>    bsd="yes"
>    make="${MAKE-gmake}"
>    audio_drv_list="sdl"
>    audio_possible_drivers="sdl esd"
> +  HOST_ABI_DIR="openbsd"
>  ;;
>  Darwin)
>    bsd="yes"
> @@ -510,6 +517,7 @@ Darwin)
>    # Disable attempts to use ObjectiveC features in os/object.h since they
>    # won't work when we're compiling with gcc as a C compiler.
>    QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS"
> +  HOST_ABI_DIR="darwin"
>  ;;
>  SunOS)
>    solaris="yes"
> @@ -4471,6 +4479,9 @@ if [ "$TARGET_ABI_DIR" = "" ]; then
>    TARGET_ABI_DIR=$TARGET_ARCH
>  fi
>  echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
> +if [ "$HOST_ABI_DIR" != "" ]; then
> +    echo "HOST_ABI_DIR=$HOST_ABI_DIR" >> $config_target_mak
> +fi
>  case "$target_name" in
>    i386|x86_64)
>      if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
>
diff mbox

Patch

diff --git a/Makefile.target b/Makefile.target
index af6ac7e..82ae8cb 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -99,7 +99,8 @@  endif #CONFIG_LINUX_USER
 
 ifdef CONFIG_BSD_USER
 
-QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ABI_DIR)
+QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ABI_DIR) \
+			 -I$(SRC_PATH)/bsd-user/$(HOST_ABI_DIR)
 
 obj-y += bsd-user/
 obj-y += gdbstub.o user-exec.o
diff --git a/configure b/configure
index 91372f9..14571c6 100755
--- a/configure
+++ b/configure
@@ -449,6 +449,9 @@  fi
 
 # OS specific
 
+# host *BSD for user mode
+HOST_ABI_DIR=""
+
 case $targetos in
 CYGWIN*)
   mingw32="yes"
@@ -473,12 +476,14 @@  FreeBSD)
   audio_possible_drivers="oss sdl esd pa"
   # needed for kinfo_getvmmap(3) in libutil.h
   LIBS="-lutil $LIBS"
+  HOST_ABI_DIR="freebsd"
 ;;
 DragonFly)
   bsd="yes"
   make="${MAKE-gmake}"
   audio_drv_list="oss"
   audio_possible_drivers="oss sdl esd pa"
+  HOST_ABI_DIR="dragonfly"
 ;;
 NetBSD)
   bsd="yes"
@@ -486,12 +491,14 @@  NetBSD)
   audio_drv_list="oss"
   audio_possible_drivers="oss sdl esd"
   oss_lib="-lossaudio"
+  HOST_ABI_DIR="netbsd"
 ;;
 OpenBSD)
   bsd="yes"
   make="${MAKE-gmake}"
   audio_drv_list="sdl"
   audio_possible_drivers="sdl esd"
+  HOST_ABI_DIR="openbsd"
 ;;
 Darwin)
   bsd="yes"
@@ -510,6 +517,7 @@  Darwin)
   # Disable attempts to use ObjectiveC features in os/object.h since they
   # won't work when we're compiling with gcc as a C compiler.
   QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS"
+  HOST_ABI_DIR="darwin"
 ;;
 SunOS)
   solaris="yes"
@@ -4471,6 +4479,9 @@  if [ "$TARGET_ABI_DIR" = "" ]; then
   TARGET_ABI_DIR=$TARGET_ARCH
 fi
 echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
+if [ "$HOST_ABI_DIR" != "" ]; then
+    echo "HOST_ABI_DIR=$HOST_ABI_DIR" >> $config_target_mak
+fi
 case "$target_name" in
   i386|x86_64)
     if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then