From 42bc608b2a144dfa5141dd6ba5d12cb97ac804a7 Mon Sep 17 00:00:00 2001 From: Juan Quintela Date: Thu, 16 Jul 2009 18:34:20 +0200 Subject: [PATCH] Generate $target_dir/config.h from $target_dir/config.mak Signed-off-by: Juan Quintela Signed-off-by: Anthony Liguori --- configure | 42 ++++++++++++------------------------------ create_config | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 30 deletions(-) create mode 100755 create_config diff --git a/configure b/configure index d3d4cd5..2a6ae40 100755 --- a/configure +++ b/configure @@ -1877,17 +1877,14 @@ ln -s $source_path/Makefile.target $target_dir/Makefile echo "# Automatically generated by configure - do not modify" > $config_mak -echo "/* Automatically generated by configure - do not modify */" > $config_h - echo "include ../config-host.mak" >> $config_mak -echo "#include \"../config-host.h\"" >> $config_h bflt="no" elfload32="no" target_nptl="no" interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"` -echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h +echo "CONFIG_QEMU_PREFIX=\"$interp_prefix1\"" >> $config_mak gdb_xml_files="" TARGET_ARCH="$target_arch2" @@ -1928,20 +1925,20 @@ case "$target_arch2" in ;; mips|mipsel) TARGET_ARCH=mips - echo "#define TARGET_ABI_MIPSO32 1" >> $config_h + echo "TARGET_ABI_MIPSO32=y" >> $config_mak target_nptl="yes" target_phys_bits=64 ;; mipsn32|mipsn32el) TARGET_ARCH=mipsn32 TARGET_BASE_ARCH=mips - echo "#define TARGET_ABI_MIPSN32 1" >> $config_h + echo "TARGET_ABI_MIPSN32=y" >> $config_mak target_phys_bits=64 ;; mips64|mips64el) TARGET_ARCH=mips64 TARGET_BASE_ARCH=mips - echo "#define TARGET_ABI_MIPSN64 1" >> $config_h + echo "TARGET_ABI_MIPSN64=y" >> $config_mak target_phys_bits=64 ;; ppc) @@ -1964,7 +1961,7 @@ case "$target_arch2" in TARGET_ARCH=ppc64 TARGET_BASE_ARCH=ppc TARGET_ABI_DIR=ppc - echo "#define TARGET_ABI32 1" >> $config_h + echo "TARGET_ABI32=y" >> $config_mak gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml" target_phys_bits=64 ;; @@ -1986,7 +1983,7 @@ case "$target_arch2" in TARGET_ARCH=sparc64 TARGET_BASE_ARCH=sparc TARGET_ABI_DIR=sparc - echo "#define TARGET_ABI32 1" >> $config_h + echo "TARGET_ABI32=y" >> $config_mak target_phys_bits=64 ;; *) @@ -1996,14 +1993,9 @@ case "$target_arch2" in esac echo "TARGET_ARCH=$TARGET_ARCH" >> $config_mak echo "TARGET_ARCH2=$target_arch2" >> $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 +# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH 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_ABI_DIR" = "" ]; then @@ -2017,12 +2009,10 @@ case "$target_arch2" in i386|x86_64) if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then echo "CONFIG_XEN=y" >> $config_mak - echo "#define CONFIG_XEN 1" >> $config_h fi if test $kqemu = "yes" -a "$target_softmmu" = "yes" then echo "CONFIG_KQEMU=y" >> $config_mak - echo "#define CONFIG_KQEMU 1" >> $config_h fi esac case "$target_arch2" in @@ -2035,31 +2025,25 @@ case "$target_arch2" in \( "$target_arch2" = "i386" -a "$cpu" = "x86_64" \) \) ; then echo "CONFIG_KVM=y" >> $config_mak echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak - echo "#define CONFIG_KVM 1" >> $config_h fi esac echo "HWLIB=../libhw$target_phys_bits/libqemuhw$target_phys_bits.a" >> $config_mak -echo "#define TARGET_PHYS_ADDR_BITS $target_phys_bits" >> $config_h +echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_mak echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak if test "$target_bigendian" = "yes" ; then - echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak - echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h + echo "TARGET_WORDS_BIGENDIAN=y" >> $config_mak fi if test "$target_softmmu" = "yes" ; then echo "CONFIG_SOFTMMU=y" >> $config_mak - echo "#define CONFIG_SOFTMMU 1" >> $config_h fi if test "$target_user_only" = "yes" ; then echo "CONFIG_USER_ONLY=y" >> $config_mak - echo "#define CONFIG_USER_ONLY 1" >> $config_h fi if test "$target_linux_user" = "yes" ; then echo "CONFIG_LINUX_USER=y" >> $config_mak - echo "#define CONFIG_LINUX_USER 1" >> $config_h fi if test "$target_darwin_user" = "yes" ; then echo "CONFIG_DARWIN_USER=y" >> $config_mak - echo "#define CONFIG_DARWIN_USER 1" >> $config_h fi list="" if test ! -z "$gdb_xml_files" ; then @@ -2072,28 +2056,26 @@ echo "TARGET_XML_FILES=$list" >> $config_mak case "$target_arch2" in arm|armeb|m68k|microblaze|mips|mipsel|mipsn32|mipsn32el|mips64|mips64el|ppc|ppc64|ppc64abi32|ppcemb|sparc|sparc64|sparc32plus) echo "CONFIG_SOFTFLOAT=y" >> $config_mak - echo "#define CONFIG_SOFTFLOAT 1" >> $config_h ;; esac if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then echo "TARGET_HAS_BFLT=y" >> $config_mak - echo "#define TARGET_HAS_BFLT 1" >> $config_h fi if test "$target_user_only" = "yes" \ -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then - echo "#define USE_NPTL 1" >> $config_h + echo "USE_NPTL=y" >> $config_mak fi # 32 bit ELF loader in addition to native 64 bit loader? if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then echo "TARGET_HAS_ELFLOAD32=y" >> $config_mak - echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h fi if test "$target_bsd_user" = "yes" ; then echo "CONFIG_BSD_USER=y" >> $config_mak - echo "#define CONFIG_BSD_USER 1" >> $config_h fi +$source_path/create_config < $config_mak > $config_h + test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h done # for target in $targets diff --git a/create_config b/create_config new file mode 100755 index 0000000..cac0edb --- /dev/null +++ b/create_config @@ -0,0 +1,55 @@ +#!/bin/sh + +echo "/* Automatically generated by configure - do not modify */" +echo "#include \"../config-host.h\"" + +while read line; do + +case $line in + CONFIG_*=y) # configuration + name=${line%=*} + echo "#define $name 1" + ;; + CONFIG_*=*) # configuration + name=${line%=*} + value=${line#*=} + echo "#define $name $value" + ;; + TARGET_ARCH=*) # configuration + target_arch=${line#*=} + arch_name=`echo $target_arch | tr '[:lower:]' '[:upper:]'` + echo "#define TARGET_ARCH \"$target_arch\"" + echo "#define TARGET_$arch_name 1" + ;; + TARGET_BASE_ARCH=*) # configuration + target_base_arch=${line#*=} + if [ "$target_base_arch" != "$target_arch" ]; then + base_arch_name=`echo $target_base_arch | tr '[:lower:]' '[:upper:]'` + echo "#define TARGET_$base_arch_name 1" + fi + ;; + TARGET_XML_FILES=*) + # do nothing + ;; + TARGET_ABI_DIR=*) + # do nothing + ;; + TARGET_ARCH2=*) + # do nothing + ;; + TARGET_*=y) # configuration + name=${line%=*} + echo "#define $name 1" + ;; + TARGET_*=*) # configuration + name=${line%=*} + value=${line#*=} + echo "#define $name $value" + ;; + USE_NPTL=y) # configuration + name=${line%=*} + echo "#define $name 1" + ;; +esac + +done # read -- 2.7.4