diff mbox

[3/4] main: use TARGET_ARCH only for the target-specific #define

Message ID 1369654491-1467-4-git-send-email-pbonzini@redhat.com
State New
Headers show

Commit Message

Paolo Bonzini May 27, 2013, 11:34 a.m. UTC
Everything else needs to match the executable name, which is
TARGET_NAME.

Before:
    $ sh4eb-linux-user/qemu-sh4eb --help
    usage: qemu-sh4 [options] program [arguments...]
    Linux CPU emulator (compiled for sh4 emulation)

After:
    $ sh4eb-linux-user/qemu-sh4eb --help
    usage: qemu-sh4eb [options] program [arguments...]
    Linux CPU emulator (compiled for sh4eb emulation)

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 arch_init.c           |  2 +-
 bsd-user/main.c       |  6 +++---
 configure             | 25 +++++++++++++++----------
 linux-user/main.c     |  6 +++---
 scripts/create_config | 13 ++++---------
 5 files changed, 26 insertions(+), 26 deletions(-)

Comments

Peter Maydell May 28, 2013, 6:09 p.m. UTC | #1
On 27 May 2013 12:34, Paolo Bonzini <pbonzini@redhat.com> wrote:
> Everything else needs to match the executable name, which is
> TARGET_NAME.
>
> Before:
>     $ sh4eb-linux-user/qemu-sh4eb --help
>     usage: qemu-sh4 [options] program [arguments...]
>     Linux CPU emulator (compiled for sh4 emulation)
>
> After:
>     $ sh4eb-linux-user/qemu-sh4eb --help
>     usage: qemu-sh4eb [options] program [arguments...]
>     Linux CPU emulator (compiled for sh4eb emulation)
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  arch_init.c           |  2 +-
>  bsd-user/main.c       |  6 +++---
>  configure             | 25 +++++++++++++++----------
>  linux-user/main.c     |  6 +++---
>  scripts/create_config | 13 ++++---------
>  5 files changed, 26 insertions(+), 26 deletions(-)
>
> diff --git a/arch_init.c b/arch_init.c
> index 49c5dc2..22fbe96 100644
> --- a/arch_init.c
> +++ b/arch_init.c
> @@ -123,7 +123,7 @@ static struct defconfig_file {
>      bool userconfig;
>  } default_config_files[] = {
>      { CONFIG_QEMU_CONFDIR "/qemu.conf",                   true },
> -    { CONFIG_QEMU_CONFDIR "/target-" TARGET_ARCH ".conf", true },
> +    { CONFIG_QEMU_CONFDIR "/target-" TARGET_NAME ".conf", true },
>      { NULL }, /* end of list */

I note this changes user-visible behaviour since we're now
looking for different config files. Doesn't this need to be
documented somewhere? Or is it that we can get away with making
the change because it is undocumented?

> --- a/scripts/create_config
> +++ b/scripts/create_config
> @@ -70,16 +70,10 @@ case $line in
>      value=${line#*=}
>      echo "#define $name $value"
>      ;;
> - TARGET_ARCH=*) # configuration
> -    target_arch=${line#*=}
> -    echo "#define TARGET_ARCH \"$target_arch\""
> -    ;;
>   TARGET_BASE_ARCH=*) # configuration
>      target_base_arch=${line#*=}
> -    if [ "$target_base_arch" != "$target_arch" ]; then
> -      base_arch_name=`echo $target_base_arch | LC_ALL=C tr '[a-z]' '[A-Z]'`
> -      echo "#define TARGET_$base_arch_name 1"
> -    fi
> +    base_arch_name=`echo $target_base_arch | LC_ALL=C tr '[a-z]' '[A-Z]'`
> +    echo "#define TARGET_$base_arch_name 1"
>      ;;

This change means that (eg) arm-softmmu/config-target.h now has
two lines "#define TARGET_ARM 1", once because config-target.mak
has TARGET_ARM=y and once becgaues of TARGET_BASE_ARCH=arm.
I guess that's just cosmetic though.

thanks
-- PMM
Paolo Bonzini May 29, 2013, 6:30 a.m. UTC | #2
Il 28/05/2013 20:09, Peter Maydell ha scritto:
> On 27 May 2013 12:34, Paolo Bonzini <pbonzini@redhat.com> wrote:
>> Everything else needs to match the executable name, which is
>> TARGET_NAME.
>>
>> Before:
>>     $ sh4eb-linux-user/qemu-sh4eb --help
>>     usage: qemu-sh4 [options] program [arguments...]
>>     Linux CPU emulator (compiled for sh4 emulation)
>>
>> After:
>>     $ sh4eb-linux-user/qemu-sh4eb --help
>>     usage: qemu-sh4eb [options] program [arguments...]
>>     Linux CPU emulator (compiled for sh4eb emulation)
>>
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>> ---
>>  arch_init.c           |  2 +-
>>  bsd-user/main.c       |  6 +++---
>>  configure             | 25 +++++++++++++++----------
>>  linux-user/main.c     |  6 +++---
>>  scripts/create_config | 13 ++++---------
>>  5 files changed, 26 insertions(+), 26 deletions(-)
>>
>> diff --git a/arch_init.c b/arch_init.c
>> index 49c5dc2..22fbe96 100644
>> --- a/arch_init.c
>> +++ b/arch_init.c
>> @@ -123,7 +123,7 @@ static struct defconfig_file {
>>      bool userconfig;
>>  } default_config_files[] = {
>>      { CONFIG_QEMU_CONFDIR "/qemu.conf",                   true },
>> -    { CONFIG_QEMU_CONFDIR "/target-" TARGET_ARCH ".conf", true },
>> +    { CONFIG_QEMU_CONFDIR "/target-" TARGET_NAME ".conf", true },
>>      { NULL }, /* end of list */
> 
> I note this changes user-visible behaviour since we're now
> looking for different config files. Doesn't this need to be
> documented somewhere? Or is it that we can get away with making
> the change because it is undocumented?

I don't think that is documented, but I can check.  The patch needs a
respin anyway on top of Alon's systemtap patch (semantic conflict).

>> --- a/scripts/create_config
>> +++ b/scripts/create_config
>> @@ -70,16 +70,10 @@ case $line in
>>      value=${line#*=}
>>      echo "#define $name $value"
>>      ;;
>> - TARGET_ARCH=*) # configuration
>> -    target_arch=${line#*=}
>> -    echo "#define TARGET_ARCH \"$target_arch\""
>> -    ;;
>>   TARGET_BASE_ARCH=*) # configuration
>>      target_base_arch=${line#*=}
>> -    if [ "$target_base_arch" != "$target_arch" ]; then
>> -      base_arch_name=`echo $target_base_arch | LC_ALL=C tr '[a-z]' '[A-Z]'`
>> -      echo "#define TARGET_$base_arch_name 1"
>> -    fi
>> +    base_arch_name=`echo $target_base_arch | LC_ALL=C tr '[a-z]' '[A-Z]'`
>> +    echo "#define TARGET_$base_arch_name 1"
>>      ;;
> 
> This change means that (eg) arm-softmmu/config-target.h now has
> two lines "#define TARGET_ARM 1", once because config-target.mak
> has TARGET_ARM=y and once becgaues of TARGET_BASE_ARCH=arm.
> I guess that's just cosmetic though.

Yes.

Paolo
diff mbox

Patch

diff --git a/arch_init.c b/arch_init.c
index 49c5dc2..22fbe96 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -123,7 +123,7 @@  static struct defconfig_file {
     bool userconfig;
 } default_config_files[] = {
     { CONFIG_QEMU_CONFDIR "/qemu.conf",                   true },
-    { CONFIG_QEMU_CONFDIR "/target-" TARGET_ARCH ".conf", true },
+    { CONFIG_QEMU_CONFDIR "/target-" TARGET_NAME ".conf", true },
     { NULL }, /* end of list */
 };
 
diff --git a/bsd-user/main.c b/bsd-user/main.c
index 0da3ab9..572f13a 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -670,8 +670,8 @@  void cpu_loop(CPUSPARCState *env)
 
 static void usage(void)
 {
-    printf("qemu-" TARGET_ARCH " version " QEMU_VERSION ", Copyright (c) 2003-2008 Fabrice Bellard\n"
-           "usage: qemu-" TARGET_ARCH " [options] program [arguments...]\n"
+    printf("qemu-" TARGET_NAME " version " QEMU_VERSION ", Copyright (c) 2003-2008 Fabrice Bellard\n"
+           "usage: qemu-" TARGET_NAME " [options] program [arguments...]\n"
            "BSD CPU emulator (compiled for %s emulation)\n"
            "\n"
            "Standard options:\n"
@@ -706,7 +706,7 @@  static void usage(void)
            "Note that if you provide several changes to single variable\n"
            "last change will stay in effect.\n"
            ,
-           TARGET_ARCH,
+           TARGET_NAME,
            interp_prefix,
            x86_stack_size);
     exit(1);
diff --git a/configure b/configure
index d2c234e..bbafbac 100755
--- a/configure
+++ b/configure
@@ -4302,7 +4311,6 @@  upper() {
     echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]'
 }
 
-echo "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak
 target_arch_name="`upper $TARGET_ARCH`"
 echo "TARGET_$target_arch_name=y" >> $config_target_mak
 echo "TARGET_NAME=$target_name" >> $config_target_mak
diff --git a/linux-user/main.c b/linux-user/main.c
index b97b8cf..21725a4 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -3339,7 +3339,7 @@  static void handle_arg_strace(const char *arg)
 
 static void handle_arg_version(const char *arg)
 {
-    printf("qemu-" TARGET_ARCH " version " QEMU_VERSION QEMU_PKGVERSION
+    printf("qemu-" TARGET_NAME " version " QEMU_VERSION QEMU_PKGVERSION
            ", Copyright (c) 2003-2008 Fabrice Bellard\n");
     exit(0);
 }
@@ -3400,8 +3400,8 @@  static void usage(void)
     int maxarglen;
     int maxenvlen;
 
-    printf("usage: qemu-" TARGET_ARCH " [options] program [arguments...]\n"
-           "Linux CPU emulator (compiled for " TARGET_ARCH " emulation)\n"
+    printf("usage: qemu-" TARGET_NAME " [options] program [arguments...]\n"
+           "Linux CPU emulator (compiled for " TARGET_NAME " emulation)\n"
            "\n"
            "Options and associated environment variables:\n"
            "\n");
diff --git a/scripts/create_config b/scripts/create_config
index e52cca1..d776927 100755
--- a/scripts/create_config
+++ b/scripts/create_config
@@ -70,16 +70,10 @@  case $line in
     value=${line#*=}
     echo "#define $name $value"
     ;;
- TARGET_ARCH=*) # configuration
-    target_arch=${line#*=}
-    echo "#define TARGET_ARCH \"$target_arch\""
-    ;;
  TARGET_BASE_ARCH=*) # configuration
     target_base_arch=${line#*=}
-    if [ "$target_base_arch" != "$target_arch" ]; then
-      base_arch_name=`echo $target_base_arch | LC_ALL=C tr '[a-z]' '[A-Z]'`
-      echo "#define TARGET_$base_arch_name 1"
-    fi
+    base_arch_name=`echo $target_base_arch | LC_ALL=C tr '[a-z]' '[A-Z]'`
+    echo "#define TARGET_$base_arch_name 1"
     ;;
  TARGET_XML_FILES=*)
     # do nothing
@@ -88,7 +82,8 @@  case $line in
     # do nothing
     ;;
  TARGET_NAME=*)
-    # do nothing
+    target_name=${line#*=}
+    echo "#define TARGET_NAME \"$target_name\""
     ;;
  TARGET_DIRS=*)
     # do nothing