[CRIU] [PATCH 1/2] build/nmk: define map and newline
Dmitry Safonov
dsafonov at virtuozzo.com
Fri Feb 19 05:13:40 PST 2016
On 02/19/2016 04:02 PM, Dmitry Safonov wrote:
> map is very good at generating rules.
> Just map gen function to array of it's parameters.
> Don't forget to eval the result.
>
> I'll use it in feature-tests generation and in someday coming
> compat 32-bit mode - in x86 makefiles.
>
> Cc: Cyrill Gorcunov <gorcunov at openvz.org>
> Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
> ---
> scripts/nmk/scripts/msg.mk | 11 +++++++++++
I think, I might add it to some other file, than msg.mk,
but places, where it's useable are makefiles with GEN.
So, we already need printing.
For other places, where map isn't needed, it's not
called/evalued - so it's just one variable more,
that isn't heavy.
> 1 file changed, 11 insertions(+)
>
> diff --git a/scripts/nmk/scripts/msg.mk b/scripts/nmk/scripts/msg.mk
> index a0279d0..88cc774 100644
> --- a/scripts/nmk/scripts/msg.mk
> +++ b/scripts/nmk/scripts/msg.mk
> @@ -42,6 +42,17 @@ define msg-build
> $(E) " BUILD " $(1)
> endef
>
> +define \n
> +
> +
> +endef
> +
> +# map funciton:
> +# $1 - func to call
> +# $2 - list over which map the $1 func
> +# result is divided with newlines
> +map = $(foreach x,$2,$(call $1,$x)$(\n))
> +
> #
> # Footer.
> $(__nmk_dir)scripts/msg.mk:
--
Regards,
Dmitry Safonov
More information about the CRIU
mailing list