diff --git a/xen/Rules.mk b/xen/Rules.mk index 433dad3e23..e9d03b9900 100644 --- a/xen/Rules.mk +++ b/xen/Rules.mk @@ -86,8 +86,7 @@ AFLAGS-$(clang) += -no-integrated-as ALL_OBJS := $(ALL_OBJS-y) # Get gcc to generate the dependencies for us. -CFLAGS-y += -MMD -MF .$(@F).d -DEPS = .*.d +CFLAGS-y += -MMD -MF $(@D)/.$(@F).d CFLAGS += $(CFLAGS-y) @@ -103,6 +102,14 @@ LDFLAGS += $(LDFLAGS-y) include Makefile +DEPS = .*.d +define gendep + ifneq ($(1),$(subst /,:,$(1))) + DEPS += $(dir $(1)).$(basename $(notdir $(1))).d + endif +endef +$(foreach o,$(filter-out %/,$(obj-y)),$(eval $(call gendep,$(o)))) + # Ensure each subdirectory has exactly one trailing slash. subdir-n := $(patsubst %,%/,$(patsubst %/,%,$(subdir-n) $(subdir-))) subdir-y := $(patsubst %,%/,$(patsubst %/,%,$(subdir-y))) diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile index 8c1a890631..d4e507a06f 100644 --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -13,7 +13,7 @@ obj-y += bitops.o obj-bin-y += bzimage.init.o obj-bin-y += clear_page.o obj-bin-y += copy_page.o -obj-y += compat.o +obj-y += compat.o x86_64/compat.o obj-$(CONFIG_KEXEC) += crash.o obj-y += debug.o obj-y += delay.o @@ -25,7 +25,6 @@ obj-y += domain_page.o obj-y += e820.o obj-y += extable.o obj-y += flushtlb.o -obj-y += platform_hypercall.o obj-y += i387.o obj-y += i8259.o obj-y += io_apic.o @@ -37,14 +36,15 @@ obj-y += microcode_amd.o obj-y += microcode_intel.o # This must come after the vendor specific files. obj-y += microcode.o -obj-y += mm.o +obj-y += mm.o x86_64/mm.o obj-y += monitor.o obj-y += mpparse.o obj-y += nmi.o obj-y += numa.o obj-y += pci.o obj-y += percpu.o -obj-y += physdev.o +obj-y += physdev.o x86_64/physdev.o +obj-y += platform_hypercall.o x86_64/platform_hypercall.o obj-y += psr.o obj-y += setup.o obj-y += shutdown.o diff --git a/xen/arch/x86/x86_64/Makefile b/xen/arch/x86/x86_64/Makefile index 7f8fb3de88..d5af722421 100644 --- a/xen/arch/x86/x86_64/Makefile +++ b/xen/arch/x86/x86_64/Makefile @@ -2,7 +2,6 @@ subdir-y += compat obj-bin-y += entry.o obj-bin-y += gpr_switch.o -obj-y += mm.o obj-y += traps.o obj-y += machine_kexec.o obj-y += pci.o @@ -10,10 +9,7 @@ obj-y += acpi_mmcfg.o obj-y += mmconf-fam10h.o obj-y += mmconfig_64.o obj-y += mmconfig-shared.o -obj-y += compat.o obj-y += domain.o -obj-y += physdev.o -obj-y += platform_hypercall.o obj-y += cpu_idle.o obj-y += cpufreq.o obj-bin-y += kexec_reloc.o diff --git a/xen/arch/x86/x86_64/compat.c b/xen/arch/x86/x86_64/compat.c index 69b9aa096b..f8f633b2a6 100644 --- a/xen/arch/x86/x86_64/compat.c +++ b/xen/arch/x86/x86_64/compat.c @@ -2,7 +2,8 @@ * compat.c */ -#include +asm(".file \"" __FILE__ "\""); + #include #include #include diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c index d918002ce2..bbbf8e3b8a 100644 --- a/xen/arch/x86/x86_64/mm.c +++ b/xen/arch/x86/x86_64/mm.c @@ -16,7 +16,8 @@ * with this program; If not, see . */ -#include +asm(".file \"" __FILE__ "\""); + #include #include #include diff --git a/xen/arch/x86/x86_64/physdev.c b/xen/arch/x86/x86_64/physdev.c index d376cd04dd..c5a00ea93f 100644 --- a/xen/arch/x86/x86_64/physdev.c +++ b/xen/arch/x86/x86_64/physdev.c @@ -2,7 +2,8 @@ * physdev.c */ -#include +asm(".file \"" __FILE__ "\""); + #include #include #include diff --git a/xen/arch/x86/x86_64/platform_hypercall.c b/xen/arch/x86/x86_64/platform_hypercall.c index ccfd30d679..8fa2543a2d 100644 --- a/xen/arch/x86/x86_64/platform_hypercall.c +++ b/xen/arch/x86/x86_64/platform_hypercall.c @@ -2,7 +2,8 @@ * platform_hypercall.c */ -#include +asm(".file \"" __FILE__ "\""); + #include #include diff --git a/xen/common/Makefile b/xen/common/Makefile index a7829db258..3547c8e2ce 100644 --- a/xen/common/Makefile +++ b/xen/common/Makefile @@ -63,7 +63,7 @@ obj-$(perfc) += perfc.o obj-$(crash_debug) += gdbstub.o obj-$(xenoprof) += xenoprof.o -subdir-$(CONFIG_COMPAT) += compat +obj-$(CONFIG_COMPAT) += $(addprefix compat/,domain.o kernel.o memory.o multicall.o tmem_xen.o xlat.o) subdir-$(x86_64) += hvm diff --git a/xen/common/compat/Makefile b/xen/common/compat/Makefile deleted file mode 100644 index 1cf289ab3e..0000000000 --- a/xen/common/compat/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -obj-y += domain.o -obj-y += kernel.o -obj-y += memory.o -obj-y += multicall.o -obj-y += xlat.o -obj-y += tmem_xen.o diff --git a/xen/common/compat/domain.c b/xen/common/compat/domain.c index 157570a97e..c60d824aff 100644 --- a/xen/common/compat/domain.c +++ b/xen/common/compat/domain.c @@ -3,7 +3,8 @@ * */ -#include +asm(".file \"" __FILE__ "\""); + #include #include #include diff --git a/xen/common/compat/kernel.c b/xen/common/compat/kernel.c index 65cc25bd49..df93fdd89c 100644 --- a/xen/common/compat/kernel.c +++ b/xen/common/compat/kernel.c @@ -2,7 +2,8 @@ * kernel.c */ -#include +asm(".file \"" __FILE__ "\""); + #include #include #include diff --git a/xen/common/compat/memory.c b/xen/common/compat/memory.c index 002948b673..bb10993f7a 100644 --- a/xen/common/compat/memory.c +++ b/xen/common/compat/memory.c @@ -1,4 +1,5 @@ -#include +asm(".file \"" __FILE__ "\""); + #include #include #include diff --git a/xen/common/compat/multicall.c b/xen/common/compat/multicall.c index 2af8aef8b7..43d2d8152d 100644 --- a/xen/common/compat/multicall.c +++ b/xen/common/compat/multicall.c @@ -2,7 +2,8 @@ * multicall.c */ -#include +asm(".file \"" __FILE__ "\""); + #include #include #include diff --git a/xen/include/Makefile b/xen/include/Makefile index 6664107294..c674f7f1b9 100644 --- a/xen/include/Makefile +++ b/xen/include/Makefile @@ -58,7 +58,7 @@ compat/%.h: compat/%.i Makefile $(BASEDIR)/tools/compat-build-header.py mv -f $@.new $@ compat/%.i: compat/%.c Makefile - $(CPP) $(filter-out -M% .%.d -include %/include/xen/config.h,$(CFLAGS)) $(cppflags-y) -o $@ $< + $(CPP) $(filter-out -M% %.d -include %/include/xen/config.h,$(CFLAGS)) $(cppflags-y) -o $@ $< compat/%.c: public/%.h xlat.lst Makefile $(BASEDIR)/tools/compat-build-source.py mkdir -p $(@D)