This patch moves make rules around to accommodate for powerpc or any
none x86 architecture. This patch also adds file
user/config-powerpc.mak. Also added $CROSS_COMPILE variable is added to
the config.mak generated to configure script.


Signed-off-by: Jerone Young <[EMAIL PROTECTED]>

diff --git a/user/Makefile b/user/Makefile
--- a/user/Makefile
+++ b/user/Makefile
@@ -15,8 +15,7 @@ cc-option = $(shell if $(CC) $(1) -S -o 
 cc-option = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null \
               > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
 
-CFLAGS += -I $(KERNELDIR)/include $(autodepend-flags) -g -fomit-frame-pointer \
-       -Wall
+CFLAGS += $(autodepend-flags) -g -fomit-frame-pointer -Wall 
 CFLAGS += $(call cc-option, -fno-stack-protector, "")
 CFLAGS += $(call cc-option, -fno-stack-protector-all, "")
 
@@ -26,16 +25,7 @@ CXXFLAGS = $(autodepend-flags)
 
 autodepend-flags = -MMD -MF $(dir $*).$(notdir $*).d
 
-all: kvmctl libkvm.a flatfiles
-
-kvmctl: LDFLAGS += -pthread -lrt
-
-kvmctl: kvmctl.o main.o
-
 balloon_ctl: balloon_ctl.o
-
-libkvm.a: kvmctl.o
-       $(AR) rcs $@ $^
 
 flatfiles-common = test/bootstrap test/vmexit.flat test/smp.flat
 
@@ -78,3 +68,4 @@ clean:
 clean:
        $(RM) kvmctl *.o *.a .*.d
        $(RM) test/bootstrap test/*.o test/*.flat test/.*.d
+       $(RM) test/powerpc/*.o test/powerpc/*.bin test/powerpc/*.elf
diff --git a/user/config-i386.mak b/user/config-i386.mak
--- a/user/config-i386.mak
+++ b/user/config-i386.mak
@@ -3,5 +3,14 @@ bits = 32
 bits = 32
 ldarch = elf32-i386
 CFLAGS += -m32
+CFLAGS += -I $(KERNELDIR)/include
+CFLAGS += -D__i386__
 
 flatfiles=
+
+all: kvmctl libkvm.a flatfiles
+kvmctl: LDFLAGS += -pthread -lrt
+kvmctl: kvmctl-x86.o main-x86.o
+       $(CC) -o $@ $(LDFLAGS) $^ $(LDLIBS)
+libkvm.a: kvmctl-x86.o
+       $(AR) rcs $@ $^
diff --git a/user/config-powerpc.mak b/user/config-powerpc.mak
new file mode 100644
--- /dev/null
+++ b/user/config-powerpc.mak
@@ -0,0 +1,32 @@
+LIBDIR = /lib
+cstart.o = test/cstart.o
+bits = 32
+ldarch = elf32-powerpc
+CFLAGS += -m32
+CFLAGS += -D__powerpc__
+
+# for some reaons binutils hates tlbsx unless we say we're 405
+CFLAGS := -mregnames -Wa,-m405
+
+TEST_DIR=test/powerpc
+
+all: kvmctl libkvm.a tests
+kvmctl: LDFLAGS += -pthread -lrt
+kvmctl: kvmctl-powerpc.o main-powerpc.o
+       $(CC) -o $@ $(LDFLAGS) $^ $(LDLIBS)
+libkvm.a: kvmctl-powerpc.o
+       $(AR) rcs $@ $^
+
+tests:  $(TEST_DIR)/spin.bin \
+       $(TEST_DIR)/sprg.bin \
+       $(TEST_DIR)/io.bin \
+       $(TEST_DIR)/tlbsx.bin \
+       $(TEST_DIR)/tlbwe.bin \
+       $(TEST_DIR)/tlbwe_16KB.bin \
+       $(TEST_DIR)/tlbwe_hole.bin
+
+%.elf: %.o
+       $(CC) -nostdlib $^ -o $@
+
+%.bin: %.elf
+       $(CROSS_COMPILE)objcopy -O binary $^ $@ 
diff --git a/user/config-x86_64.mak b/user/config-x86_64.mak
--- a/user/config-x86_64.mak
+++ b/user/config-x86_64.mak
@@ -3,5 +3,14 @@ bits = 64
 bits = 64
 ldarch = elf64-x86-64
 CFLAGS += -m64
+CFLAGS += -I $(KERNELDIR)/include
+CFLAGS += -D__x86_64__
 
 flatfiles = test/access.flat test/irq.flat test/sieve.flat test/simple.flat 
test/stringio.flat test/memtest1.flat
+
+all: kvmctl libkvm.a flatfiles
+kvmctl: LDFLAGS += -pthread -lrt
+kvmctl: kvmctl-x86.o main-x86.o
+       $(CC) -o $@ $(LDFLAGS) $^ $(LDLIBS)
+libkvm.a: kvmctl-x86.o
+       $(AR) rcs $@ $^
diff --git a/user/configure b/user/configure
--- a/user/configure
+++ b/user/configure
@@ -63,4 +63,5 @@ ARCH=$arch
 ARCH=$arch
 CC=$cross_prefix$cc
 LD=$cross_prefix$ld
+CROSS_COMPILE=$cross_prefix
 EOF



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel

Reply via email to