From: Anthony PERARD <anthony.perard@citrix.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: "Bob Eshleman" <bobbyeshleman@gmail.com>,
"Andrew Cooper" <andrew.cooper3@citrix.com>,
"George Dunlap" <george.dunlap@citrix.com>,
"Ian Jackson" <iwj@xenproject.org>,
"Julien Grall" <julien@xen.org>,
"Stefano Stabellini" <sstabellini@kernel.org>,
"Wei Liu" <wl@xen.org>,
"Volodymyr Babchuk" <Volodymyr_Babchuk@epam.com>,
"Alistair Francis" <alistair.francis@wdc.com>,
"Connor Davis" <connojdavis@gmail.com>,
"Roger Pau Monné" <roger.pau@citrix.com>,
"Konrad Rzeszutek Wilk" <konrad.wilk@oracle.com>,
"Ross Lagerwall" <ross.lagerwall@citrix.com>,
"Daniel De Graaf" <dgdegra@tycho.nsa.gov>,
"Daniel P. Smith" <dpsmith@apertussolutions.com>,
xen-devel@lists.xenproject.org
Subject: Re: [XEN PATCH v7 26/51] build: build everything from the root dir, use obj=$subdir
Date: Wed, 13 Oct 2021 15:24:26 +0100 [thread overview]
Message-ID: <YWbsGlcDZSSXsJlx@perard> (raw)
In-Reply-To: <eca3f533-9841-e4a8-dfde-840451ed8aef@suse.com>
On Mon, Oct 11, 2021 at 04:02:22PM +0200, Jan Beulich wrote:
> On 24.08.2021 12:50, 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".
>
> How "good" are our chances that we hit a need-builtin variable from
> the environment? Its uses are simply using "ifdef".
I think it would be low as Linux is using the same one. If it were
define, I think that would mean building a few more object than
expected which would not be used.
> > --- a/xen/Rules.mk
> > +++ b/xen/Rules.mk
> > @@ -3,19 +3,29 @@
> > # Makefile and are consumed by Rules.mk
> > #
> >
> > -obj := .
> > src := $(obj)
> >
> > +PHONY := __build
> > +__build:
> > +
> > -include $(BASEDIR)/include/config/auto.conf
> >
> > include $(XEN_ROOT)/Config.mk
> > include $(BASEDIR)/scripts/Kbuild.include
> >
> > +ifndef obj
> > +$(warning kbuild: Rules.mk is included improperly)
> > +endif
>
> Is there a particular reason for this to come only here, rather than
> before the include-s (e.g. right at where the assignment to the
> variable lived)?
Probably not, Linux's Kbuild does check it quite late but I don't know the
reason. I can move the check earlier.
> > @@ -51,27 +61,54 @@ cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $< $@
> > quiet_cmd_binfile = BINFILE $@
> > cmd_binfile = $(SHELL) $(BASEDIR)/tools/binfile $(BINFILE_FLAGS) $@ $(2)
> >
> > -define gendep
> > - ifneq ($(1),$(subst /,:,$(1)))
> > - DEPS += $(dir $(1)).$(notdir $(1)).d
> > - endif
> > -endef
> > -$(foreach o,$(filter-out %/,$(obj-y) $(obj-bin-y) $(extra-y)),$(eval $(call gendep,$(o))))
> > +# Figure out what we need to build from the various variables
> > +# ===========================================================================
> > +
> > +# Libraries are always collected in one lib file.
> > +# Filter out objects already built-in
> > +lib-y := $(filter-out $(obj-y), $(sort $(lib-y)))
> > +
> > +# Subdirectories we need to descend into
> > +subdir-y := $(subdir-y) $(patsubst %/,%,$(filter %/, $(obj-y)))
>
> Deliberately or accidentally not += ?
Seems to be accidentally. Kbuild does a $(sort ) here, I should probably
do the same, just to get rid of duplicates if they are any.
> > @@ -156,21 +192,13 @@ endif
> > PHONY += FORCE
> > FORCE:
> >
> > -%/built_in.o %/lib.a: FORCE
> > - $(MAKE) -f $(BASEDIR)/Rules.mk -C $* built_in.o
> > -
> > -%/built_in_bin.o: FORCE
> > - $(MAKE) -f $(BASEDIR)/Rules.mk -C $* built_in_bin.o
> > -
> > -SRCPATH := $(patsubst $(BASEDIR)/%,%,$(CURDIR))
> > -
> > quiet_cmd_cc_o_c = CC $@
> > ifeq ($(CONFIG_ENFORCE_UNIQUE_SYMBOLS),y)
> > cmd_cc_o_c = $(CC) $(c_flags) -c $< -o $(dot-target).tmp -MQ $@
> > ifeq ($(CONFIG_CC_IS_CLANG),y)
> > - cmd_objcopy_fix_sym = $(OBJCOPY) --redefine-sym $<=$(SRCPATH)/$< $(dot-target).tmp $@
> > + cmd_objcopy_fix_sym = $(OBJCOPY) --redefine-sym $(<F)=$< $(dot-target).tmp $@
>
> Are you sure about the $< => $(<F) transformation here? Previoiusly it
> was present only ...
I have to check again. Maybe $< didn't work and it's more obvious with
this patch. Or maybe that depends on the version of clang.
> > else
> > - cmd_objcopy_fix_sym = $(OBJCOPY) --redefine-sym $(<F)=$(SRCPATH)/$< $(dot-target).tmp $@
> > + cmd_objcopy_fix_sym = $(OBJCOPY) --redefine-sym $(<F)=$< $(dot-target).tmp $@
>
> ... here.
>
> > @@ -251,6 +292,9 @@ existing-targets := $(wildcard $(sort $(targets)))
> >
> > -include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd)
> >
> > +DEPS:= $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).d)
>
> Nit: Preferably blanks on both sides of := or none at all, please.
Will fix.
> > --- a/xen/arch/x86/Makefile
> > +++ b/xen/arch/x86/Makefile
> > @@ -81,6 +81,9 @@ endif
> > extra-y += asm-macros.i
> > extra-y += xen.lds
> >
> > +# Allows usercopy.c to includes itself
>
> Nit: include
Indeed.
> > +$(obj)/usercopy.o: CFLAGS-y += -I.
>
> This is ugly, but presumably unavoidable. Preferably I would see us
> the more specific -iquote though, assuming clang also supports it.
clang does have -iquote, so I guess it could be used. That would be the
first use of -iquote so I hope nothing would break with it.
> > --- a/xen/arch/x86/boot/Makefile
> > +++ b/xen/arch/x86/boot/Makefile
> > @@ -1,8 +1,8 @@
> > obj-bin-y += head.o
> >
> > -DEFS_H_DEPS = $(src)/defs.h $(BASEDIR)/include/xen/stdbool.h
> > +DEFS_H_DEPS = $(BASEDIR)/$(src)/defs.h $(BASEDIR)/include/xen/stdbool.h
> >
> > -CMDLINE_DEPS = $(DEFS_H_DEPS) $(src)/video.h
> > +CMDLINE_DEPS = $(DEFS_H_DEPS) $(BASEDIR)/$(src)/video.h
>
> Hmm, new uses of $(BASEDIR) (a few more further down). Why not
> $(srctree)?
I think I haven't introduce $(abs_srctree) yet, and this needs to be an
absolute path (the path is also used by a make which run from a
different current directory).
Thanks,
--
Anthony PERARD
next prev parent reply other threads:[~2021-10-13 14:25 UTC|newest]
Thread overview: 161+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-24 10:49 [XEN PATCH v7 00/51] xen: Build system improvements, now with out-of-tree build! Anthony PERARD
2021-08-24 10:49 ` [XEN PATCH v7 01/51] build: introduce cpp_flags macro Anthony PERARD
2021-09-02 10:08 ` Jan Beulich
2021-09-06 10:06 ` Anthony PERARD
2021-09-06 10:30 ` Jan Beulich
2021-09-06 11:21 ` Anthony PERARD
2021-08-24 10:49 ` [XEN PATCH v7 02/51] build: use if_changed on built_in.o Anthony PERARD
2021-08-24 10:49 ` [XEN PATCH v7 03/51] build: use if_changed_rules with %.o:%.c targets Anthony PERARD
2021-08-24 10:49 ` [XEN PATCH v7 04/51] build: factorise generation of the linker scripts Anthony PERARD
2021-09-07 14:22 ` Anthony PERARD
2021-08-24 10:49 ` [XEN PATCH v7 05/51] x86/mm: avoid building multiple .o from a single .c file Anthony PERARD
2021-09-07 6:14 ` Jan Beulich
2021-09-08 11:14 ` Anthony PERARD
2021-09-08 11:44 ` Ian Jackson
2021-10-11 14:13 ` Andrew Cooper
2021-09-08 12:01 ` Jan Beulich
2021-09-09 10:03 ` Anthony PERARD
2021-08-24 10:49 ` [XEN PATCH v7 06/51] build,include: rework compat-build-source.py Anthony PERARD
2021-08-24 10:49 ` [XEN PATCH v7 07/51] build,include: rework compat-build-header.py Anthony PERARD
2021-08-24 10:49 ` [XEN PATCH v7 08/51] build: fix clean targets when subdir-y is used Anthony PERARD
2021-08-24 10:49 ` [XEN PATCH v7 09/51] build: use subdir-y in test/Makefile Anthony PERARD
2021-09-02 10:17 ` Jan Beulich
2021-08-24 10:49 ` [XEN PATCH v7 10/51] build,arm: move LDFLAGS change to arch.mk Anthony PERARD
2021-08-24 12:50 ` Julien Grall
2021-08-24 15:00 ` Anthony PERARD
2021-08-24 15:23 ` Julien Grall
2021-08-24 16:14 ` Anthony PERARD
2021-08-24 10:49 ` [XEN PATCH v7 11/51] build: move make option changes check earlier Anthony PERARD
2021-08-24 10:49 ` [XEN PATCH v7 12/51] build: avoid building arm/arm/*/head.o twice Anthony PERARD
2021-08-24 12:53 ` Julien Grall
2021-08-24 15:12 ` Anthony PERARD
2021-08-24 15:20 ` Julien Grall
2021-08-24 10:50 ` [XEN PATCH v7 13/51] build: convert binfile use to if_changed Anthony PERARD
2021-10-07 13:55 ` Jan Beulich
2021-08-24 10:50 ` [XEN PATCH v7 14/51] xen: move include/asm-* to arch/*/include/asm Anthony PERARD
2021-10-07 14:17 ` Jan Beulich
2021-10-11 13:57 ` Anthony PERARD
2021-08-24 10:50 ` [XEN PATCH v7 15/51] build,riscv: tell the build system about riscv64/head.S Anthony PERARD
2021-08-24 10:50 ` [XEN PATCH v7 16/51] build: generate "include/xen/compile.h" with if_changed Anthony PERARD
2021-10-07 14:55 ` Jan Beulich
2021-10-11 14:11 ` Anthony PERARD
2021-08-24 10:50 ` [XEN PATCH v7 17/51] build: set XEN_BUILD_EFI earlier Anthony PERARD
2021-10-07 16:14 ` Jan Beulich
2021-10-11 14:21 ` Anthony PERARD
2021-08-24 10:50 ` [XEN PATCH v7 18/51] build: fix $(TARGET).efi creation in arch/arm Anthony PERARD
2021-10-11 10:37 ` Jan Beulich
2021-10-11 14:22 ` Anthony PERARD
2021-08-24 10:50 ` [XEN PATCH v7 19/51] build: fix arch/x86/note.o rule Anthony PERARD
2021-08-24 10:50 ` [XEN PATCH v7 20/51] build: avoid re-executing the main Makefile by introducing build.mk Anthony PERARD
2021-10-11 10:56 ` Jan Beulich
2021-10-11 14:58 ` Anthony PERARD
2021-10-11 15:31 ` Jan Beulich
2021-10-11 17:07 ` Anthony PERARD
2021-10-12 8:06 ` Jan Beulich
2021-08-24 10:50 ` [XEN PATCH v7 21/51] build: set ALL_OBJS to main Makefile; move prelink.o to main Makefile Anthony PERARD
2021-10-11 11:31 ` Jan Beulich
2021-10-13 12:30 ` Anthony PERARD
2021-10-13 12:41 ` Jan Beulich
2021-08-24 10:50 ` [XEN PATCH v7 22/51] build: clean common temporary files from root makefile Anthony PERARD
2021-10-11 11:41 ` Jan Beulich
2021-10-13 10:36 ` Anthony PERARD
2021-10-13 12:32 ` Jan Beulich
2021-10-13 14:26 ` Anthony PERARD
2021-08-24 10:50 ` [XEN PATCH v7 23/51] build,include: remove arch-*/*.h public header listing from headers*.chk Anthony PERARD
2021-10-11 11:49 ` Jan Beulich
2021-08-24 10:50 ` [XEN PATCH v7 24/51] build: prepare to always invoke $(MAKE) from xen/, use $(obj) Anthony PERARD
2021-10-11 12:39 ` Jan Beulich
2021-10-13 10:57 ` Anthony PERARD
2021-10-13 12:35 ` Jan Beulich
2021-08-24 10:50 ` [XEN PATCH v7 25/51] build: rework test/livepatch/Makefile Anthony PERARD
2021-10-11 13:28 ` Jan Beulich
2021-08-24 10:50 ` [XEN PATCH v7 26/51] build: build everything from the root dir, use obj=$subdir Anthony PERARD
2021-10-11 14:02 ` Jan Beulich
2021-10-13 14:24 ` Anthony PERARD [this message]
2021-10-14 13:33 ` Anthony PERARD
2021-10-14 13:54 ` Jan Beulich
2021-08-24 10:50 ` [XEN PATCH v7 27/51] build: introduce if_changed_deps Anthony PERARD
2021-10-11 14:20 ` Jan Beulich
2021-10-14 13:56 ` Anthony PERARD
2021-08-24 10:50 ` [XEN PATCH v7 28/51] build: rename __LINKER__ to LINKER_SCRIPT Anthony PERARD
2021-10-11 14:23 ` Jan Beulich
2021-08-24 10:50 ` [XEN PATCH v7 29/51] build: add an other explicite rules to not build $(XEN_ROOT)/.config Anthony PERARD
2021-10-11 14:29 ` Jan Beulich
2021-08-24 10:50 ` [XEN PATCH v7 30/51] build: hook kconfig into xen build system Anthony PERARD
2021-10-11 15:38 ` Jan Beulich
2021-10-14 15:09 ` Anthony PERARD
2021-08-24 10:50 ` [XEN PATCH v7 31/51] xen/tools/kconfig: fix build with -Wdeclaration-after-statement Anthony PERARD
2021-08-24 10:50 ` [XEN PATCH v7 32/51] build: Remove KBUILD_ specific from Makefile.host Anthony PERARD
2021-10-11 15:47 ` Jan Beulich
2021-10-14 14:18 ` Anthony PERARD
2021-08-24 10:50 ` [XEN PATCH v7 33/51] build: handle always-y and hostprogs-always-y Anthony PERARD
2021-10-11 15:48 ` Jan Beulich
2021-08-24 10:50 ` [XEN PATCH v7 34/51] build: start building the tools with the main makefiles Anthony PERARD
2021-10-11 15:49 ` Jan Beulich
2021-08-24 10:50 ` [XEN PATCH v7 35/51] build: Add headers path to CFLAGS once for all archs Anthony PERARD
2021-10-11 15:51 ` Jan Beulich
2021-08-24 10:50 ` [XEN PATCH v7 36/51] build: generate x86's asm-macros.h with filechk Anthony PERARD
2021-10-11 15:52 ` Jan Beulich
2021-08-24 10:50 ` [XEN PATCH v7 37/51] build: clean-up "clean" rules of duplication Anthony PERARD
2021-10-11 15:53 ` Jan Beulich
2021-08-24 10:50 ` [XEN PATCH v7 38/51] build: use main rune to build host binary x86's mkelf32 and mkreloc Anthony PERARD
2021-10-11 15:56 ` Jan Beulich
2021-10-14 14:20 ` Anthony PERARD
2021-08-24 10:50 ` [XEN PATCH v7 39/51] build: rework coverage and ubsan CFLAGS handling Anthony PERARD
2021-10-11 16:04 ` Jan Beulich
2021-08-24 10:50 ` [XEN PATCH v7 40/51] build: fix dependencies in arch/x86/boot Anthony PERARD
2021-10-14 8:08 ` Jan Beulich
2021-08-24 10:50 ` [XEN PATCH v7 41/51] build,x86: remove the need for build32.mk Anthony PERARD
2021-10-14 8:32 ` Jan Beulich
2021-10-15 15:52 ` Anthony PERARD
2021-10-18 8:43 ` Jan Beulich
2021-08-24 10:50 ` [XEN PATCH v7 42/51] build: grab common EFI source files in arch specific dir Anthony PERARD
2021-10-14 8:51 ` Jan Beulich
2021-10-15 16:29 ` Anthony PERARD
2021-10-18 8:48 ` Jan Beulich
2021-10-21 11:03 ` Anthony PERARD
2021-10-21 11:24 ` Jan Beulich
2021-10-21 13:54 ` Anthony PERARD
2021-10-21 14:16 ` Jan Beulich
2021-08-24 10:50 ` [XEN PATCH v7 43/51] build: replace $(BASEDIR) by $(objtree) Anthony PERARD
2021-10-14 9:21 ` Jan Beulich
2021-08-24 10:50 ` [XEN PATCH v7 44/51] build: add $(srctree) in few key places Anthony PERARD
2021-10-14 9:26 ` Jan Beulich
2021-08-24 10:50 ` [XEN PATCH v7 45/51] build: rework cloc recipe Anthony PERARD
2021-10-14 9:33 ` Jan Beulich
2021-10-15 16:34 ` Anthony PERARD
2021-08-24 10:50 ` [XEN PATCH v7 46/51] build: replace $(BASEDIR) by $(srctree) Anthony PERARD
2021-10-14 9:36 ` Jan Beulich
2021-08-24 10:50 ` [XEN PATCH v7 47/51] build: Rework "clean" to clean from the root dir Anthony PERARD
2021-10-14 9:44 ` Jan Beulich
2021-10-15 16:40 ` Anthony PERARD
2021-08-24 10:50 ` [XEN PATCH v7 48/51] build: Rework "headers*.chk" prerequisite in include/ Anthony PERARD
2021-10-14 9:48 ` Jan Beulich
2021-08-24 10:50 ` [XEN PATCH v7 49/51] build: adding out-of-tree support to the xen build Anthony PERARD
2021-10-14 10:14 ` Jan Beulich
2021-10-15 16:58 ` Anthony PERARD
2021-10-18 9:02 ` Jan Beulich
2021-10-18 9:51 ` Anthony PERARD
2021-10-18 10:05 ` Jan Beulich
2021-10-18 10:28 ` Juergen Gross
2021-10-18 10:36 ` Jan Beulich
2021-10-18 10:40 ` Juergen Gross
2021-10-18 11:07 ` Jan Beulich
2021-10-18 11:20 ` Juergen Gross
2021-10-18 12:03 ` Jan Beulich
2021-10-21 14:10 ` Anthony PERARD
2021-08-24 10:50 ` [XEN PATCH v7 50/51] build: specify source tree in include/ for prerequisite Anthony PERARD
2021-10-14 10:19 ` Jan Beulich
2021-10-15 17:02 ` Anthony PERARD
2021-08-24 10:50 ` [XEN PATCH v7 51/51] build: add %.E targets Anthony PERARD
2021-10-13 15:48 ` Jan Beulich
2021-10-14 6:52 ` Jan Beulich
2021-09-02 10:22 ` [XEN PATCH v7 00/51] xen: Build system improvements, now with out-of-tree build! Jan Beulich
2021-09-06 16:13 ` Anthony PERARD
2021-09-07 6:20 ` Jan Beulich
2021-09-07 7:46 ` Jan Beulich
2021-09-15 9:53 ` Michal Orzel
2021-11-04 15:49 ` Alex Bennée
2021-11-04 16:12 ` Alex Bennée
2021-11-04 16:34 ` Anthony PERARD
2021-11-04 16:59 ` Alex Bennée
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YWbsGlcDZSSXsJlx@perard \
--to=anthony.perard@citrix.com \
--cc=Volodymyr_Babchuk@epam.com \
--cc=alistair.francis@wdc.com \
--cc=andrew.cooper3@citrix.com \
--cc=bobbyeshleman@gmail.com \
--cc=connojdavis@gmail.com \
--cc=dgdegra@tycho.nsa.gov \
--cc=dpsmith@apertussolutions.com \
--cc=george.dunlap@citrix.com \
--cc=iwj@xenproject.org \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=konrad.wilk@oracle.com \
--cc=roger.pau@citrix.com \
--cc=ross.lagerwall@citrix.com \
--cc=sstabellini@kernel.org \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.