ia64/xen-unstable

view xen/Rules.mk @ 16372:37be0bb60518

Revert 16067:9f9f9b68cd08a03fc8cfad9f5ab702e50b6b6463.
Signed-off-by: Keir Fraser <keir@xensource.com>
author Keir Fraser <keir@xensource.com>
date Tue Nov 13 17:28:44 2007 +0000 (2007-11-13)
parents 9ea5f4c1feb5
children ba69fe2dce91
line source
2 #
3 # If you change any of these configuration options then you must
4 # 'make clean' before rebuilding.
5 #
6 verbose ?= n
7 perfc ?= n
8 perfc_arrays ?= n
9 crash_debug ?= n
10 frame_pointer ?= n
12 XEN_ROOT=$(BASEDIR)/..
13 include $(XEN_ROOT)/Config.mk
15 # Hardcoded configuration implications and dependencies.
16 # Do this is a neater way if it becomes unwieldy.
17 ifeq ($(debug),y)
18 verbose := y
19 frame_pointer := y
20 endif
21 ifeq ($(perfc_arrays),y)
22 perfc := y
23 endif
24 ifeq ($(frame_pointer),y)
25 CFLAGS := $(shell echo $(CFLAGS) | sed -e 's/-f[^ ]*omit-frame-pointer//g')
26 endif
28 # Set ARCH/SUBARCH appropriately.
29 override COMPILE_SUBARCH := $(XEN_COMPILE_ARCH)
30 override TARGET_SUBARCH := $(XEN_TARGET_ARCH)
31 override COMPILE_ARCH := $(shell echo $(XEN_COMPILE_ARCH) | \
32 sed -e 's/x86.*/x86/' \
33 -e 's/powerpc.*/powerpc/')
34 override TARGET_ARCH := $(shell echo $(XEN_TARGET_ARCH) | \
35 sed -e 's/x86.*/x86/' \
36 -e 's/powerpc.*/powerpc/')
38 TARGET := $(BASEDIR)/xen
40 HDRS := $(wildcard *.h)
41 HDRS += $(wildcard $(BASEDIR)/include/xen/*.h)
42 HDRS := $(wildcard $(BASEDIR)/include/xen/hvm/*.h)
43 HDRS += $(wildcard $(BASEDIR)/include/public/*.h)
44 HDRS += $(wildcard $(BASEDIR)/include/public/*/*.h)
45 HDRS += $(wildcard $(BASEDIR)/include/compat/*.h)
46 HDRS += $(wildcard $(BASEDIR)/include/asm-$(TARGET_ARCH)/*.h)
47 HDRS += $(wildcard $(BASEDIR)/include/asm-$(TARGET_ARCH)/$(TARGET_SUBARCH)/*.h)
49 include $(BASEDIR)/arch/$(TARGET_ARCH)/Rules.mk
51 # Do not depend on auto-generated header files.
52 AHDRS := $(filter-out %/include/xen/compile.h,$(HDRS))
53 HDRS := $(filter-out %/asm-offsets.h,$(AHDRS))
55 # Note that link order matters!
56 ALL_OBJS-y += $(BASEDIR)/common/built_in.o
57 ALL_OBJS-y += $(BASEDIR)/drivers/built_in.o
58 ALL_OBJS-y += $(BASEDIR)/xsm/built_in.o
59 ALL_OBJS-y += $(BASEDIR)/arch/$(TARGET_ARCH)/built_in.o
61 CFLAGS-y += -g -D__XEN__
62 CFLAGS-$(XSM_ENABLE) += -DXSM_ENABLE
63 CFLAGS-$(FLASK_ENABLE) += -DFLASK_ENABLE -DXSM_MAGIC=0xf97cff8c
64 CFLAGS-$(FLASK_ENABLE) += -DFLASK_DEVELOP -DFLASK_BOOTPARAM -DFLASK_AVC_STATS
65 CFLAGS-$(ACM_SECURITY) += -DACM_SECURITY -DXSM_MAGIC=0xbcde0100
66 CFLAGS-$(verbose) += -DVERBOSE
67 CFLAGS-$(crash_debug) += -DCRASH_DEBUG
68 CFLAGS-$(perfc) += -DPERF_COUNTERS
69 CFLAGS-$(perfc_arrays) += -DPERF_ARRAYS
70 CFLAGS-$(frame_pointer) += -fno-omit-frame-pointer -DCONFIG_FRAME_POINTER
72 ifneq ($(max_phys_cpus),)
73 CFLAGS-y += -DMAX_PHYS_CPUS=$(max_phys_cpus)
74 endif
76 AFLAGS-y += -D__ASSEMBLY__
78 ALL_OBJS := $(ALL_OBJS-y)
80 CFLAGS := $(strip $(CFLAGS) $(CFLAGS-y))
82 # Most CFLAGS are safe for assembly files:
83 # -std=gnu{89,99} gets confused by #-prefixed end-of-line comments
84 AFLAGS := $(strip $(AFLAGS) $(AFLAGS-y))
85 AFLAGS += $(patsubst -std=gnu%,,$(CFLAGS))
87 # LDFLAGS are only passed directly to $(LD)
88 LDFLAGS := $(strip $(LDFLAGS) $(LDFLAGS_DIRECT))
90 include Makefile
92 # Ensure each subdirectory has exactly one trailing slash.
93 subdir-n := $(patsubst %,%/,$(patsubst %/,%,$(subdir-n)))
94 subdir-y := $(patsubst %,%/,$(patsubst %/,%,$(subdir-y)))
96 # Add explicitly declared subdirectories to the object list.
97 obj-y += $(patsubst %/,%/built_in.o,$(subdir-y))
99 # Add implicitly declared subdirectories (in the object list) to the
100 # subdirectory list, and rewrite the object-list entry.
101 subdir-y += $(filter %/,$(obj-y))
102 obj-y := $(patsubst %/,%/built-in.o,$(obj-y))
104 subdir-all := $(subdir-y) $(subdir-n)
106 built_in.o: $(obj-y)
107 $(LD) $(LDFLAGS) -r -o $@ $^
109 # Force execution of pattern rules (for which PHONY cannot be directly used).
110 .PHONY: FORCE
111 FORCE:
113 %/built_in.o: FORCE
114 $(MAKE) -f $(BASEDIR)/Rules.mk -C $* built_in.o
116 .PHONY: clean
117 clean:: $(addprefix _clean_, $(subdir-all))
118 rm -f *.o *~ core
119 _clean_%/: FORCE
120 $(MAKE) -f $(BASEDIR)/Rules.mk -C $* clean
122 %.o: %.c $(HDRS) Makefile
123 $(CC) $(CFLAGS) -c $< -o $@
125 %.o: %.S $(AHDRS) Makefile
126 $(CC) $(AFLAGS) -c $< -o $@
128 %.i: %.c $(HDRS) Makefile
129 $(CPP) $(CFLAGS) $< -o $@
131 # -std=gnu{89,99} gets confused by # as an end-of-line comment marker
132 %.s: %.S $(AHDRS) Makefile
133 $(CPP) $(AFLAGS) $< -o $@