Auto-build dependency files in hypervisor build tree.
authorKeir Fraser <keir.fraser@citrix.com>
Thu, 8 Jan 2009 13:08:37 +0000 (13:08 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Thu, 8 Jan 2009 13:08:37 +0000 (13:08 +0000)
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
12 files changed:
xen/Rules.mk
xen/arch/ia64/Makefile
xen/arch/ia64/Rules.mk
xen/arch/x86/Makefile
xen/arch/x86/Rules.mk
xen/arch/x86/boot/Makefile
xen/arch/x86/mm/Makefile
xen/arch/x86/mm/hap/Makefile
xen/arch/x86/mm/shadow/Makefile
xen/arch/x86/x86_64/Makefile
xen/common/Makefile
xen/common/compat/Makefile

index 43a4f632493efb879a4b3ad9618fbc69da48979b..edee660175313d23dacc849805899281a2783b33 100644 (file)
@@ -34,21 +34,8 @@ override TARGET_ARCH     := $(shell echo $(XEN_TARGET_ARCH) | \
 
 TARGET := $(BASEDIR)/xen
 
-HDRS := $(wildcard *.h)
-HDRS += $(wildcard $(BASEDIR)/include/xen/*.h)
-HDRS += $(wildcard $(BASEDIR)/include/xen/hvm/*.h)
-HDRS += $(wildcard $(BASEDIR)/include/public/*.h)
-HDRS += $(wildcard $(BASEDIR)/include/public/*/*.h)
-HDRS += $(wildcard $(BASEDIR)/include/compat/*.h)
-HDRS += $(wildcard $(BASEDIR)/include/asm-$(TARGET_ARCH)/*.h)
-HDRS += $(wildcard $(BASEDIR)/include/asm-$(TARGET_ARCH)/$(TARGET_SUBARCH)/*.h)
-
 include $(BASEDIR)/arch/$(TARGET_ARCH)/Rules.mk
 
-# Do not depend on auto-generated header files.
-AHDRS := $(filter-out %/include/xen/compile.h,$(HDRS))
-HDRS  := $(filter-out %/asm-offsets.h,$(AHDRS))
-
 # Note that link order matters!
 ALL_OBJS-y               += $(BASEDIR)/common/built_in.o
 ALL_OBJS-y               += $(BASEDIR)/drivers/built_in.o
@@ -77,12 +64,14 @@ AFLAGS-y                += -D__ASSEMBLY__
 
 ALL_OBJS := $(ALL_OBJS-y)
 
-CFLAGS   := $(strip $(CFLAGS) $(CFLAGS-y))
+CFLAGS_tmp := $(strip $(CFLAGS) $(CFLAGS-y))
+CFLAGS = $(CFLAGS_tmp) -Wp,-MD,.$(@F).d
 
 # Most CFLAGS are safe for assembly files:
 #  -std=gnu{89,99} gets confused by #-prefixed end-of-line comments
-AFLAGS   := $(strip $(AFLAGS) $(AFLAGS-y))
-AFLAGS   += $(patsubst -std=gnu%,,$(CFLAGS))
+AFLAGS_tmp := $(strip $(AFLAGS) $(AFLAGS-y))
+AFLAGS_tmp += $(patsubst -std=gnu%,,$(CFLAGS_tmp))
+AFLAGS = $(AFLAGS_tmp) -Wp,-MD,.$(@F).d
 
 # LDFLAGS are only passed directly to $(LD)
 LDFLAGS  := $(strip $(LDFLAGS) $(LDFLAGS_DIRECT))
@@ -103,6 +92,8 @@ obj-y    := $(patsubst %/,%/built-in.o,$(obj-y))
 
 subdir-all := $(subdir-y) $(subdir-n)
 
+DEPS = .*.d
+
 built_in.o: $(obj-y)
        $(LD) $(LDFLAGS) -r -o $@ $^
 
@@ -115,19 +106,21 @@ FORCE:
 
 .PHONY: clean
 clean:: $(addprefix _clean_, $(subdir-all))
-       rm -f *.o *~ core
+       rm -f *.o *~ core $(DEPS)
 _clean_%/: FORCE
        $(MAKE) -f $(BASEDIR)/Rules.mk -C $* clean
 
-%.o: %.c $(HDRS) Makefile
+%.o: %.c Makefile
        $(CC) $(CFLAGS) -c $< -o $@
 
-%.o: %.S $(AHDRS) Makefile
+%.o: %.S Makefile
        $(CC) $(AFLAGS) -c $< -o $@
 
-%.i: %.c $(HDRS) Makefile
+%.i: %.c Makefile
        $(CPP) $(CFLAGS) $< -o $@
 
 # -std=gnu{89,99} gets confused by # as an end-of-line comment marker
-%.s: %.S $(AHDRS) Makefile
+%.s: %.S Makefile
        $(CPP) $(AFLAGS) $< -o $@
+
+-include $(DEPS)
index 664bdfacbe890810a3110cd48d7008aecfe7d588..a5e57ba8a21e464ee7bd1fde47e1634f706afb98 100644 (file)
@@ -29,11 +29,11 @@ $(TARGET): $(TARGET)-syms
 # Headers do not depend on auto-generated header, but object files do.
 $(ALL_OBJS): $(BASEDIR)/include/asm-ia64/asm-xsi-offsets.h
 
-asm-offsets.s: asm-offsets.c $(HDRS) \
+asm-offsets.s: asm-offsets.c \
     $(BASEDIR)/include/asm-ia64/.offsets.h.stamp 
        $(CC) $(CFLAGS) -DGENERATE_ASM_OFFSETS -DIA64_TASK_SIZE=0 -S -o $@ $<
 
-asm-xsi-offsets.s: asm-xsi-offsets.c $(HDRS)
+asm-xsi-offsets.s: asm-xsi-offsets.c
        $(CC) $(CFLAGS) -S -o $@ $<
 
 $(BASEDIR)/include/asm-ia64/asm-xsi-offsets.h: asm-xsi-offsets.s
@@ -61,7 +61,7 @@ $(BASEDIR)/include/asm-ia64/.offsets.h.stamp:
        touch $@
 
 # I'm sure a Makefile wizard would know a better way to do this
-xen.lds.s: xen/xen.lds.S $(HDRS)
+xen.lds.s: xen/xen.lds.S
        $(CC) -E $(CPPFLAGS) -P -DXEN $(AFLAGS) \
                -o xen.lds.s xen/xen.lds.S
 
index 2c59eb4a18c0454b5499287c00adbcde5f3541c5..c4854a79a7ab502568ae9530bf11320787036281 100644 (file)
@@ -73,18 +73,3 @@ CFLAGS += -DCONFIG_XEN_IA64_DISABLE_OPTVFAULT
 endif
 
 LDFLAGS := -g
-
-# Additionnal IA64 include dirs.
-HDRS += $(wildcard $(BASEDIR)/include/asm-ia64/linux-null/asm/*.h)
-HDRS += $(wildcard $(BASEDIR)/include/asm-ia64/linux-null/asm/sn/*.h)
-HDRS += $(wildcard $(BASEDIR)/include/asm-ia64/linux-null/linux/*.h)
-HDRS += $(wildcard $(BASEDIR)/include/asm-ia64/linux-xen/asm/*.h)
-HDRS += $(wildcard $(BASEDIR)/include/asm-ia64/linux-xen/asm/sn/*.h)
-HDRS += $(wildcard $(BASEDIR)/include/asm-ia64/linux-xen/linux/*.h)
-HDRS += $(wildcard $(BASEDIR)/include/asm-ia64/linux/*.h)
-HDRS += $(wildcard $(BASEDIR)/include/asm-ia64/linux/asm-generic/*.h)
-HDRS += $(wildcard $(BASEDIR)/include/asm-ia64/linux/asm/*.h)
-HDRS += $(wildcard $(BASEDIR)/include/asm-ia64/linux/byteorder/*.h)
-HDRS += $(wildcard $(BASEDIR)/include/asm-ia64/hvm/*.h)
-
-HDRS := $(filter-out %/include/asm-ia64/asm-xsi-offsets.h,$(HDRS))
index b961585a33fdeafa1c61bec6cb757738d08edf9d..ce98fd98fafbb1c4aeb575f66fbddf7c0ab5f51d 100644 (file)
@@ -78,10 +78,10 @@ $(TARGET)-syms: $(ALL_OBJS) xen.lds
            $(@D)/.$(@F).1.o -o $@
        rm -f $(@D)/.$(@F).[0-9]*
 
-asm-offsets.s: $(TARGET_SUBARCH)/asm-offsets.c $(HDRS)
+asm-offsets.s: $(TARGET_SUBARCH)/asm-offsets.c
        $(CC) $(CFLAGS) -S -o $@ $<
 
-xen.lds: $(TARGET_SUBARCH)/xen.lds.S $(HDRS)
+xen.lds: $(TARGET_SUBARCH)/xen.lds.S
        $(CC) -P -E -Ui386 $(AFLAGS) -o $@ $<
 
 boot/mkelf32: boot/mkelf32.c
@@ -90,4 +90,4 @@ boot/mkelf32: boot/mkelf32.c
 .PHONY: clean
 clean::
        rm -f asm-offsets.s xen.lds boot/*.o boot/*~ boot/core boot/mkelf32
-       rm -f $(BASEDIR)/.xen-syms.[0-9]*
+       rm -f $(BASEDIR)/.xen-syms.[0-9]* boot/.*.d
index 9380ccd780ca374b5e25b104bf8e66828686df81..d16f4dc4bce057d23cd3431aee256037ef681e6b 100644 (file)
@@ -51,10 +51,5 @@ x86_32 := n
 x86_64 := y
 endif
 
-HDRS += $(wildcard $(BASEDIR)/include/asm-x86/hvm/*.h)
-HDRS += $(wildcard $(BASEDIR)/include/asm-x86/hvm/svm/*.h)
-HDRS += $(wildcard $(BASEDIR)/include/asm-x86/hvm/vmx/*.h)
-HDRS += $(wildcard $(BASEDIR)/include/asm-x86/mach-*/*.h)
-
 # Require GCC v3.4+ (to avoid issues with alignment constraints in Xen headers)
 $(call cc-ver-check,CC,0x030400,"Xen requires at least gcc-3.4")
index ce5c9350affa887beaf1945fdc6e55ccf86649bd..3340058c08c662fef193595cea7aeba62a25b210 100644 (file)
@@ -1,4 +1 @@
 obj-y += head.o
-
-head.o: head.S $(TARGET_SUBARCH).S trampoline.S mem.S video.S \
-       cmdline.S edd.S wakeup.S
index a399c8ed149976594c6a25592483d48e1b66a570..4efde856e17a2907986de16f23a73d7b902f433e 100644 (file)
@@ -7,5 +7,5 @@ obj-y += guest_walk_2.o
 obj-y += guest_walk_3.o
 obj-$(x86_64) += guest_walk_4.o
 
-guest_walk_%.o: guest_walk.c $(HDRS) Makefile
+guest_walk_%.o: guest_walk.c Makefile
        $(CC) $(CFLAGS) -DGUEST_PAGING_LEVELS=$* -c $< -o $@
index 64cb72786ef761a01795e3e447be79522c7e40c5..4261d053f5bfddc2437054c9dfa3f9c1ef53b981 100644 (file)
@@ -7,5 +7,5 @@ obj-y += p2m-ept.o
 guest_levels  = $(subst level,,$(filter %level,$(subst ., ,$(subst _, ,$(1)))))
 guest_walk_defns = -DGUEST_PAGING_LEVELS=$(call guest_levels,$(1))
 
-guest_walk_%level.o: guest_walk.c $(HDRS) Makefile
+guest_walk_%level.o: guest_walk.c Makefile
        $(CC) $(CFLAGS) $(call guest_walk_defns,$(@F)) -c $< -o $@
index 76c879ee815c2cfb955f9172704dfab00cb2c067..3333d43679f075f0edf48e60cc1897120054e132 100644 (file)
@@ -1,5 +1,5 @@
 obj-$(x86_32) += common.o guest_2.o guest_3.o
 obj-$(x86_64) += common.o guest_2.o guest_3.o guest_4.o
 
-guest_%.o: multi.c $(HDRS) Makefile
+guest_%.o: multi.c Makefile
        $(CC) $(CFLAGS) -DGUEST_PAGING_LEVELS=$* -c $< -o $@
index 959eaef889c81e83974e2d36009d091354e53356..a1428273ebda0274d603c10d5bb15c3bde1fbb30 100644 (file)
@@ -14,16 +14,3 @@ obj-$(CONFIG_COMPAT) += physdev.o
 obj-$(CONFIG_COMPAT) += platform_hypercall.o
 obj-$(CONFIG_COMPAT) += cpu_idle.o
 obj-$(CONFIG_COMPAT) += cpufreq.o
-
-ifeq ($(CONFIG_COMPAT),y)
-# extra dependencies
-compat.o:      ../compat.c
-domctl.o:      ../domctl.c
-mm.o:          compat/mm.c
-physdev.o:     ../physdev.c
-platform_hypercall.o: ../platform_hypercall.c
-sysctl.o:      ../sysctl.c
-traps.o:       compat/traps.c
-cpu_idle.o:    ../acpi/cpu_idle.c
-cpufreq.o:     ../../../drivers/cpufreq/cpufreq.c
-endif
index 1c7edffcfc774e58d1f0132ffd0a6b595d168f16..3054f2e271723d6a61063474750a7a3215c502c0 100644 (file)
@@ -42,13 +42,3 @@ subdir-$(x86_64) += hvm
 subdir-$(ia64) += hvm
 
 subdir-y += libelf
-
-# Object file contains changeset and compiler information.
-version.o: $(BASEDIR)/include/xen/compile.h
-
-ifeq ($(CONFIG_COMPAT),y)
-# extra dependencies
-grant_table.o: compat/grant_table.c
-schedule.o: compat/schedule.c
-xenoprof.o: compat/xenoprof.c
-endif
index dfab7bc77cf62f4eadea950434c5c19bd806ae1d..9a36a3dcd3576d3469db0b8bb2dce4df29e855ee 100644 (file)
@@ -3,7 +3,3 @@ obj-y += kernel.o
 obj-y += memory.o
 obj-y += multicall.o
 obj-y += xlat.o
-
-# extra dependencies
-kernel.o:      ../kernel.c
-multicall.o:   ../multicall.c