aboutsummaryrefslogtreecommitdiffstats
path: root/xen/Rules.mk
diff options
context:
space:
mode:
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>2006-04-05 17:15:34 +0100
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>2006-04-05 17:15:34 +0100
commita853f9f18f2d2c822ae098c5583cd70f1df29354 (patch)
tree4771cae9c7b3081039b1db5e15113ff29cb49006 /xen/Rules.mk
parent2e70fcfed5ff48f9d0e33cd86702fccaedda5941 (diff)
downloadxen-a853f9f18f2d2c822ae098c5583cd70f1df29354.tar.gz
xen-a853f9f18f2d2c822ae098c5583cd70f1df29354.tar.bz2
xen-a853f9f18f2d2c822ae098c5583cd70f1df29354.zip
Clean up build system some more. No need to explicitly
include Rules.mk/Post.mk all over the place. Signed-off-by: Keir Fraser <keir@xensource.com>
Diffstat (limited to 'xen/Rules.mk')
-rw-r--r--xen/Rules.mk34
1 files changed, 34 insertions, 0 deletions
diff --git a/xen/Rules.mk b/xen/Rules.mk
index 2639f6a1d1..66749058d3 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -33,6 +33,10 @@ HDRS += $(wildcard $(BASEDIR)/include/public/*.h)
HDRS += $(wildcard $(BASEDIR)/include/asm-$(TARGET_ARCH)/*.h)
HDRS += $(wildcard $(BASEDIR)/include/asm-$(TARGET_ARCH)/$(TARGET_SUBARCH)/*.h)
+INSTALL := install
+INSTALL_DATA := $(INSTALL) -m0644
+INSTALL_DIR := $(INSTALL) -d -m0755
+
include $(BASEDIR)/arch/$(TARGET_ARCH)/Rules.mk
# Do not depend on auto-generated header files.
@@ -63,6 +67,36 @@ ALL_OBJS := $(ALL_OBJS-y)
CFLAGS := $(strip $(CFLAGS) $(CFLAGS-y))
AFLAGS := $(strip $(AFLAGS) $(AFLAGS-y))
+include Makefile
+
+# Ensure each subdirectory has exactly one trailing slash.
+subdir-n := $(patsubst %,%/,$(patsubst %/,%,$(subdir-n)))
+subdir-y := $(patsubst %,%/,$(patsubst %/,%,$(subdir-y)))
+
+# Add explicitly declared subdirectories to the object list.
+obj-y += $(patsubst %,%/built_in.o,$(subdir-y))
+
+# Add implicitly declared subdirectories (in the object list) to the
+# subdirectory list, and rewrite the object-list entry.
+subdir-y += $(filter %/,$(obj-y))
+obj-y := $(patsubst %/,%/built-in.o,$(obj-y))
+
+subdir-all := $(subdir-y) $(subdir-n)
+
+built_in.o: $(obj-y)
+ $(LD) $(LDFLAGS) -r -o $@ $^
+
+.PHONY: FORCE
+FORCE:
+
+%/built_in.o: FORCE
+ $(MAKE) -f $(BASEDIR)/Rules.mk -C $* built_in.o
+
+clean:: $(addprefix _clean_, $(subdir-all)) FORCE
+ rm -f *.o *~ core
+_clean_%/: FORCE
+ $(MAKE) -f $(BASEDIR)/Rules.mk -C $* clean
+
%.o: %.c $(HDRS) Makefile
$(CC) $(CFLAGS) -c $< -o $@