From 020e1c16434162fc3901da47369aec5bb04b286f Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Thu, 30 Oct 2008 12:58:12 +0200 Subject: kvm: external module: dynamic unifdef The current unifdef solution mangles the source files to fit just one architecture; this causes problem shipping one source tarball for many consumers on different architectures. Change to a dynamic model. Instead of removing ifdefs, figure out which symbols are defined on which architecture, and define them appropriately. Signed-off-by: Avi Kivity --- kvm/kernel/Makefile | 5 +---- kvm/kernel/unifdef.h | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 kvm/kernel/unifdef.h diff --git a/kvm/kernel/Makefile b/kvm/kernel/Makefile index c905bdaca..aca365e12 100644 --- a/kvm/kernel/Makefile +++ b/kvm/kernel/Makefile @@ -25,10 +25,7 @@ _hack = mv $1 $1.orig && \ gawk -v version=$(version) -f $(ARCH_DIR)/hack-module.awk $1.orig \ | sed '/\#include/! s/\blapic\b/l_apic/g' > $1 && rm $1.orig -unifdef_uflags = $(foreach arch, $(NONARCH_CONFIG), -UCONFIG_$(arch)) -unifdef = mv $1 $1.orig && \ - unifdef -DCONFIG_$(ARCH_CONFIG) $(unifdef_uflags) $1.orig > $1; \ - [ $$? -le 2 ] && rm $1.orig +unifdef = mv $1 $1.orig && cat unifdef.h $1.orig > $1 && rm $1.orig hack = $(call _hack,$T/$(strip $1)) diff --git a/kvm/kernel/unifdef.h b/kvm/kernel/unifdef.h new file mode 100644 index 000000000..ec7744156 --- /dev/null +++ b/kvm/kernel/unifdef.h @@ -0,0 +1,28 @@ +#ifndef KVM_UNIFDEF_H +#define KVM_UNIFDEF_H + +#ifdef __i386__ +#ifndef CONFIG_X86_32 +#define CONFIG_X86_32 1 +#endif +#endif + +#ifdef __x86_64__ +#ifndef CONFIG_X86_64 +#define CONFIG_X86_64 1 +#endif +#endif + +#if defined(__i386__) || defined (__x86_64__) +#ifndef CONFIG_X86 +#define CONFIG_X86 1 +#endif +#endif + +#ifdef __ia64__ +#ifndef CONFIG_IA64 +#define CONFIG_IA64 1 +#endif +#endif + +#endif -- cgit v1.2.3