1 | # |
---|
2 | # The file contains the common make rules for building mini-os. |
---|
3 | # |
---|
4 | |
---|
5 | debug = y |
---|
6 | |
---|
7 | # Define some default flags. |
---|
8 | # NB. '-Wcast-qual' is nasty, so I omitted it. |
---|
9 | DEF_CFLAGS := -fno-builtin -Wall -Werror -Wredundant-decls -Wno-format |
---|
10 | DEF_CFLAGS += -Wstrict-prototypes -Wnested-externs -Wpointer-arith -Winline |
---|
11 | DEF_CFLAGS += -D__XEN_INTERFACE_VERSION__=$(XEN_INTERFACE_VERSION) |
---|
12 | |
---|
13 | DEF_ASFLAGS = -D__ASSEMBLY__ |
---|
14 | DEF_LDFLAGS = |
---|
15 | |
---|
16 | ifeq ($(debug),y) |
---|
17 | DEF_CFLAGS += -g |
---|
18 | else |
---|
19 | DEF_CFLAGS += -O3 |
---|
20 | endif |
---|
21 | |
---|
22 | # Build the CFLAGS and ASFLAGS for compiling and assembling. |
---|
23 | # DEF_... flags are the common mini-os flags, |
---|
24 | # ARCH_... flags may be defined in arch/$(TARGET_ARCH_FAM/rules.mk |
---|
25 | CFLAGS := $(DEF_CFLAGS) $(ARCH_CFLAGS) |
---|
26 | ASFLAGS := $(DEF_ASFLAGS) $(ARCH_ASFLAGS) |
---|
27 | LDFLAGS := $(DEF_LDFLAGS) $(ARCH_LDFLAGS) |
---|
28 | |
---|
29 | # The path pointing to the architecture specific header files. |
---|
30 | ARCH_INC := $(MINI-OS_ROOT)/include/$(TARGET_ARCH_FAM) |
---|
31 | |
---|
32 | # Special build dependencies. |
---|
33 | # Rebuild all after touching this/these file(s) |
---|
34 | EXTRA_DEPS = $(MINI-OS_ROOT)/minios.mk \ |
---|
35 | $(MINI-OS_ROOT)/$(TARGET_ARCH_DIR)/arch.mk |
---|
36 | |
---|
37 | # Find all header files for checking dependencies. |
---|
38 | HDRS := $(wildcard $(MINI-OS_ROOT)/include/*.h) |
---|
39 | HDRS += $(wildcard $(MINI-OS_ROOT)/include/xen/*.h) |
---|
40 | HDRS += $(wildcard $(ARCH_INC)/*.h) |
---|
41 | # For special wanted header directories. |
---|
42 | extra_heads := $(foreach dir,$(EXTRA_INC),$(wildcard $(dir)/*.h)) |
---|
43 | HDRS += $(extra_heads) |
---|
44 | |
---|
45 | # Add the special header directories to the include paths. |
---|
46 | extra_incl := $(foreach dir,$(EXTRA_INC),-I$(MINI-OS_ROOT)/include/$(dir)) |
---|
47 | override CPPFLAGS := -I$(MINI-OS_ROOT)/include $(CPPFLAGS) -I$(ARCH_INC) $(extra_incl) |
---|
48 | |
---|
49 | # The name of the architecture specific library. |
---|
50 | # This is on x86_32: libx86_32.a |
---|
51 | # $(ARCH_LIB) has to built in the architecture specific directory. |
---|
52 | ARCH_LIB_NAME = $(TARGET_ARCH) |
---|
53 | ARCH_LIB := lib$(ARCH_LIB_NAME).a |
---|
54 | |
---|
55 | # This object contains the entrypoint for startup from Xen. |
---|
56 | # $(HEAD_ARCH_OBJ) has to be built in the architecture specific directory. |
---|
57 | HEAD_ARCH_OBJ := $(TARGET_ARCH).o |
---|
58 | HEAD_OBJ := $(TARGET_ARCH_DIR)/$(HEAD_ARCH_OBJ) |
---|
59 | |
---|
60 | |
---|
61 | %.o: %.c $(HDRS) Makefile $(EXTRA_DEPS) |
---|
62 | $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ |
---|
63 | |
---|
64 | %.o: %.S $(HDRS) Makefile $(EXTRA_DEPS) |
---|
65 | $(CC) $(ASFLAGS) $(CPPFLAGS) -c $< -o $@ |
---|
66 | |
---|
67 | |
---|
68 | |
---|
69 | |
---|