diff options
author | Avi Kivity <avi@redhat.com> | 2008-10-30 12:58:12 +0200 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2008-10-30 12:58:12 +0200 |
commit | 020e1c16434162fc3901da47369aec5bb04b286f (patch) | |
tree | b1c12f187bfa99853e54965def48325cc07ffbab | |
parent | 1a66b27db80f98f1dcd1e2b859af00b9ce7709a6 (diff) |
kvm: external module: dynamic unifdefkvm-78
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 <avi@redhat.com>
-rw-r--r-- | kvm/kernel/Makefile | 5 | ||||
-rw-r--r-- | kvm/kernel/unifdef.h | 28 |
2 files changed, 29 insertions, 4 deletions
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 |