build,include: rework shell script for headers++.chk
authorAnthony PERARD <anthony.perard@citrix.com>
Thu, 23 Jun 2022 07:40:12 +0000 (09:40 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 23 Jun 2022 07:40:12 +0000 (09:40 +0200)
commit61ac7919a6a38a24d26fd1b57a2511beb0724e99
tree12628d452acb62e80eb08a2cd6296f1365baa8a8
parentf4e6748993f25b060c6357937a5ff454e131a62f
build,include: rework shell script for headers++.chk

The command line generated for headers++.chk by make is quite long,
and in some environment it is too long. This issue have been seen in
Yocto build environment.

Error messages:
    make[9]: execvp: /bin/sh: Argument list too long
    make[9]: *** [include/Makefile:181: include/headers++.chk] Error 127

Rework so that we do the foreach loop in shell rather that make to
reduce the command line size by a lot. We also need a way to get
headers prerequisite for some public headers so we use a switch "case"
in shell to be able to do some simple pattern matching. Variables
alone in POSIX shell don't allow to work with associative array or
variables with "/".

Also rework headers99.chk as it has a similar implementation, even if
with only two headers to check the command line isn't too long at the
moment.

Fixes: 28e13c7f43 ("build: xen/include: use if_changed")
Reported-by: Bertrand Marquis <Bertrand.Marquis@arm.com>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
Reviewed-by: Michal Orzel <michal.orzel@arm.com>
Tested-by: Michal Orzel <michal.orzel@arm.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/include/Makefile