debuggers.hg

view xen/Rules.mk @ 10944:08415dfc5918

[XEN] Allow quick building of individual files.

For the purpose of quick compile testing of (namely smaller) changes,
provide a
means to build individual pieces underneath the xen dir (could equally
be applied
to tools, and the top level Makefile could also be made aware of this
logic to
make things even more consistent). At once, add a way to only
pre-process files
in case some of the more complicated macros need change and hence
inspection
of the results.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author kfraser@localhost.localdomain
date Wed Aug 02 15:06:29 2006 +0100 (2006-08-02)
parents b786bfb058eb
children d40dfbef8e5d
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
11 # Hardcoded configuration implications and dependencies.
12 # Do this is a neater way if it becomes unwieldy.
13 ifeq ($(debug),y)
14 verbose := y
15 endif
16 ifeq ($(perfc_arrays),y)
17 perfc := y
18 endif
20 XEN_ROOT=$(BASEDIR)/..
21 include $(XEN_ROOT)/Config.mk
23 # Set ARCH/SUBARCH appropriately.
24 override COMPILE_SUBARCH := $(XEN_COMPILE_ARCH)
25 override TARGET_SUBARCH := $(XEN_TARGET_ARCH)
26 override COMPILE_ARCH := $(shell echo $(XEN_COMPILE_ARCH) | \
27 sed -e 's/\(x86\|powerpc\).*/\1/')
28 override TARGET_ARCH := $(shell echo $(XEN_TARGET_ARCH) | \
29 sed -e 's/\(x86\|powerpc\).*/\1/')
31 TARGET := $(BASEDIR)/xen
33 HDRS := $(wildcard $(BASEDIR)/include/xen/*.h)
34 HDRS += $(wildcard $(BASEDIR)/include/public/*.h)
35 HDRS += $(wildcard $(BASEDIR)/include/asm-$(TARGET_ARCH)/*.h)
36 HDRS += $(wildcard $(BASEDIR)/include/asm-$(TARGET_ARCH)/$(TARGET_SUBARCH)/*.h)
38 INSTALL := install
39 INSTALL_DATA := $(INSTALL) -m0644
40 INSTALL_DIR := $(INSTALL) -d -m0755
42 include $(BASEDIR)/arch/$(TARGET_ARCH)/Rules.mk
44 # Do not depend on auto-generated header files.
45 HDRS := $(subst $(BASEDIR)/include/asm-$(TARGET_ARCH)/asm-offsets.h,,$(HDRS))
46 HDRS := $(subst $(BASEDIR)/include/xen/compile.h,,$(HDRS))
48 # Note that link order matters!
49 ALL_OBJS-y += $(BASEDIR)/common/built_in.o
50 ALL_OBJS-y += $(BASEDIR)/drivers/built_in.o
51 ALL_OBJS-$(ACM_SECURITY) += $(BASEDIR)/acm/built_in.o
52 ALL_OBJS-y += $(BASEDIR)/arch/$(TARGET_ARCH)/built_in.o
54 CFLAGS-y += -g -D__XEN__
55 CFLAGS-$(ACM_SECURITY) += -DACM_SECURITY
56 CFLAGS-$(verbose) += -DVERBOSE
57 CFLAGS-$(crash_debug) += -DCRASH_DEBUG
58 CFLAGS-$(perfc) += -DPERF_COUNTERS
59 CFLAGS-$(perfc_arrays) += -DPERF_ARRAYS
61 ifneq ($(max_phys_cpus),)
62 CFLAGS-y += -DMAX_PHYS_CPUS=$(max_phys_cpus)
63 endif
65 AFLAGS-y += -D__ASSEMBLY__
67 ALL_OBJS := $(ALL_OBJS-y)
68 CFLAGS := $(strip $(CFLAGS) $(CFLAGS-y))
69 AFLAGS := $(strip $(AFLAGS) $(AFLAGS-y))
71 include Makefile
73 # Ensure each subdirectory has exactly one trailing slash.
74 subdir-n := $(patsubst %,%/,$(patsubst %/,%,$(subdir-n)))
75 subdir-y := $(patsubst %,%/,$(patsubst %/,%,$(subdir-y)))
77 # Add explicitly declared subdirectories to the object list.
78 obj-y += $(patsubst %/,%/built_in.o,$(subdir-y))
80 # Add implicitly declared subdirectories (in the object list) to the
81 # subdirectory list, and rewrite the object-list entry.
82 subdir-y += $(filter %/,$(obj-y))
83 obj-y := $(patsubst %/,%/built-in.o,$(obj-y))
85 subdir-all := $(subdir-y) $(subdir-n)
87 built_in.o: $(obj-y)
88 $(LD) $(LDFLAGS) -r -o $@ $^
90 # Force execution of pattern rules (for which PHONY cannot be directly used).
91 .PHONY: FORCE
92 FORCE:
94 %/built_in.o: FORCE
95 $(MAKE) -f $(BASEDIR)/Rules.mk -C $* built_in.o
97 .PHONY: clean
98 clean:: $(addprefix _clean_, $(subdir-all))
99 rm -f *.o *~ core
100 _clean_%/: FORCE
101 $(MAKE) -f $(BASEDIR)/Rules.mk -C $* clean
103 %.o: %.c $(HDRS) Makefile
104 $(CC) $(CFLAGS) -c $< -o $@
106 %.o: %.S $(HDRS) Makefile
107 $(CC) $(CFLAGS) $(AFLAGS) -c $< -o $@
109 %.i: %.c $(HDRS) Makefile
110 $(CPP) $(CFLAGS) $< -o $@
112 %.s: %.S $(HDRS) Makefile
113 $(CPP) $(CFLAGS) $(AFLAGS) $< -o $@