[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [XEN PATCH v9 09/30] build: build everything from the root dir, use obj=$subdir
On 1/25/22 06:00, Anthony PERARD wrote: > A subdirectory is now built by setting "$(obj)" instead of changing > directory. "$(obj)" should always be set when using "Rules.mk" and > thus a shortcut "$(build)" is introduced and should be used. > > A new variable "$(need-builtin)" is introduce. It is to be used > whenever a "built_in.o" is wanted from a subdirectory. "built_in.o" > isn't the main target anymore, and thus only needs to depends on the > objects that should be part of "built_in.o". > > Introduce $(srctree) and $(objtree) to replace $(BASEDIR) in cases a > relative path is better, and $(abs_srctree) and $(abs_objtree) which > have an absolute path. > > DEPS is updated as the existing macro to deal with it doesn't know > about $(obj). > > There's some changes in "Rules.mk" which in addition to deal with > "$(obj)" also make it's looks more like "Makefile.build" from Linux > v5.12. > > test/Makefile doesn't need special handling in order to build > everything under test/, Rules.mk will visit test/livepatch via > $(subdir-y), thus "tests" "all" and "build" target are removed. > "subtree-force-update" target isn't useful so it is removed as well. > > test/livepatch/Makefile doesn't need default target anymore, Rules.mk > will build everything in $(extra-y) and thus all *.livepatch. > > Adjust cloc recipe: dependency files generated by CC will now have the > full path to the source file, so we don't need to prepend the > subdirectory. This fix some issue with source not been parsed by cloc > before. Also source from tools/kconfig would be listed with changes in > this patch so adjust the find command to stop listing the "tools" > directory and thus kconfig. With a default build of Xen on X86, they > are a few new files parsed by cloc: > arch/x86/x86_64/compat/mm.c > arch/x86/x86_64/mm.c > common/compat/domain.c > common/compat/memory.c > common/compat/xlat.c > > Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx> > Acked-by: Bob Eshleman <bobbyeshleman@xxxxxxxxx> > Acked-by: Julien Grall <jgrall@xxxxxxxxxx> > Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx> > --- > > Notes: > v9: > - reviewed > > v8: > - rebased > - move check for $(obj) in Rules.mk earlier > - use $(sort ) when adding directories in $(subdir-y) > - fix missing space between "DEPS" and ":=" > - use -iquote when adding '.' for xen/arch/x86/usercopy.o > - introduce also abs_srctree and abs_objtree > those were in patch "build: replace $(BASEDIR) by $(objtree)" > - reworked cmd_objcopy_fix_sym, we don't need to do anything for old > version of clang, and for recent version of clang the change is the > same a for gcc. > - adjust "cloc" recipe > - add some more $(Q) to silent $(MAKE) $(build)=... > > v7: > - Spell "Makefile.build" as "Rules.mk" in the warning in Rules.mk about > undefined $(obj). > - use $(srctree) for include/xen/config.h > - handle $(nocov-y) and $(noubsan-y), needed to add $(obj)/ > > xen/Makefile | 36 ++++++---- > xen/Rules.mk | 138 ++++++++++++++++++++++++------------ > xen/arch/arm/Makefile | 4 +- > xen/arch/arm/Rules.mk | 4 -- > xen/arch/arm/arch.mk | 4 +- > xen/arch/riscv/arch.mk | 4 +- > xen/arch/x86/Makefile | 11 +-- > xen/arch/x86/Rules.mk | 4 +- > xen/arch/x86/arch.mk | 12 ++-- > xen/arch/x86/boot/Makefile | 8 +-- > xen/build.mk | 12 +++- > xen/include/Makefile | 6 +- > xen/scripts/Kbuild.include | 6 ++ > xen/test/Makefile | 7 +- > xen/test/livepatch/Makefile | 6 -- > xen/xsm/flask/Makefile | 2 +- > xen/xsm/flask/ss/Makefile | 2 +- > 17 files changed, 162 insertions(+), 104 deletions(-) > <snip/> > diff --git a/xen/xsm/flask/Makefile b/xen/xsm/flask/Makefile > index 51fd37f6c4d5..49cf730cf098 100644 > --- a/xen/xsm/flask/Makefile > +++ b/xen/xsm/flask/Makefile > @@ -40,7 +40,7 @@ $(obj)/flask-policy.S: $(BASEDIR)/tools/binfile FORCE > $(call if_changed,binfile,$(obj)/policy.bin xsm_flask_init_policy) > targets += flask-policy.S > > -FLASK_BUILD_DIR := $(CURDIR) > +FLASK_BUILD_DIR := $(abs_objtree)/$(obj) > POLICY_SRC := $(FLASK_BUILD_DIR)/xenpolicy-$(XEN_FULLVERSION) > > $(obj)/policy.bin: FORCE > diff --git a/xen/xsm/flask/ss/Makefile b/xen/xsm/flask/ss/Makefile > index d32b9e07138e..aba1339f3808 100644 > --- a/xen/xsm/flask/ss/Makefile > +++ b/xen/xsm/flask/ss/Makefile > @@ -8,4 +8,4 @@ obj-y += services.o > obj-y += conditional.o > obj-y += mls.o > > -CFLAGS-y += -I../include > +CFLAGS-y += -I$(srctree)/xsm/flask/include Reviewed-by: Daniel P. Smith <dpsmith@xxxxxxxxxxxxxxxxxxxx> V/r, Daniel P. Smith Apertus Solutions, LLC
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |