[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XEN PATCH 1/4] build: xen/include: use if_changed


  • To: Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Thu, 9 Jun 2022 10:16:37 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=sZUP64wpScVM9B/KumhWG4mkq4094dBhOkHD0muqmsY=; b=JOTvHFN4JdBDkuqMID9igVoiBr0v5MhaRh6Y+eJPKgwExVhqHxIQfFfYPgtmBeTd/aNvEorQqJT+66Au1ntGiixF7cBtO57qMjibZiuQCsUaVki450YfIQCI4LbDGYHnfcL+stec8Xob6dNILH/ZSgkwTa1Jye1iCTXfVpUblRI41tifpOt4zHPmzqhuL/NxlVwg7wevCxYrEVfXmdeGz3Cr0nsck/UCLdd5F1fjJQkSwYoWy2NSEYrhmoJLv5erJ+LZ00YlRjiNRaOE/LVyNE/sxwTXpemZAQ+a1Exy1xorzhjeFXcYmi9nnQ/JTFMcLYuqT2gGLXU7zwMG5+xcEg==
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=sZUP64wpScVM9B/KumhWG4mkq4094dBhOkHD0muqmsY=; b=T+5IiJyBEbTp1MDodGGQ4N96ThVEakJmlaXvo9G/DZGdd6MCOIaSkFThiaKE2l49v1kIvbnpgVq8/rmYiIQuocLjeHE3UAXV4lEph7c9Kv6Elr8YZG+b5LIS/902wcoB1pSb/f/DgaQHPT5bW5LqYtxEmcCvZAOJFZ7W1PVZTCPJ3wbJR2oFfUOF8lFAPAFv3b2uRjw/vrbqaMthpcetjETDseNpjbuwCUMDC76AyLM+y/Q1pV/gyawDTkAomInfZDGMr8bp1L9wJZZ8u6IQy+xD9cPwrvh2TtE3T6GcI2lKp2k6tTnPDZjvPGS4zHB/z96IYGQbHST5lUJey2v00Q==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=dF9faxHMKim1awnkWZnK5CBTB6qJjlA+5G4TMPFgrFT8ThjWo/xCIVztqmElCbEPXPzKIeN9UDzuXHJT13lezVhJbNNplbibICaDzS9PXiGF5dKJeGBzQ4Z4SR9oPSx9IRGxeeImhnaKNw1SSUX5LL4Mdk7HmJx8bd8VTIXI26f/7HkoYLoVHRYbvZULuugxSb+nh0h00LyC4QIjij/CdVngIE46rkrBejkQMd1VQm/2MLw0tynGvJkfi6JrI0nBwPtyPC5Tng47ZQ19mm5mEGggnTbdJ1euvRbwKBCyk71bs4JvHmojZn7gmFblUBsg4CmguvYUaqCVI28toie4JQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FFfKK69uXlUxBhgvfKepGWxI3I6YcgWVV8GKDwxHQ+SLNgr58uILKA2+5u5WtWVk+PPTaJXYnWVcb7U4DtaDkNXXrBOzesdvjwRNwysAIwruE9yDfg3wkXDdhSvWqBjQZsLvo1p2MKYq/XJSrxlMkTtEPKhpS87rB4FIXAzJeuyKZKU6dC9rlmPUh/dq+SvJuRE0rzqO5EqMzxi5CCbAzwAZowZxilJBkHGJhX2fHBF5x0WeQMHqyps9HTRNJWoU4ubhQ6peVtIse25VNQ5pPxxIkOmCKD/F/jFpt/3KhQYY7qBBg1H3jKmGy4j3Hnl9s+gGMpccPL+WANoSxp08og==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Thu, 09 Jun 2022 10:16:53 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHYddkD4JsESJA0gkGnWWwykzQjSK1G6E+A
  • Thread-topic: [XEN PATCH 1/4] build: xen/include: use if_changed

Hi Anthony,

> On 1 Jun 2022, at 17:59, Anthony PERARD <anthony.perard@xxxxxxxxxx> wrote:
> 
> Use "define" for the headers*_chk commands as otherwise the "#"
> is interpreted as a comment and make can't find the end of
> $(foreach,).
> 
> Adding several .PRECIOUS as without them `make` deletes the
> intermediate targets. This is an issue because the macro $(if_changed,)
> check if the target exist in order to decide whether to recreate the
> target.
> 
> Removing the call to `mkdir` from the commands. Those aren't needed
> anymore because a rune in Rules.mk creates the directory for each
> $(targets).
> 
> Remove "export PYTHON" as it is already exported.

With this change, compiling for x86 is now ending up in:
CHK     include/headers99.chk
make[9]: execvp: /bin/sh: Argument list too long
make[9]: *** [include/Makefile:181: include/headers++.chk] Error 127

Not quite sure yet why but I wanted to signal it early as other might be 
impacted.

Arm and arm64 builds are not impacted.

Cheers
Bertrand

> 
> Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
> ---
> xen/include/Makefile | 108 ++++++++++++++++++++++++++++++-------------
> 1 file changed, 76 insertions(+), 32 deletions(-)
> 
> diff --git a/xen/include/Makefile b/xen/include/Makefile
> index 03baf10efb..6d9bcc19b0 100644
> --- a/xen/include/Makefile
> +++ b/xen/include/Makefile
> @@ -45,38 +45,65 @@ public-$(CONFIG_ARM) := $(wildcard 
> $(srcdir)/public/arch-arm/*.h $(srcdir)/publi
> .PHONY: all
> all: $(addprefix $(obj)/,$(headers-y))
> 
> -$(obj)/compat/%.h: $(obj)/compat/%.i $(srcdir)/Makefile 
> $(srctree)/tools/compat-build-header.py
> -     $(PYTHON) $(srctree)/tools/compat-build-header.py <$< $(patsubst 
> $(obj)/%,%,$@) >>$@.new; \
> -     mv -f $@.new $@
> -
> -$(obj)/compat/%.i: $(obj)/compat/%.c $(srcdir)/Makefile
> -     $(CPP) $(filter-out -Wa$(comma)% -include 
> %/include/xen/config.h,$(XEN_CFLAGS)) $(cppflags-y) -o $@ $<
> -
> -$(obj)/compat/%.c: $(src)/public/%.h $(srcdir)/xlat.lst $(srcdir)/Makefile 
> $(srctree)/tools/compat-build-source.py
> -     mkdir -p $(@D)
> -     $(PYTHON) $(srctree)/tools/compat-build-source.py $(srcdir)/xlat.lst 
> <$< >$@.new
> -     mv -f $@.new $@
> -
> -$(obj)/compat/.xlat/%.h: $(obj)/compat/%.h $(obj)/compat/.xlat/%.lst 
> $(srctree)/tools/get-fields.sh $(srcdir)/Makefile
> -     export PYTHON=$(PYTHON); \
> -     while read what name; do \
> -             $(SHELL) $(srctree)/tools/get-fields.sh "$$what" compat_$$name 
> $< || exit $$?; \
> -     done <$(patsubst $(obj)/compat/%,$(obj)/compat/.xlat/%,$(basename 
> $<)).lst >$@.new
> -     mv -f $@.new $@
> +quiet_cmd_compat_h = GEN     $@
> +cmd_compat_h = \
> +    $(PYTHON) $(srctree)/tools/compat-build-header.py <$< $(patsubst 
> $(obj)/%,%,$@) >>$@.new; \
> +    mv -f $@.new $@
> +
> +quiet_cmd_compat_i = CPP     $@
> +cmd_compat_i = $(CPP) $(filter-out -Wa$(comma)% -include 
> %/include/xen/config.h,$(XEN_CFLAGS)) $(cppflags-y) -o $@ $<
> +
> +quiet_cmd_compat_c = GEN     $@
> +cmd_compat_c = \
> +   $(PYTHON) $(srctree)/tools/compat-build-source.py $(srcdir)/xlat.lst <$< 
> >$@.new; \
> +   mv -f $@.new $@
> +
> +quiet_cmd_xlat_headers = GEN     $@
> +cmd_xlat_headers = \
> +    while read what name; do \
> +        $(SHELL) $(srctree)/tools/get-fields.sh "$$what" compat_$$name $< || 
> exit $$?; \
> +    done <$(patsubst $(obj)/compat/%,$(obj)/compat/.xlat/%,$(basename 
> $<)).lst >$@.new; \
> +    mv -f $@.new $@
> +
> +targets += $(headers-y)
> +$(obj)/compat/%.h: $(obj)/compat/%.i $(srctree)/tools/compat-build-header.py 
> FORCE
> +     $(call if_changed,compat_h)
> +
> +.PRECIOUS: $(obj)/compat/%.i
> +targets += $(patsubst %.h, %.i, $(headers-y))
> +$(obj)/compat/%.i: $(obj)/compat/%.c FORCE
> +     $(call if_changed,compat_i)
> +
> +.PRECIOUS: $(obj)/compat/%.c
> +targets += $(patsubst %.h, %.c, $(headers-y))
> +$(obj)/compat/%.c: $(src)/public/%.h $(srcdir)/xlat.lst 
> $(srctree)/tools/compat-build-source.py FORCE
> +     $(call if_changed,compat_c)
> +
> +targets += $(patsubst compat/%, compat/.xlat/%, $(headers-y))
> +$(obj)/compat/.xlat/%.h: $(obj)/compat/%.h $(obj)/compat/.xlat/%.lst 
> $(srctree)/tools/get-fields.sh FORCE
> +     $(call if_changed,xlat_headers)
> +
> +quiet_cmd_xlat_lst = GEN     $@
> +cmd_xlat_lst = \
> +     grep -v '^[[:blank:]]*$(pound)' $< | sed -ne 
> 's,@arch@,$(compat-arch-y),g' -re 's,[[:blank:]]+$*\.h[[:blank:]]*$$,,p' 
> >$@.new; \
> +     $(call move-if-changed,$@.new,$@)
> 
> .PRECIOUS: $(obj)/compat/.xlat/%.lst
> -$(obj)/compat/.xlat/%.lst: $(srcdir)/xlat.lst $(srcdir)/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,$@)
> +targets += $(patsubst compat/%.h, compat/.xlat/%.lst, $(headers-y))
> +$(obj)/compat/.xlat/%.lst: $(srcdir)/xlat.lst FORCE
> +     $(call if_changed,xlat_lst)
> 
> xlat-y := $(shell sed -ne 's,@arch@,$(compat-arch-y),g' -re 
> 's,^[?!][[:blank:]]+[^[:blank:]]+[[:blank:]]+,,p' $(srcdir)/xlat.lst | uniq)
> xlat-y := $(filter $(patsubst compat/%,%,$(headers-y)),$(xlat-y))
> 
> -$(obj)/compat/xlat.h: $(addprefix $(obj)/compat/.xlat/,$(xlat-y)) 
> $(obj)/config/auto.conf $(srcdir)/Makefile
> -     cat $(filter %.h,$^) >$@.new
> +quiet_cmd_xlat_h = GEN     $@
> +cmd_xlat_h = \
> +     cat $(filter %.h,$^) >$@.new; \
>       mv -f $@.new $@
> 
> +$(obj)/compat/xlat.h: $(addprefix $(obj)/compat/.xlat/,$(xlat-y)) 
> $(obj)/config/auto.conf FORCE
> +     $(call if_changed,xlat_h)
> +
> ifeq ($(XEN_TARGET_ARCH),$(XEN_COMPILE_ARCH))
> 
> all: $(obj)/headers.chk $(obj)/headers99.chk $(obj)/headers++.chk
> @@ -102,27 +129,31 @@ PUBLIC_C99_HEADERS := $(call 
> public-filter-headers,public-c99-headers)
> $(src)/public/io/9pfs.h-prereq := string
> $(src)/public/io/pvcalls.h-prereq := string
> 
> -$(obj)/headers.chk: $(PUBLIC_ANSI_HEADERS) $(srcdir)/Makefile
> +quiet_cmd_header_chk = CHK     $@
> +cmd_header_chk = \
>       for i in $(filter %.h,$^); do \
>           $(CC) -x c -ansi -Wall -Werror -include stdint.h \
>                 -S -o /dev/null $$i || exit 1; \
>           echo $$i; \
> -     done >$@.new
> +     done >$@.new; \
>       mv $@.new $@
> 
> -$(obj)/headers99.chk: $(PUBLIC_C99_HEADERS) $(srcdir)/Makefile
> -     rm -f $@.new
> +quiet_cmd_headers99_chk = CHK     $@
> +define cmd_headers99_chk
> +     rm -f $@.new; \
>       $(foreach i, $(filter %.h,$^),                                        \
>           echo "#include "\"$(i)\"                                          \
>           | $(CC) -x c -std=c99 -Wall -Werror                               \
>             -include stdint.h                                               \
>             $(foreach j, $($(patsubst $(srctree)/%,%,$i)-prereq), -include 
> $(j).h) \
>             -S -o /dev/null -                                               \
> -         || exit $$?; echo $(i) >> $@.new;)
> +         || exit $$?; echo $(i) >> $@.new;) \
>       mv $@.new $@
> +endef
> 
> -$(obj)/headers++.chk: $(PUBLIC_HEADERS) $(srcdir)/Makefile
> -     rm -f $@.new
> +quiet_cmd_headerscxx_chk = CHK     $@
> +define cmd_headerscxx_chk
> +     rm -f $@.new; \
>       if ! $(CXX) -v >/dev/null 2>&1; then                                  \
>           touch $@.new;                                                     \
>           exit 0;                                                           \
> @@ -133,8 +164,21 @@ $(obj)/headers++.chk: $(PUBLIC_HEADERS) 
> $(srcdir)/Makefile
>             -include stdint.h -include $(srcdir)/public/xen.h               \
>             $(foreach j, $($(patsubst $(srctree)/%,%,$i)-prereq), -include 
> c$(j)) \
>             -S -o /dev/null -                                               \
> -         || exit $$?; echo $(i) >> $@.new;)
> +         || exit $$?; echo $(i) >> $@.new;) \
>       mv $@.new $@
> +endef
> +
> +targets += headers.chk
> +$(obj)/headers.chk: $(PUBLIC_ANSI_HEADERS) FORCE
> +     $(call if_changed,header_chk)
> +
> +targets += headers99.chk
> +$(obj)/headers99.chk: $(PUBLIC_C99_HEADERS) FORCE
> +     $(call if_changed,headers99_chk)
> +
> +targets += headers++.chk
> +$(obj)/headers++.chk: $(PUBLIC_HEADERS) FORCE
> +     $(call if_changed,headerscxx_chk)
> 
> endif
> 
> -- 
> Anthony PERARD
> 
> 




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.