config-x86-common.mak 3.56 KB
Newer Older
1
2
3
4
#This is a make file with common rules for both x86 & x86-64

all: test_cases

Andrew Jones's avatar
Andrew Jones committed
5
6
cflatobjs += lib/x86/io.o
cflatobjs += lib/x86/smp.o
Gleb Natapov's avatar
Gleb Natapov committed
7
cflatobjs += lib/x86/vm.o
8
9
cflatobjs += lib/x86/fwcfg.o
cflatobjs += lib/x86/apic.o
Jason Wang's avatar
Jason Wang committed
10
cflatobjs += lib/x86/atomic.o
Gleb Natapov's avatar
Gleb Natapov committed
11
cflatobjs += lib/x86/desc.o
12
cflatobjs += lib/x86/isr.o
13
cflatobjs += lib/x86/pci.o
14
15
16
17
18

$(libcflat): LDFLAGS += -nostdlib
$(libcflat): CFLAGS += -ffreestanding -I lib

CFLAGS += -m$(bits)
Andrew Jones's avatar
Andrew Jones committed
19
CFLAGS += -O1
20
21
22
23

libgcc := $(shell $(CC) -m$(bits) --print-libgcc-file-name)

FLATLIBS = lib/libcflat.a $(libgcc)
Andrew Jones's avatar
Andrew Jones committed
24
25
%.elf: %.o $(FLATLIBS) x86/flat.lds
	$(CC) $(CFLAGS) -nostdlib -o $@ -Wl,-T,x86/flat.lds \
Andrew Jones's avatar
Andrew Jones committed
26
		$(filter %.o, $^) $(FLATLIBS)
27

28
%.flat: %.elf
Andrew Jones's avatar
Andrew Jones committed
29
	$(OBJCOPY) -O elf32-i386 $^ $@
30

31
32
33
tests-common = $(TEST_DIR)/vmexit.flat $(TEST_DIR)/tsc.flat \
               $(TEST_DIR)/smptest.flat  $(TEST_DIR)/port80.flat \
               $(TEST_DIR)/realmode.flat $(TEST_DIR)/msr.flat \
Jason Wang's avatar
Jason Wang committed
34
               $(TEST_DIR)/hypercall.flat $(TEST_DIR)/sieve.flat \
35
               $(TEST_DIR)/kvmclock_test.flat  $(TEST_DIR)/eventinj.flat \
36
               $(TEST_DIR)/s3.flat $(TEST_DIR)/pmu.flat \
Paolo Bonzini's avatar
Paolo Bonzini committed
37
               $(TEST_DIR)/tsc_adjust.flat $(TEST_DIR)/asyncpf.flat \
Paolo Bonzini's avatar
Paolo Bonzini committed
38
               $(TEST_DIR)/init.flat $(TEST_DIR)/smap.flat
39

40
ifdef API
41
tests-common += api/api-sample
Avi Kivity's avatar
Avi Kivity committed
42
tests-common += api/dirty-log
43
tests-common += api/dirty-log-perf
44
endif
45

46
47
48
49
50
tests_and_config = $(TEST_DIR)/*.flat $(TEST_DIR)/unittests.cfg

test_cases: $(tests-common) $(tests)

$(TEST_DIR)/%.o: CFLAGS += -std=gnu99 -ffreestanding -I lib -I lib/x86
Jason Wang's avatar
Jason Wang committed
51

52
$(TEST_DIR)/access.elf: $(cstart.o) $(TEST_DIR)/access.o
Jason Wang's avatar
Jason Wang committed
53

54
$(TEST_DIR)/hypercall.elf: $(cstart.o) $(TEST_DIR)/hypercall.o
Jason Wang's avatar
Jason Wang committed
55

Gleb Natapov's avatar
Gleb Natapov committed
56
$(TEST_DIR)/sieve.elf: $(cstart.o) $(TEST_DIR)/sieve.o
Jason Wang's avatar
Jason Wang committed
57

58
$(TEST_DIR)/vmexit.elf: $(cstart.o) $(TEST_DIR)/vmexit.o
Jason Wang's avatar
Jason Wang committed
59

60
$(TEST_DIR)/smptest.elf: $(cstart.o) $(TEST_DIR)/smptest.o
Jason Wang's avatar
Jason Wang committed
61

Gleb Natapov's avatar
Gleb Natapov committed
62
$(TEST_DIR)/emulator.elf: $(cstart.o) $(TEST_DIR)/emulator.o
63

64
$(TEST_DIR)/port80.elf: $(cstart.o) $(TEST_DIR)/port80.o
65

66
$(TEST_DIR)/tsc.elf: $(cstart.o) $(TEST_DIR)/tsc.o
67

68
69
$(TEST_DIR)/tsc_adjust.elf: $(cstart.o) $(TEST_DIR)/tsc_adjust.o

Gleb Natapov's avatar
Gleb Natapov committed
70
$(TEST_DIR)/apic.elf: $(cstart.o) $(TEST_DIR)/apic.o
71

Paolo Bonzini's avatar
Paolo Bonzini committed
72
73
$(TEST_DIR)/init.elf: $(cstart.o) $(TEST_DIR)/init.o

74
$(TEST_DIR)/realmode.elf: $(TEST_DIR)/realmode.o
75
76
77
78
	$(CC) -m32 -nostdlib -o $@ -Wl,-T,$(TEST_DIR)/realmode.lds $^

$(TEST_DIR)/realmode.o: bits = 32

79
$(TEST_DIR)/msr.elf: $(cstart.o) $(TEST_DIR)/msr.o
80

Gleb Natapov's avatar
Gleb Natapov committed
81
$(TEST_DIR)/idt_test.elf: $(cstart.o) $(TEST_DIR)/idt_test.o
82

Gleb Natapov's avatar
Gleb Natapov committed
83
$(TEST_DIR)/xsave.elf: $(cstart.o) $(TEST_DIR)/xsave.o
84

Gleb Natapov's avatar
Gleb Natapov committed
85
$(TEST_DIR)/rmap_chain.elf: $(cstart.o) $(TEST_DIR)/rmap_chain.o
86

Jan Kiszka's avatar
Jan Kiszka committed
87
$(TEST_DIR)/svm.elf: $(cstart.o) $(TEST_DIR)/svm.o
88

89
$(TEST_DIR)/kvmclock_test.elf: $(cstart.o) $(TEST_DIR)/kvmclock.o \
Jason Wang's avatar
Jason Wang committed
90
91
                                $(TEST_DIR)/kvmclock_test.o

Gleb Natapov's avatar
Gleb Natapov committed
92
93
$(TEST_DIR)/eventinj.elf: $(cstart.o) $(TEST_DIR)/eventinj.o

94
95
$(TEST_DIR)/s3.elf: $(cstart.o) $(TEST_DIR)/s3.o

Gleb Natapov's avatar
Gleb Natapov committed
96
97
$(TEST_DIR)/pmu.elf: $(cstart.o) $(TEST_DIR)/pmu.o

Gleb Natapov's avatar
Gleb Natapov committed
98
99
$(TEST_DIR)/asyncpf.elf: $(cstart.o) $(TEST_DIR)/asyncpf.o

Mao, Junjie's avatar
Mao, Junjie committed
100
101
$(TEST_DIR)/pcid.elf: $(cstart.o) $(TEST_DIR)/pcid.o

Paolo Bonzini's avatar
Paolo Bonzini committed
102
103
$(TEST_DIR)/smap.elf: $(cstart.o) $(TEST_DIR)/smap.o

104
$(TEST_DIR)/vmx.elf: $(cstart.o) $(TEST_DIR)/vmx.o $(TEST_DIR)/vmx_tests.o
105

Jan Kiszka's avatar
Jan Kiszka committed
106
107
$(TEST_DIR)/debug.elf: $(cstart.o) $(TEST_DIR)/debug.o

108
arch_clean:
109
	$(RM) $(TEST_DIR)/*.o $(TEST_DIR)/*.flat $(TEST_DIR)/*.elf \
Andrew Jones's avatar
Andrew Jones committed
110
	$(TEST_DIR)/.*.d lib/x86/.*.d
111

112
api/%.o: CFLAGS += -m32
113

114
api/%: LDLIBS += -lstdc++ -lboost_thread-mt -lpthread -lrt
115
api/%: LDFLAGS += -m32
116

117
118
119
api/libapi.a: api/kvmxx.o api/identity.o api/exception.o api/memmap.o
	$(AR) rcs $@ $^

Avi Kivity's avatar
Avi Kivity committed
120
121
122
api/api-sample: api/api-sample.o api/libapi.a

api/dirty-log: api/dirty-log.o api/libapi.a
123
124

api/dirty-log-perf: api/dirty-log-perf.o api/libapi.a