[PATCH 2 of 4] Add Makefile and test changes required for x86 to use libcflat

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



6 files changed, 25 insertions(+), 15 deletions(-)
user/Makefile              |   11 ++++++++++-
user/config-x86-common.mak |   16 ++++++++++------
user/main.c                |    2 +-
user/test/x86/port80.c     |    3 +--
user/test/x86/smptest.c    |    5 ++---
user/test/x86/tsc.c        |    3 +--


Signed-off-by: Jerone Young <jyoung5@xxxxxxxxxx>

diff --git a/user/Makefile b/user/Makefile
--- a/user/Makefile
+++ b/user/Makefile
@@ -9,6 +9,12 @@
 CFLAGS =
 
 libgcc := $(shell $(CC) --print-libgcc-file-name)
+
+libcflat := test/lib/libcflat.a
+cflatobjs := \
+	test/lib/panic.o \
+	test/lib/printf.o \
+	test/lib/string.o
 
 #include architecure specific make rules
 include config-$(ARCH).mak
@@ -41,10 +47,13 @@
 kvmtrace: $(kvmtrace_objs)
 	$(CC) $(LDFLAGS) $^ -o $@
 
+$(libcflat): $(cflatobjs)
+	ar rcs $@ $^
+
 %.o: %.S
 	$(CC) $(CFLAGS) -c -nostdlib -o $@ $^
 
 -include .*.d
 
 clean: arch_clean
-	$(RM) kvmctl kvmtrace *.o *.a .*.d
+	$(RM) kvmctl kvmtrace *.o *.a .*.d $(libcflat) $(cflatobjs)
diff --git a/user/config-x86-common.mak b/user/config-x86-common.mak
--- a/user/config-x86-common.mak
+++ b/user/config-x86-common.mak
@@ -5,7 +5,15 @@
 kvmctl_objs= main.o iotable.o ../libkvm/libkvm.a
 balloon_ctl: balloon_ctl.o
 
-FLATLIBS = $(TEST_DIR)/libcflat.a $(libgcc)
+cflatobjs += \
+	test/lib/x86/io.o \
+	test/lib/x86/smp.o
+
+$(libcflat): LDFLAGS += -nostdlib
+$(libcflat): CFLAGS += -ffreestanding -I test/lib
+
+
+FLATLIBS = test/lib/libcflat.a $(libgcc)
 %.flat: %.o $(FLATLIBS)
 	$(CC) $(CFLAGS) -nostdlib -o $@ -Wl,-T,flat.lds $^ $(FLATLIBS)
 
@@ -15,7 +23,7 @@
 
 test_cases: $(tests-common) $(tests)
 
-$(TEST_DIR)/%.o: CFLAGS += -std=gnu99 -ffreestanding -I$(TEST_DIR)/lib
+$(TEST_DIR)/%.o: CFLAGS += -std=gnu99 -ffreestanding -I test/lib -I test/lib/x86
  
 $(TEST_DIR)/bootstrap: $(TEST_DIR)/bootstrap.o
 	$(CC) -nostdlib -o $@ -Wl,-T,bootstrap.lds $^
@@ -41,10 +49,6 @@
 
 $(TEST_DIR)/tsc.flat: $(cstart.o) $(TEST_DIR)/tsc.o
 
-$(TEST_DIR)/libcflat.a: $(TEST_DIR)/lib/exit.o $(TEST_DIR)/lib/printf.o \
-	$(TEST_DIR)/lib/smp.o $(TEST_DIR)/lib/string.o
-	ar rcs $@ $^
-
 arch_clean:
 	$(RM) $(TEST_DIR)/bootstrap $(TEST_DIR)/*.o $(TEST_DIR)/*.flat \
 	$(TEST_DIR)/.*.d $(TEST_DIR)/lib/.*.d $(TEST_DIR)/lib/*.o
diff --git a/user/main.c b/user/main.c
--- a/user/main.c
+++ b/user/main.c
@@ -17,7 +17,7 @@
 #define _GNU_SOURCE
 
 #include <libkvm.h>
-#include "test/x86/lib/apic.h"
+#include "test/lib/x86/apic.h"
 #include "test/x86/ioram.h"
 
 #include <stdio.h>
diff --git a/user/test/x86/port80.c b/user/test/x86/port80.c
--- a/user/test/x86/port80.c
+++ b/user/test/x86/port80.c
@@ -1,5 +1,4 @@
-
-#include "printf.h"
+#include <libcflat.h>
 
 int main()
 {
diff --git a/user/test/x86/smptest.c b/user/test/x86/smptest.c
--- a/user/test/x86/smptest.c
+++ b/user/test/x86/smptest.c
@@ -1,6 +1,5 @@
-
-#include "smp.h"
-#include "printf.h"
+#include <libcflat.h>
+#include <smp.h>
 
 static void ipi_test(void *data)
 {
diff --git a/user/test/x86/tsc.c b/user/test/x86/tsc.c
--- a/user/test/x86/tsc.c
+++ b/user/test/x86/tsc.c
@@ -1,5 +1,4 @@
-
-#include "printf.h"
+#include <libcflat.h>
 
 typedef unsigned long long u64;
 
--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM Development]     [KVM ARM]     [KVM ia64]     [Linux Virtualization]     [Linux USB Devel]     [Linux Video]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux