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 | 12114c2e71f52de03db2e7108a72cdcf664deb34 (patch) | |
tree | af4a1657c45e8f8618359b7262f69e4cf74460ec /kernel | |
parent | 78f7f17b82c42a6e8f2bdf9e6fc748ef93c80cb7 (diff) |
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 <avi@redhat.com>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/Makefile | 5 | ||||
-rw-r--r-- | kernel/unifdef.h | 28 |
2 files changed, 29 insertions, 4 deletions
diff --git a/kernel/Makefile b/kernel/Makefile index c905bdac..aca365e1 100644 --- a/kernel/Makefile +++ b/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/kernel/unifdef.h b/kernel/unifdef.h new file mode 100644 index 00000000..ec774415 --- /dev/null +++ b/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 |