aboutsummaryrefslogtreecommitdiff
path: root/kvm/user/Makefile
blob: 625f0b49e3a0d326ee9733e5ea8ecc712e362bd5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
include config.mak

CFLAGS = -I $(KERNELDIR)/include $(autodepend-flags) -g
CXXFLAGS = $(autodepend-flags) 

autodepend-flags = -MMD -MF $(dir $*).$(notdir $*).d

DESTDIR = 

ifeq ($(shell uname -m), x86_64)
LIBDIR = /lib64
else
LIBDIR = /lib
endif

all: kvmctl libkvm.a

kvmctl: kvmctl.o main.o

libkvm.a: kvmctl.o
	$(AR) rcs $@ $^

flatfiles: test/simple.flat test/stringio.flat test/memtest1.flat \
	test/irq.flat test/sieve.flat test/bootstrap \
	test/access.flat

install:
	install -D kvmctl.h $(DESTDIR)/$(PREFIX)/include/kvmctl.h
	install -D $(KERNELDIR)/include/linux/kvm.h \
		$(DESTDIR)/$(PREFIX)/include/linux/kvm.h
	install -D libkvm.a $(DESTDIR)/$(PREFIX)/$(LIBDIR)/libkvm.a

%.flat: %.o
	gcc -nostdlib -o $@ -Wl,-T,flat.lds $^

test/bootstrap: test/bootstrap.o
	gcc -nostdlib -o $@ -Wl,-T,bootstrap.lds $^

%.o: %.S
	gcc -c -nostdlib -o $@ $^

test/irq.flat: test/print.o

test/access.flat: test/cstart64.o test/access.o test/printf.o test/print.o

test/sieve.flat: test/cstart64.o test/sieve.o test/print.o test/vm.o

test/test32.flat: test/test32.o

test/%.o: CFLAGS += -std=gnu99 -ffreestanding

-include .*.d

clean:
	$(RM) kvmctl *.o *.a .*.d
	$(RM) test/bootstrap test/*.o test/*.flat test/.*.d