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
58
59
60
61
62
63
64
65
66
67
68
69
70
|
verbose ?= n
debug ?= n
debugger ?= n
perfc ?= n
trace ?= n
optimize ?= y
# Currently supported architectures:
# {COMPILE,TARGET}_ARCH := x86
# {COMPILE,TARGET}_SUBARCH := x86_32 | x86_64
COMPILE_ARCH := x86
COMPILE_SUBARCH := $(shell uname -m | sed -e s/i.86/x86_32/)
TARGET_ARCH ?= $(COMPILE_ARCH)
TARGET_SUBARCH ?= $(COMPILE_SUBARCH)
TARGET := $(BASEDIR)/xen
HDRS := $(wildcard $(BASEDIR)/include/xen/*.h)
HDRS += $(wildcard $(BASEDIR)/include/scsi/*.h)
HDRS += $(wildcard $(BASEDIR)/include/public/*.h)
HDRS += $(wildcard $(BASEDIR)/include/asm-$(TARGET_ARCH)/*.h)
HDRS += $(wildcard $(BASEDIR)/include/asm-$(TARGET_ARCH)/$(TARGET_SUBARCH)/*.h)
# compile.h is always regenerated, but other files shouldn't be rebuilt
HDRS := $(subst $(BASEDIR)/include/xen/compile.h,,$(HDRS))
C_SRCS := $(wildcard *.c)
S_SRCS := $(wildcard *.S)
OBJS := $(patsubst %.S,%.o,$(S_SRCS))
OBJS += $(patsubst %.c,%.o,$(C_SRCS))
# Note that link order matters!
ALL_OBJS := $(BASEDIR)/common/common.o
ALL_OBJS += $(BASEDIR)/drivers/char/driver.o
ALL_OBJS += $(BASEDIR)/drivers/acpi/driver.o
ALL_OBJS += $(BASEDIR)/drivers/pci/driver.o
ALL_OBJS += $(BASEDIR)/arch/$(TARGET_ARCH)/arch.o
HOSTCC = gcc
HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
include $(BASEDIR)/arch/$(TARGET_ARCH)/Rules.mk
ifneq ($(debug),y)
CFLAGS += -DNDEBUG
ifeq ($(verbose),y)
CFLAGS += -DVERBOSE
endif
else
CFLAGS += -DVERBOSE
endif
ifeq ($(debugger),y)
CFLAGS += -DXEN_DEBUGGER
endif
ifeq ($(perfc),y)
CFLAGS += -DPERF_COUNTERS
endif
ifeq ($(trace),y)
CFLAGS += -DTRACE_BUFFER
endif
%.o: %.c $(HDRS) Makefile
$(CC) $(CFLAGS) -c $< -o $@
%.o: %.S $(HDRS) Makefile
$(CC) $(CFLAGS) -D__ASSEMBLY__ -c $< -o $@
|