simplify TARGET_BASE_ARCH generation
authorJuan Quintela <quintela@redhat.com>
Thu, 16 Jul 2009 16:34:15 +0000 (18:34 +0200)
committerAnthony Liguori <aliguori@us.ibm.com>
Thu, 16 Jul 2009 22:28:57 +0000 (17:28 -0500)
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

Makefile.target
configure

index 6883c44..7e69a64 100644 (file)
@@ -1,10 +1,6 @@
 include config.mak
 include $(SRC_PATH)/rules.mak
 
-ifndef TARGET_BASE_ARCH
-TARGET_BASE_ARCH:=$(TARGET_ARCH)
-endif
-
 TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
 VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw
 CPPFLAGS=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH) -MMD -MT $@ -MP -DNEED_CPU_H
index e3ddfbc..c3b2cff 100755 (executable)
--- a/configure
+++ b/configure
@@ -1892,14 +1892,14 @@ echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
 gdb_xml_files=""
 
 TARGET_ARCH="$target_arch2"
+TARGET_BASE_ARCH=""
 
 case "$target_arch2" in
   i386)
     target_phys_bits=32
   ;;
   x86_64)
-    echo "TARGET_BASE_ARCH=i386" >> $config_mak
-    echo "#define TARGET_I386 1" >> $config_h
+    TARGET_BASE_ARCH=i386
     target_phys_bits=64
   ;;
   alpha)
@@ -1937,16 +1937,14 @@ case "$target_arch2" in
   mipsn32|mipsn32el)
     TARGET_ARCH=mipsn32
     echo "TARGET_ARCH2=$target_arch2" >> $config_mak
-    echo "TARGET_BASE_ARCH=mips" >> $config_mak
-    echo "#define TARGET_MIPS 1" >> $config_h
+    TARGET_BASE_ARCH=mips
     echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
     target_phys_bits=64
   ;;
   mips64|mips64el)
     TARGET_ARCH=mips64
     echo "TARGET_ARCH2=$target_arch2" >> $config_mak
-    echo "TARGET_BASE_ARCH=mips" >> $config_mak
-    echo "#define TARGET_MIPS 1" >> $config_h
+    TARGET_BASE_ARCH=mips
     echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
     target_phys_bits=64
   ;;
@@ -1955,25 +1953,22 @@ case "$target_arch2" in
     target_phys_bits=32
   ;;
   ppcemb)
-    echo "TARGET_BASE_ARCH=ppc" >> $config_mak
+    TARGET_BASE_ARCH=ppc
     echo "TARGET_ABI_DIR=ppc" >> $config_mak
-    echo "#define TARGET_PPC 1" >> $config_h
     gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
     target_phys_bits=64
   ;;
   ppc64)
-    echo "TARGET_BASE_ARCH=ppc" >> $config_mak
+    TARGET_BASE_ARCH=ppc
     echo "TARGET_ABI_DIR=ppc" >> $config_mak
-    echo "#define TARGET_PPC 1" >> $config_h
     gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
     target_phys_bits=64
   ;;
   ppc64abi32)
     TARGET_ARCH=ppc64
-    echo "TARGET_BASE_ARCH=ppc" >> $config_mak
+    TARGET_BASE_ARCH=ppc
     echo "TARGET_ABI_DIR=ppc" >> $config_mak
     echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
-    echo "#define TARGET_PPC 1" >> $config_h
     echo "#define TARGET_ABI32 1" >> $config_h
     gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
     target_phys_bits=64
@@ -1989,17 +1984,15 @@ case "$target_arch2" in
     target_phys_bits=64
   ;;
   sparc64)
-    echo "TARGET_BASE_ARCH=sparc" >> $config_mak
-    echo "#define TARGET_SPARC 1" >> $config_h
+    TARGET_BASE_ARCH=sparc
     elfload32="yes"
     target_phys_bits=64
   ;;
   sparc32plus)
     TARGET_ARCH=sparc64
-    echo "TARGET_BASE_ARCH=sparc" >> $config_mak
+    TARGET_BASE_ARCH=sparc
     echo "TARGET_ABI_DIR=sparc" >> $config_mak
     echo "TARGET_ARCH2=$target_arch2" >> $config_mak
-    echo "#define TARGET_SPARC 1" >> $config_h
     echo "#define TARGET_ABI32 1" >> $config_h
     target_phys_bits=64
   ;;
@@ -2012,7 +2005,13 @@ echo "TARGET_ARCH=$TARGET_ARCH" >> $config_mak
 echo "#define TARGET_ARCH \"$TARGET_ARCH\"" >> $config_h
 target_arch_name=`echo $TARGET_ARCH | tr '[:lower:]' '[:upper:]'`
 echo "#define TARGET_$target_arch_name 1" >> $config_h
-
+if [ "$TARGET_BASE_ARCH" = "" ]; then
+  TARGET_BASE_ARCH=$TARGET_ARCH
+else
+  target_base_arch_name=`echo $TARGET_BASE_ARCH | tr '[:lower:]' '[:upper:]'`
+  echo "#define TARGET_$target_base_arch_name 1" >> $config_h
+fi
+echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_mak
 if [ $target_phys_bits -lt $hostlongbits ] ; then
   target_phys_bits=$hostlongbits
 fi