[XEN PATCH v3 0/2] build: reduce number of $(shell) execution on make 4.4

Anthony PERARD posted 2 patches 9 months ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/20230727145447.2701-1-anthony.perard@citrix.com
Config.mk    |  8 ++++++--
xen/Makefile | 16 ++++++++++++----
2 files changed, 18 insertions(+), 6 deletions(-)
[XEN PATCH v3 0/2] build: reduce number of $(shell) execution on make 4.4
Posted by Anthony PERARD 9 months ago
Patch series available in this git branch:
https://xenbits.xen.org/git-http/people/aperard/xen-unstable.git br.build-exported-shell-command-value-v3

v3:
- replace evaluation on first use construct by immediate expansion.

v2:
- new patches removing TARGET_SUBARCH and TARGET_ARCH.
- style change in first patch

With GNU make 4.4, the number of execution of the command present in $(shell )
in exported variables increased greatly. This is probably because as of make
4.4, exported variable are also added to the environment of $(shell )
construct.

From the annoncement:

    https://lists.gnu.org/archive/html/info-gnu/2022-10/msg00008.html
    > * WARNING: Backward-incompatibility!
    >   Previously makefile variables marked as export were not exported to commands
    >   started by the $(shell ...) function.  Now, all exported variables are
    >   exported to $(shell ...).  If this leads to recursion during expansion, then
    >   for backward-compatibility the value from the original environment is used.
    >   To detect this change search for 'shell-export' in the .FEATURES variable.

Also, there's a new paragraph in the GNU make manual, but it's a warning about
exporting all variable, still it might be relevant to the new observed
behavior:

    https://www.gnu.org/software/make/manual/make.html#Variables_002fRecursion
    > Adding a variable’s value to the environment requires it to be expanded. If
    > expanding a variable has side-effects (such as the info or eval or similar
    > functions) then these side-effects will be seen every time a command is
    > invoked.

The issue was reported on IRC by jandryuk.

So, I've locate a few obvious candidate to fix, maybe there's more $(shell) to
change?

Anthony PERARD (2):
  build: evaluate XEN_BUILD_* and XEN_DOMAIN immediately
  Config.mk: evaluate XEN_COMPILE_ARCH and XEN_OS immediately

 Config.mk    |  8 ++++++--
 xen/Makefile | 16 ++++++++++++----
 2 files changed, 18 insertions(+), 6 deletions(-)

-- 
Anthony PERARD


Re: [XEN PATCH v3 0/2] build: reduce number of $(shell) execution on make 4.4
Posted by Jason Andryuk 9 months ago
On Thu, Jul 27, 2023 at 10:55 AM Anthony PERARD
<anthony.perard@citrix.com> wrote:
> Anthony PERARD (2):
>   build: evaluate XEN_BUILD_* and XEN_DOMAIN immediately
>   Config.mk: evaluate XEN_COMPILE_ARCH and XEN_OS immediately

For the series:
Tested-by: Jason Andryuk <jandryuk@gmail.com>

Thanks,
Jason