From nobody Mon Feb 9 10:58:20 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1625149329; cv=none; d=zohomail.com; s=zohoarc; b=cvT6Tym+oERP4j0nRrY4TA8MJSwZCBRRynC+znNeZDFo44gJQkcdmzcbm+83bqjlMqxQAClYD/32zdi8r7NGXABfoTrxphkcYuStpWkPcGT4VJpkHv6ghKUPIWxIcPkHt77pSaEFJJeu0HEbDtim/KSoxu/u8WE+FfJMI9RBp2E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1625149329; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=kFhPa1KBDeOt/qfc8JjHSfCxLt1j3t716zhKQsueKjg=; b=Dafusm7bVQkQ11odxgdhCjnJawmGauZbH/KkzSf9G1jng85ohc+CtoAdISuyBd50abLYJqWPqhqVxJB+t+qnaeNzjdM+Mh+oDASqgd9gChR2jsJyUtPezH00T8Am7JPbMkJ7xIPlL3c50JR2h+SOq2NAbxnkv4avs1bT/icrf8E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 162514932993866.21810739032264; Thu, 1 Jul 2021 07:22:09 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.148811.275137 (Exim 4.92) (envelope-from ) id 1lyxZj-0005IG-RI; Thu, 01 Jul 2021 14:21:55 +0000 Received: by outflank-mailman (output) from mailman id 148811.275137; Thu, 01 Jul 2021 14:21:55 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lyxZj-0005Gh-Dt; Thu, 01 Jul 2021 14:21:55 +0000 Received: by outflank-mailman (input) for mailman id 148811; Thu, 01 Jul 2021 14:21:54 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lyxPv-0005F9-L9 for xen-devel@lists.xenproject.org; Thu, 01 Jul 2021 14:11:47 +0000 Received: from esa4.hc3370-68.iphmx.com (unknown [216.71.155.144]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 2af6936c-da76-11eb-8328-12813bfff9fa; Thu, 01 Jul 2021 14:11:03 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 2af6936c-da76-11eb-8328-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1625148663; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=d78ReIC4dkXR+RmdsCXwSdPyXPKAHSLgx1r8az094Oo=; b=eIxBi1MBjmYipGvvmIhPEBPKrG9UCNUsnwW5XXsZC9PgxcdePe5u9w+n 3x11jLRKnJG5OFZbKfcoHCct53ACGks3fCV35UFd7j5wQWJHcPuVdTvPp HVkFdjJ1t8il1sTlP/H7w6Mhh7wDdwFwt3KV8j2OW02nyxv00lF36OLJK g=; Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: HUVxGlcv97ZQa0q3AG+QVFZyCim0+EctzY0AQqEJU9/a4O2q/VswMmJj2dscPL3gGS5BYDUtXu Ln5LcK0JeLj8SLBWQUwwPZcb+CBR0MgtYDN6Z2eKiGPu3pey4nckyiNJkJgawA9ga4padMIavk MLQeozwN95dAxhRg5I7rV8lpyOE2HMyCqFUVBERAhuVgHVHCUChau1oPTa0m60KwD/pveGDB8u 5nw3wXwQep8VcCvGKUxSGPXDNh4CyEMmxS82mYFkvOVaEVcRxv5+iPxyP+T2lT+PFDjW2aqVKp zdQ= X-SBRS: 5.1 X-MesageID: 49007566 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED IronPort-HdrOrdr: A9a23:qE7bfKiEd9bH3XMDcANDU6kM4HBQXtwji2hC6mlwRA09TySZ// rAoB19726StN9xYgBYpTnuAsi9qB/nmKKdpLNhX4tKPzOW3FdATrsD0WKK+VSJcEfDH6xmpM JdmsBFebvN5DNB4/oSjjPVLz9Z+qjlzJyV X-IronPort-AV: E=Sophos;i="5.83,314,1616472000"; d="scan'208";a="49007566" From: Anthony PERARD To: CC: Anthony PERARD , Andrew Cooper , George Dunlap , "Ian Jackson" , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu , Volodymyr Babchuk , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Daniel De Graaf , "Daniel P. Smith" Subject: [XEN PATCH v6 27/31] build: prepare to always invoke $(MAKE) from xen/, use $(obj) Date: Thu, 1 Jul 2021 15:10:07 +0100 Message-ID: <20210701141011.785641-28-anthony.perard@citrix.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210701141011.785641-1-anthony.perard@citrix.com> References: <20210701141011.785641-1-anthony.perard@citrix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) Content-Type: text/plain; charset="utf-8" In a future patch, when building a subdirectory, we will set "obj=3D$subdir" rather than change directory. Before that, we add "$(obj)" and "$(src)" in as many places as possible where we will need to know which subdirectory is been built. "$(obj)" is for files been generated during the build, and "$(src)" is for files present in the source tree. For now, we set both to "." in Rules.mk and Makefile.clean. A few places don't tolerate the addition of "./", this is because make remove the leading "./" in targets and dependencies in rules, so these will be change later. Signed-off-by: Anthony PERARD --- xen/Rules.mk | 5 ++- xen/arch/arm/Makefile | 14 +++--- xen/arch/x86/Makefile | 60 ++++++++++++------------- xen/arch/x86/boot/Makefile | 14 +++--- xen/arch/x86/efi/Makefile | 6 +-- xen/common/Makefile | 8 ++-- xen/common/libelf/Makefile | 4 +- xen/common/libfdt/Makefile | 6 +-- xen/include/Makefile | 44 +++++++++--------- xen/scripts/Makefile.clean | 5 ++- xen/xsm/flask/Makefile | 34 +++++++------- xen/xsm/flask/policy/mkaccess_vector.sh | 7 ++- 12 files changed, 108 insertions(+), 99 deletions(-) diff --git a/xen/Rules.mk b/xen/Rules.mk index 530aefa43ad9..0f8d90844455 100644 --- a/xen/Rules.mk +++ b/xen/Rules.mk @@ -3,6 +3,9 @@ # Makefile and are consumed by Rules.mk # =20 +obj :=3D . +src :=3D $(obj) + -include $(BASEDIR)/include/config/auto.conf =20 include $(XEN_ROOT)/Config.mk @@ -23,7 +26,7 @@ SPECIAL_DATA_SECTIONS :=3D rodata $(foreach a,1 2 4 8 16,= \ rodata.cst$(a)) \ $(foreach r,rel rel.ro,data.$(r).local) =20 -include Makefile +include $(src)/Makefile =20 # Linking # ------------------------------------------------------------------------= --- diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile index 067c0d9844e4..9f9c73aa6c5d 100644 --- a/xen/arch/arm/Makefile +++ b/xen/arch/arm/Makefile @@ -88,18 +88,18 @@ ifeq ($(CONFIG_ARM_64),y) ln -sf $(@F) $@.efi endif =20 -$(TARGET)-syms: $(BASEDIR)/prelink.o xen.lds - $(LD) $(XEN_LDFLAGS) -T xen.lds -N $< \ +$(TARGET)-syms: $(BASEDIR)/prelink.o $(obj)/xen.lds + $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< \ $(BASEDIR)/common/symbols-dummy.o -o $(@D)/.$(@F).0 $(NM) -pa --format=3Dsysv $(@D)/.$(@F).0 \ | $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort >$(@D)/.$(@F).0.S $(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).0.o - $(LD) $(XEN_LDFLAGS) -T xen.lds -N $< \ + $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< \ $(@D)/.$(@F).0.o -o $(@D)/.$(@F).1 $(NM) -pa --format=3Dsysv $(@D)/.$(@F).1 \ | $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort >$(@D)/.$(@F).1.S $(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).1.o - $(LD) $(XEN_LDFLAGS) -T xen.lds -N $< $(build_id_linker) \ + $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< $(build_id_linker) \ $(@D)/.$(@F).1.o -o $@ $(NM) -pa --format=3Dsysv $(@D)/$(@F) \ | $(BASEDIR)/tools/symbols --all-symbols --xensyms --sysv --sort \ @@ -109,13 +109,13 @@ $(TARGET)-syms: $(BASEDIR)/prelink.o xen.lds .PHONY: include include: =20 -xen.lds: xen.lds.S FORCE +$(obj)/xen.lds: $(src)/xen.lds.S FORCE $(call if_changed,cpp_lds_S) =20 -dtb.o: $(patsubst "%",%,$(CONFIG_DTB_FILE)) +$(obj)/dtb.o: $(patsubst "%",%,$(CONFIG_DTB_FILE)) =20 .PHONY: clean clean:: - rm -f xen.lds + rm -f $(obj)/xen.lds rm -f $(BASEDIR)/.xen-syms.[0-9]* rm -f $(TARGET).efi diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile index fc719247eac9..2cc67d6e0e84 100644 --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -82,7 +82,7 @@ extra-y +=3D asm-macros.i extra-y +=3D xen.lds =20 ifneq ($(CONFIG_HVM),y) -x86_emulate.o: CFLAGS-y +=3D -Wno-unused-label +$(obj)/x86_emulate.o: CFLAGS-y +=3D -Wno-unused-label endif =20 efi-y :=3D $(shell if [ ! -r $(BASEDIR)/include/xen/compile.h -o \ @@ -113,8 +113,8 @@ syms-warn-dup-$(CONFIG_SUPPRESS_DUPLICATE_SYMBOL_WARNIN= GS) :=3D syms-warn-dup-$(CONFIG_ENFORCE_UNIQUE_SYMBOLS) :=3D --error-dup =20 $(TARGET): TMP =3D $(@D)/.$(@F).elf32 -$(TARGET): $(TARGET)-syms $(efi-y) boot/mkelf32 - ./boot/mkelf32 $(notes_phdrs) $(TARGET)-syms $(TMP) $(XEN_IMG_OFFSET) \ +$(TARGET): $(TARGET)-syms $(efi-y) $(obj)/boot/mkelf32 + $(obj)/boot/mkelf32 $(notes_phdrs) $(TARGET)-syms $(TMP) $(XEN_IMG_OFFSET= ) \ `$(NM) $(TARGET)-syms | sed -ne 's/^\([^ ]*\) . __2M_rwdat= a_end$$/0x\1/p'` od -t x4 -N 8192 $(TMP) | grep 1badb002 > /dev/null || \ { echo "No Multiboot1 header found" >&2; false; } @@ -125,29 +125,29 @@ $(TARGET): $(TARGET)-syms $(efi-y) boot/mkelf32 ifneq ($(efi-y),) =20 # Check if the compiler supports the MS ABI. -XEN_BUILD_EFI :=3D $(shell $(CC) $(XEN_CFLAGS) -c efi/check.c -o efi/check= .o 2>/dev/null && echo y) +XEN_BUILD_EFI :=3D $(shell $(CC) $(XEN_CFLAGS) -c $(src)/efi/check.c -o $(= obj)/efi/check.o 2>/dev/null && echo y) CFLAGS-$(XEN_BUILD_EFI) +=3D -DXEN_BUILD_EFI =20 # Check if the linker supports PE. EFI_LDFLAGS =3D $(patsubst -m%,-mi386pep,$(XEN_LDFLAGS)) --subsystem=3D10 -XEN_BUILD_PE :=3D $(if $(XEN_BUILD_EFI),$(call ld-option,$(EFI_LDFLAGS) --= image-base=3D0x100000000 -o efi/check.efi efi/check.o)) +XEN_BUILD_PE :=3D $(if $(XEN_BUILD_EFI),$(call ld-option,$(EFI_LDFLAGS) --= image-base=3D0x100000000 -o $(obj)/efi/check.efi $(obj)/efi/check.o)) # If the above failed, it may be merely because of the linker not dealing = well # with debug info. Try again with stripping it. ifeq ($(CONFIG_DEBUG_INFO)-$(XEN_BUILD_PE),y-n) EFI_LDFLAGS +=3D --strip-debug -XEN_BUILD_PE :=3D $(call ld-option,$(EFI_LDFLAGS) --image-base=3D0x1000000= 00 -o efi/check.efi efi/check.o) +XEN_BUILD_PE :=3D $(call ld-option,$(EFI_LDFLAGS) --image-base=3D0x1000000= 00 -o $(obj)/efi/check.efi $(obj)/efi/check.o) endif =20 ifeq ($(XEN_BUILD_PE),y) =20 # Check if the linker produces fixups in PE by default -nr-fixups :=3D $(shell $(OBJDUMP) -p efi/check.efi | grep '^[[:blank:]]*re= loc[[:blank:]]*[0-9][[:blank:]].*DIR64$$' | wc -l) +nr-fixups :=3D $(shell $(OBJDUMP) -p $(obj)/efi/check.efi | grep '^[[:blan= k:]]*reloc[[:blank:]]*[0-9][[:blank:]].*DIR64$$' | wc -l) ifeq ($(nr-fixups),2) MKRELOC :=3D : relocs-dummy :=3D else -MKRELOC :=3D efi/mkreloc -relocs-dummy :=3D efi/relocs-dummy.o +MKRELOC :=3D $(obj)/efi/mkreloc +relocs-dummy :=3D $(obj)/efi/relocs-dummy.o # If the linker produced fixups but not precisely two of them, we need to # disable it doing so. But if it didn't produce any fixups, it also would= n't # recognize the option. @@ -160,27 +160,27 @@ endif # $(XEN_BUILD_PE) =20 endif # $(efi-y) =20 -$(TARGET)-syms: $(BASEDIR)/prelink.o xen.lds - $(LD) $(XEN_LDFLAGS) -T xen.lds -N $< $(build_id_linker) \ +$(TARGET)-syms: $(BASEDIR)/prelink.o $(obj)/xen.lds + $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< $(build_id_linker) \ $(BASEDIR)/common/symbols-dummy.o -o $(@D)/.$(@F).0 $(NM) -pa --format=3Dsysv $(@D)/.$(@F).0 \ | $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort \ >$(@D)/.$(@F).0.S $(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).0.o - $(LD) $(XEN_LDFLAGS) -T xen.lds -N $< $(build_id_linker) \ + $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< $(build_id_linker) \ $(@D)/.$(@F).0.o -o $(@D)/.$(@F).1 $(NM) -pa --format=3Dsysv $(@D)/.$(@F).1 \ | $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort $(syms-warn-dup-= y) \ >$(@D)/.$(@F).1.S $(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).1.o - $(LD) $(XEN_LDFLAGS) -T xen.lds -N $< $(build_id_linker) \ + $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< $(build_id_linker) \ $(@D)/.$(@F).1.o -o $@ $(NM) -pa --format=3Dsysv $(@D)/$(@F) \ | $(BASEDIR)/tools/symbols --all-symbols --xensyms --sysv --sort \ >$(@D)/$(@F).map rm -f $(@D)/.$(@F).[0-9]* $(@D)/..$(@F).[0-9]* =20 -note.o: $(TARGET)-syms +$(obj)/note.o: $(TARGET)-syms $(OBJCOPY) -O binary --only-section=3D.note.gnu.build-id $< $@.bin $(OBJCOPY) -I binary -O elf64-x86-64 -B i386:x86-64 \ --rename-section=3D.data=3D.note.gnu.build-id -S $@.bin $@ @@ -199,23 +199,23 @@ ifdef SOURCE_DATE_EPOCH EFI_LDFLAGS +=3D --no-insert-timestamp endif =20 -$(TARGET).efi: VIRT_BASE =3D 0x$(shell $(NM) efi/relocs-dummy.o | sed -n '= s, A VIRT_START$$,,p') +$(TARGET).efi: VIRT_BASE =3D 0x$(shell $(NM) $(obj)/efi/relocs-dummy.o | s= ed -n 's, A VIRT_START$$,,p') ifeq ($(MKRELOC),:) $(TARGET).efi: ALT_BASE :=3D else -$(TARGET).efi: ALT_BASE =3D 0x$(shell $(NM) efi/relocs-dummy.o | sed -n 's= , A ALT_START$$,,p') +$(TARGET).efi: ALT_BASE =3D 0x$(shell $(NM) $(obj)/efi/relocs-dummy.o | se= d -n 's, A ALT_START$$,,p') endif =20 ifneq ($(build_id_linker),) ifeq ($(call ld-ver-build-id,$(LD) $(filter -m%,$(EFI_LDFLAGS))),y) CFLAGS-y +=3D -DBUILD_ID_EFI EFI_LDFLAGS +=3D $(build_id_linker) -note_file :=3D efi/buildid.o +note_file :=3D $(obj)/efi/buildid.o # NB: this must be the last input in the linker call, because inputs follo= wing # the -b option will all be treated as being in the specified format. note_file_option :=3D -b pe-x86-64 $(note_file) else -note_file :=3D note.o +note_file :=3D $(obj)/note.o endif else note_file :=3D @@ -224,25 +224,25 @@ note_file_option ?=3D $(note_file) =20 ifeq ($(XEN_BUILD_PE),y) extra-y +=3D efi.lds -$(TARGET).efi: $(BASEDIR)/prelink.o $(note_file) efi.lds efi/relocs-dummy.= o efi/mkreloc +$(TARGET).efi: $(BASEDIR)/prelink.o $(note_file) $(obj)/efi.lds $(obj)/efi= /relocs-dummy.o $(obj)/efi/mkreloc ifeq ($(CONFIG_DEBUG_INFO),y) $(if $(filter --strip-debug,$(EFI_LDFLAGS)),echo,:) "Will strip debug inf= o from $(@F)" endif $(foreach base, $(VIRT_BASE) $(ALT_BASE), \ - $(LD) $(call EFI_LDFLAGS,$(base)) -T efi.lds -N $< $(relocs-dum= my) \ + $(LD) $(call EFI_LDFLAGS,$(base)) -T $(obj)/efi.lds -N $< $(rel= ocs-dummy) \ $(BASEDIR)/common/symbols-dummy.o $(note_file_option) -o = $(@D)/.$(@F).$(base).0 &&) : $(MKRELOC) $(foreach base,$(VIRT_BASE) $(ALT_BASE),$(@D)/.$(@F).$(base).0= ) >$(@D)/.$(@F).0r.S $(NM) -pa --format=3Dsysv $(@D)/.$(@F).$(VIRT_BASE).0 \ | $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort >$(@D)/.$(@F).0s= .S $(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).0r.o $(@D)/.$(@F).0s.o $(foreach base, $(VIRT_BASE) $(ALT_BASE), \ - $(LD) $(call EFI_LDFLAGS,$(base)) -T efi.lds -N $< \ + $(LD) $(call EFI_LDFLAGS,$(base)) -T $(obj)/efi.lds -N $< \ $(@D)/.$(@F).0r.o $(@D)/.$(@F).0s.o $(note_file_option) -= o $(@D)/.$(@F).$(base).1 &&) : $(MKRELOC) $(foreach base,$(VIRT_BASE) $(ALT_BASE),$(@D)/.$(@F).$(base).1= ) >$(@D)/.$(@F).1r.S $(NM) -pa --format=3Dsysv $(@D)/.$(@F).$(VIRT_BASE).1 \ | $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort >$(@D)/.$(@F).1s= .S $(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).1r.o $(@D)/.$(@F).1s.o - $(LD) $(call EFI_LDFLAGS,$(VIRT_BASE)) -T efi.lds -N $< \ + $(LD) $(call EFI_LDFLAGS,$(VIRT_BASE)) -T $(obj)/efi.lds -N $< \ $(@D)/.$(@F).1r.o $(@D)/.$(@F).1s.o $(note_file_option) -= o $@ $(NM) -pa --format=3Dsysv $(@D)/$(@F) \ | $(BASEDIR)/tools/symbols --all-symbols --xensyms --sysv --sort >$(@D)/= $(@F).map @@ -253,15 +253,15 @@ $(TARGET).efi: FORCE echo '$(if $(filter y,$(XEN_BUILD_EFI)),xen.efi generation,EFI support) d= isabled' endif =20 -efi/buildid.o efi/relocs-dummy.o: $(BASEDIR)/arch/x86/efi/built_in.o -efi/buildid.o efi/relocs-dummy.o: ; +$(obj)/efi/buildid.o $(obj)/efi/relocs-dummy.o: $(BASEDIR)/arch/x86/efi/bu= ilt_in.o +$(obj)/efi/buildid.o $(obj)/efi/relocs-dummy.o: ; =20 .PHONY: include include: $(BASEDIR)/include/arch-x86/asm/asm-macros.h =20 -asm-macros.i: CFLAGS-y +=3D -D__ASSEMBLY__ -P +$(obj)/asm-macros.i: CFLAGS-y +=3D -D__ASSEMBLY__ -P =20 -$(BASEDIR)/include/arch-x86/asm/asm-macros.h: asm-macros.i Makefile +$(BASEDIR)/include/arch-x86/asm/asm-macros.h: $(obj)/asm-macros.i $(src)/M= akefile echo '#if 0' >$@.new echo '.if 0' >>$@.new echo '#endif' >>$@.new @@ -275,14 +275,14 @@ $(BASEDIR)/include/arch-x86/asm/asm-macros.h: asm-mac= ros.i Makefile echo '#endif' >>$@.new $(call move-if-changed,$@.new,$@) =20 -efi.lds: AFLAGS-y +=3D -DEFI -xen.lds efi.lds: xen.lds.S FORCE +$(obj)/efi.lds: AFLAGS-y +=3D -DEFI +$(obj)/xen.lds $(obj)/efi.lds: $(src)/xen.lds.S FORCE $(call if_changed,cpp_lds_S) =20 -boot/mkelf32: boot/mkelf32.c +$(obj)/boot/mkelf32: $(src)/boot/mkelf32.c $(HOSTCC) $(HOSTCFLAGS) -o $@ $< =20 -efi/mkreloc: efi/mkreloc.c +$(obj)/efi/mkreloc: $(src)/efi/mkreloc.c $(HOSTCC) $(HOSTCFLAGS) -g -o $@ $< =20 .PHONY: clean diff --git a/xen/arch/x86/boot/Makefile b/xen/arch/x86/boot/Makefile index 9b31bfcbfb8a..53d357489df2 100644 --- a/xen/arch/x86/boot/Makefile +++ b/xen/arch/x86/boot/Makefile @@ -1,8 +1,8 @@ obj-bin-y +=3D head.o =20 -DEFS_H_DEPS =3D defs.h $(BASEDIR)/include/xen/stdbool.h +DEFS_H_DEPS =3D $(src)/defs.h $(BASEDIR)/include/xen/stdbool.h =20 -CMDLINE_DEPS =3D $(DEFS_H_DEPS) video.h +CMDLINE_DEPS =3D $(DEFS_H_DEPS) $(src)/video.h =20 RELOC_DEPS =3D $(DEFS_H_DEPS) \ $(BASEDIR)/include/generated/autoconf.h \ @@ -11,10 +11,10 @@ RELOC_DEPS =3D $(DEFS_H_DEPS) \ $(BASEDIR)/include/xen/multiboot2.h \ $(BASEDIR)/include/public/arch-x86/hvm/start_info.h =20 -head.o: cmdline.S reloc.S +$(obj)/head.o: $(obj)/cmdline.S $(obj)/reloc.S =20 -cmdline.S: cmdline.c $(CMDLINE_DEPS) - $(MAKE) -f build32.mk $@ CMDLINE_DEPS=3D"$(CMDLINE_DEPS)" +$(obj)/cmdline.S: $(src)/cmdline.c $(CMDLINE_DEPS) + $(MAKE) -f build32.mk -C $(obj) $(@F) CMDLINE_DEPS=3D"$(CMDLINE_DEPS)" =20 -reloc.S: reloc.c $(RELOC_DEPS) - $(MAKE) -f build32.mk $@ RELOC_DEPS=3D"$(RELOC_DEPS)" +$(obj)/reloc.S: $(src)/reloc.c $(RELOC_DEPS) + $(MAKE) -f build32.mk -C $(obj) $(@F) RELOC_DEPS=3D"$(RELOC_DEPS)" diff --git a/xen/arch/x86/efi/Makefile b/xen/arch/x86/efi/Makefile index 87b927ed865b..ac815f02cb5e 100644 --- a/xen/arch/x86/efi/Makefile +++ b/xen/arch/x86/efi/Makefile @@ -3,16 +3,16 @@ CFLAGS-y +=3D -fshort-wchar quiet_cmd_objcopy_o_ihex =3D OBJCOPY $@ cmd_objcopy_o_ihex =3D $(OBJCOPY) -I ihex -O binary $< $@ =20 -%.o: %.ihex FORCE +$(obj)/%.o: $(src)/%.ihex FORCE $(call if_changed,objcopy_o_ihex) =20 -boot.init.o: buildid.o +$(obj)/boot.init.o: $(obj)/buildid.o =20 EFIOBJ-y :=3D boot.init.o pe.init.o ebmalloc.o runtime.o EFIOBJ-$(CONFIG_COMPAT) +=3D compat.o =20 $(call cc-option-add,cflags-stack-boundary,CC,-mpreferred-stack-boundary= =3D4) -$(EFIOBJ-y): CFLAGS-stack-boundary :=3D $(cflags-stack-boundary) +$(addprefix $(obj)/,$(EFIOBJ-y)): CFLAGS-stack-boundary :=3D $(cflags-stac= k-boundary) =20 obj-y :=3D stub.o obj-$(XEN_BUILD_EFI) :=3D $(filter-out %.init.o,$(EFIOBJ-y)) diff --git a/xen/common/Makefile b/xen/common/Makefile index 93df3178b71f..0d5509583427 100644 --- a/xen/common/Makefile +++ b/xen/common/Makefile @@ -75,15 +75,15 @@ obj-$(CONFIG_NEEDS_LIBELF) +=3D libelf/ obj-$(CONFIG_HAS_DEVICE_TREE) +=3D libfdt/ =20 CONF_FILE :=3D $(if $(patsubst /%,,$(KCONFIG_CONFIG)),$(BASEDIR)/)$(KCONFI= G_CONFIG) -config.gz: $(CONF_FILE) +$(obj)/config.gz: $(CONF_FILE) gzip -n -c $< >$@ =20 -config_data.o: config.gz +$(obj)/config_data.o: $(obj)/config.gz =20 quiet_cmd_binfile =3D BINFILE $@ -cmd_binfile =3D $(SHELL) $< $@ config.gz xen_config_data +cmd_binfile =3D $(SHELL) $< $@ $(obj)/config.gz xen_config_data =20 -config_data.S: $(BASEDIR)/tools/binfile FORCE +$(obj)/config_data.S: $(BASEDIR)/tools/binfile FORCE $(call if_changed,binfile) targets +=3D config_data.S =20 diff --git a/xen/common/libelf/Makefile b/xen/common/libelf/Makefile index a92326c982e9..8a4522e4e141 100644 --- a/xen/common/libelf/Makefile +++ b/xen/common/libelf/Makefile @@ -7,10 +7,10 @@ OBJCOPYFLAGS :=3D $(foreach s,$(SECTIONS),--rename-sectio= n .$(s)=3D.init.$(s)) =20 CFLAGS-y +=3D -Wno-pointer-sign =20 -libelf.o: libelf-temp.o FORCE +$(obj)/libelf.o: $(obj)/libelf-temp.o FORCE $(call if_changed,objcopy) =20 -libelf-temp.o: $(libelf-objs) FORCE +$(obj)/libelf-temp.o: $(addprefix $(obj)/,$(libelf-objs)) FORCE $(call if_changed,ld) =20 extra-y +=3D libelf-temp.o $(libelf-objs) diff --git a/xen/common/libfdt/Makefile b/xen/common/libfdt/Makefile index 6bd207cf8ffa..6708af12e583 100644 --- a/xen/common/libfdt/Makefile +++ b/xen/common/libfdt/Makefile @@ -1,4 +1,4 @@ -include Makefile.libfdt +include $(src)/Makefile.libfdt =20 SECTIONS :=3D text data $(SPECIAL_DATA_SECTIONS) OBJCOPYFLAGS :=3D $(foreach s,$(SECTIONS),--rename-section .$(s)=3D.init.$= (s)) @@ -8,10 +8,10 @@ nocov-y +=3D libfdt.o =20 CFLAGS-y +=3D -I$(BASEDIR)/include/xen/libfdt/ =20 -libfdt.o: libfdt-temp.o FORCE +$(obj)/libfdt.o: $(obj)/libfdt-temp.o FORCE $(call if_changed,objcopy) =20 -libfdt-temp.o: $(LIBFDT_OBJS) FORCE +$(obj)/libfdt-temp.o: $(addprefix $(obj)/,$(LIBFDT_OBJS)) FORCE $(call if_changed,ld) =20 extra-y +=3D libfdt-temp.o $(LIBFDT_OBJS) diff --git a/xen/include/Makefile b/xen/include/Makefile index 9feb57545ef1..a969e76ddcad 100644 --- a/xen/include/Makefile +++ b/xen/include/Makefile @@ -39,57 +39,57 @@ cppflags-$(CONFIG_X86) +=3D -m32 =20 endif =20 -public-$(CONFIG_X86) :=3D $(wildcard public/arch-x86/*.h public/arch-x86/*= /*.h) -public-$(CONFIG_ARM) :=3D $(wildcard public/arch-arm/*.h public/arch-arm/*= /*.h) +public-$(CONFIG_X86) :=3D $(wildcard $(src)/public/arch-x86/*.h $(src)/pub= lic/arch-x86/*/*.h) +public-$(CONFIG_ARM) :=3D $(wildcard $(src)/public/arch-arm/*.h $(src)/pub= lic/arch-arm/*/*.h) =20 .PHONY: all -all: $(headers-y) +all: $(addprefix $(obj)/,$(headers-y)) =20 -compat/%.h: compat/%.i $(BASEDIR)/tools/compat-build-header.py - $(PYTHON) $(BASEDIR)/tools/compat-build-header.py <$< $@ >>$@.new; \ +$(obj)/compat/%.h: $(obj)/compat/%.i $(BASEDIR)/tools/compat-build-header.= py + $(PYTHON) $(BASEDIR)/tools/compat-build-header.py <$< $(patsubst $(obj)/%= ,%,$@) >>$@.new; \ mv -f $@.new $@ =20 -compat/%.i: compat/%.c Makefile +$(obj)/compat/%.i: $(obj)/compat/%.c $(src)/Makefile $(CPP) $(filter-out -Wa$(comma)% -include %/include/xen/config.h,$(XEN_CF= LAGS)) $(cppflags-y) -o $@ $< =20 -compat/%.c: public/%.h xlat.lst $(BASEDIR)/tools/compat-build-source.py +$(obj)/compat/%.c: $(src)/public/%.h $(src)/xlat.lst $(BASEDIR)/tools/comp= at-build-source.py mkdir -p $(@D) - $(PYTHON) $(BASEDIR)/tools/compat-build-source.py xlat.lst <$< >$@.new + $(PYTHON) $(BASEDIR)/tools/compat-build-source.py $(src)/xlat.lst <$< >$@= .new mv -f $@.new $@ =20 -compat/.xlat/%.h: compat/%.h compat/.xlat/%.lst $(BASEDIR)/tools/get-field= s.sh Makefile +$(obj)/compat/.xlat/%.h: $(obj)/compat/%.h $(obj)/compat/.xlat/%.lst $(BAS= EDIR)/tools/get-fields.sh $(src)/Makefile export PYTHON=3D$(PYTHON); \ while read what name; do \ $(SHELL) $(BASEDIR)/tools/get-fields.sh "$$what" compat_$$name $< || exi= t $$?; \ done <$(patsubst compat/%,compat/.xlat/%,$(basename $<)).lst >$@.new mv -f $@.new $@ =20 -.PRECIOUS: compat/.xlat/%.lst -compat/.xlat/%.lst: xlat.lst Makefile +.PRECIOUS: $(obj)/compat/.xlat/%.lst +$(obj)/compat/.xlat/%.lst: $(src)/xlat.lst $(src)/Makefile mkdir -p $(@D) grep -v '^[[:blank:]]*#' $< | sed -ne 's,@arch@,$(compat-arch-y),g' -re '= s,[[:blank:]]+$*\.h[[:blank:]]*$$,,p' >$@.new $(call move-if-changed,$@.new,$@) =20 -xlat-y :=3D $(shell sed -ne 's,@arch@,$(compat-arch-y),g' -re 's,^[?!][[:b= lank:]]+[^[:blank:]]+[[:blank:]]+,,p' xlat.lst | uniq) +xlat-y :=3D $(shell sed -ne 's,@arch@,$(compat-arch-y),g' -re 's,^[?!][[:b= lank:]]+[^[:blank:]]+[[:blank:]]+,,p' $(src)/xlat.lst | uniq) xlat-y :=3D $(filter $(patsubst compat/%,%,$(headers-y)),$(xlat-y)) =20 -compat/xlat.h: $(addprefix compat/.xlat/,$(xlat-y)) config/auto.conf Makef= ile +$(obj)/compat/xlat.h: $(addprefix $(obj)/compat/.xlat/,$(xlat-y)) $(obj)/c= onfig/auto.conf $(src)/Makefile cat $(filter %.h,$^) >$@.new mv -f $@.new $@ =20 ifeq ($(XEN_TARGET_ARCH),$(XEN_COMPILE_ARCH)) =20 -all: headers.chk headers99.chk headers++.chk +all: $(obj)/headers.chk $(obj)/headers99.chk $(obj)/headers++.chk =20 -PUBLIC_HEADERS :=3D $(filter-out public/arch-% public/dom0_ops.h, $(wildca= rd public/*.h public/*/*.h) $(public-y)) +PUBLIC_HEADERS :=3D $(filter-out $(src)/public/arch-% $(src)/public/dom0_o= ps.h, $(wildcard $(src)/public/*.h $(src)/public/*/*.h) $(public-y)) =20 -PUBLIC_C99_HEADERS :=3D public/io/9pfs.h public/io/pvcalls.h -PUBLIC_ANSI_HEADERS :=3D $(filter-out public/%ctl.h public/xsm/% public/%h= vm/save.h $(PUBLIC_C99_HEADERS), $(PUBLIC_HEADERS)) +PUBLIC_C99_HEADERS :=3D $(src)/public/io/9pfs.h $(src)/public/io/pvcalls.h +PUBLIC_ANSI_HEADERS :=3D $(filter-out $(src)/public/%ctl.h $(src)/public/x= sm/% $(src)/public/%hvm/save.h $(PUBLIC_C99_HEADERS), $(PUBLIC_HEADERS)) =20 public/io/9pfs.h-prereq :=3D string public/io/pvcalls.h-prereq :=3D string =20 -headers.chk: $(PUBLIC_ANSI_HEADERS) Makefile +$(obj)/headers.chk: $(PUBLIC_ANSI_HEADERS) $(src)/Makefile for i in $(filter %.h,$^); do \ $(CC) -x c -ansi -Wall -Werror -include stdint.h \ -S -o /dev/null $$i || exit 1; \ @@ -97,7 +97,7 @@ headers.chk: $(PUBLIC_ANSI_HEADERS) Makefile done >$@.new mv $@.new $@ =20 -headers99.chk: $(PUBLIC_C99_HEADERS) Makefile +$(obj)/headers99.chk: $(PUBLIC_C99_HEADERS) $(src)/Makefile rm -f $@.new $(foreach i, $(filter %.h,$^), \ echo "#include "\"$(i)\" \ @@ -107,7 +107,7 @@ headers99.chk: $(PUBLIC_C99_HEADERS) Makefile || exit $$?; echo $(i) >> $@.new;) mv $@.new $@ =20 -headers++.chk: $(PUBLIC_HEADERS) Makefile +$(obj)/headers++.chk: $(PUBLIC_HEADERS) $(src)/Makefile rm -f $@.new if ! $(CXX) -v >/dev/null 2>&1; then \ touch $@.new; \ @@ -116,7 +116,7 @@ headers++.chk: $(PUBLIC_HEADERS) Makefile $(foreach i, $(filter %.h,$^), \ echo "#include "\"$(i)\" \ | $(CXX) -x c++ -std=3Dgnu++98 -Wall -Werror -D__XEN_TOOLS__ \ - -include stdint.h -include public/xen.h \ + -include stdint.h -include $(src)/public/xen.h \ $(foreach j, $($(i)-prereq), -include c$(j)) -S -o /dev/null - \ || exit $$?; echo $(i) >> $@.new;) mv $@.new $@ @@ -126,7 +126,7 @@ endif ifeq ($(XEN_TARGET_ARCH),x86_64) .PHONY: lib-x86-all lib-x86-all: - $(MAKE) -C xen/lib/x86 all + $(MAKE) -C $(obj)/xen/lib/x86 all =20 all: lib-x86-all endif diff --git a/xen/scripts/Makefile.clean b/xen/scripts/Makefile.clean index b6df9e861e6e..36b7e7e92f93 100644 --- a/xen/scripts/Makefile.clean +++ b/xen/scripts/Makefile.clean @@ -3,11 +3,14 @@ # Cleaning up # =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 +obj :=3D . +src :=3D $(obj) + clean:: =20 include $(BASEDIR)/scripts/Kbuild.include =20 -include Makefile +include $(src)/Makefile =20 # Figure out what we need to clean from the various variables # =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D diff --git a/xen/xsm/flask/Makefile b/xen/xsm/flask/Makefile index 0ad15cb16606..3ea726d66f8b 100644 --- a/xen/xsm/flask/Makefile +++ b/xen/xsm/flask/Makefile @@ -4,48 +4,48 @@ obj-y +=3D flask_op.o =20 obj-y +=3D ss/ =20 -CFLAGS-y +=3D -I./include +CFLAGS-y +=3D -I$(obj)/include =20 AWK =3D awk =20 -FLASK_H_DEPEND =3D policy/security_classes policy/initial_sids -AV_H_DEPEND =3D policy/access_vectors +FLASK_H_DEPEND :=3D $(addprefix $(src)/policy/,security_classes initial_si= ds) +AV_H_DEPEND =3D $(src)/policy/access_vectors =20 -FLASK_H_FILES =3D include/flask.h include/class_to_string.h include/initia= l_sid_to_string.h -AV_H_FILES =3D include/av_perm_to_string.h include/av_permissions.h -ALL_H_FILES =3D $(FLASK_H_FILES) $(AV_H_FILES) +FLASK_H_FILES :=3D flask.h class_to_string.h initial_sid_to_string.h +AV_H_FILES :=3D av_perm_to_string.h av_permissions.h +ALL_H_FILES :=3D $(addprefix include/,$(FLASK_H_FILES) $(AV_H_FILES)) =20 -$(obj-y) ss/built_in.o: $(ALL_H_FILES) +$(addprefix $(obj)/,$(obj-y)) $(obj)/ss/built_in.o: $(addprefix $(obj)/,$(= ALL_H_FILES)) extra-y +=3D $(ALL_H_FILES) =20 -mkflask :=3D policy/mkflask.sh +mkflask :=3D $(src)/policy/mkflask.sh quiet_cmd_mkflask =3D MKFLASK $@ -cmd_mkflask =3D $(SHELL) $(mkflask) $(AWK) include $(FLASK_H_DEPEND) +cmd_mkflask =3D $(SHELL) $(mkflask) $(AWK) $(obj)/include $(FLASK_H_DEPEND) =20 -$(subst include/,%/,$(FLASK_H_FILES)): $(FLASK_H_DEPEND) $(mkflask) FORCE +$(addprefix $(obj)/%/,$(FLASK_H_FILES)): $(FLASK_H_DEPEND) $(mkflask) FORCE $(call if_changed,mkflask) =20 -mkaccess :=3D policy/mkaccess_vector.sh +mkaccess :=3D $(src)/policy/mkaccess_vector.sh quiet_cmd_mkaccess =3D MKACCESS VECTOR $@ -cmd_mkaccess =3D $(SHELL) $(mkaccess) $(AWK) $(AV_H_DEPEND) +cmd_mkaccess =3D $(SHELL) $(mkaccess) $(AWK) $(obj)/include $(AV_H_DEPEND) =20 -$(subst include/,%/,$(AV_H_FILES)): $(AV_H_DEPEND) $(mkaccess) FORCE +$(addprefix $(obj)/%/,$(AV_H_FILES)): $(AV_H_DEPEND) $(mkaccess) FORCE $(call if_changed,mkaccess) =20 obj-bin-$(CONFIG_XSM_FLASK_POLICY) +=3D flask-policy.o -flask-policy.o: policy.bin +$(obj)/flask-policy.o: $(obj)/policy.bin =20 quiet_cmd_binfile =3D BINFILE $@ -cmd_binfile =3D $(SHELL) $< -i $@ policy.bin xsm_flask_init_policy +cmd_binfile =3D $(SHELL) $< -i $@ $(obj)/policy.bin xsm_flask_init_policy =20 -flask-policy.S: $(BASEDIR)/tools/binfile FORCE +$(obj)/flask-policy.S: $(BASEDIR)/tools/binfile FORCE $(call if_changed,binfile) targets +=3D flask-policy.S =20 FLASK_BUILD_DIR :=3D $(CURDIR) POLICY_SRC :=3D $(FLASK_BUILD_DIR)/xenpolicy-$(XEN_FULLVERSION) =20 -policy.bin: FORCE +$(obj)/policy.bin: FORCE $(MAKE) -f $(XEN_ROOT)/tools/flask/policy/Makefile.common -C $(XEN_ROOT)/= tools/flask/policy FLASK_BUILD_DIR=3D$(FLASK_BUILD_DIR) cmp -s $(POLICY_SRC) $@ || cp $(POLICY_SRC) $@ =20 diff --git a/xen/xsm/flask/policy/mkaccess_vector.sh b/xen/xsm/flask/policy= /mkaccess_vector.sh index 942ede4713f1..ad9772193bff 100755 --- a/xen/xsm/flask/policy/mkaccess_vector.sh +++ b/xen/xsm/flask/policy/mkaccess_vector.sh @@ -8,9 +8,12 @@ set -e awk=3D$1 shift =20 +output_dir=3D$1 +shift + # output files -av_permissions=3D"include/av_permissions.h" -av_perm_to_string=3D"include/av_perm_to_string.h" +av_permissions=3D"$output_dir/av_permissions.h" +av_perm_to_string=3D"$output_dir/av_perm_to_string.h" =20 cat $* | $awk " BEGIN { --=20 Anthony PERARD