[CRIU] [PATCH 4/9] nmk: build.mk -- Make process depend on Makefile itself
Dmitry Safonov
dsafonov at virtuozzo.com
Mon Mar 21 05:53:50 PDT 2016
On 03/21/2016 03:12 PM, Cyrill Gorcunov wrote:
> From: Cyrill Gorcunov <gorcunov at gmail.com>
>
> If makefile is changed itself we've been not detecting it.
>
> Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
> scripts/nmk/scripts/build.mk | 25 ++++++++++++++++++++-----
> 1 file changed, 20 insertions(+), 5 deletions(-)
>
> diff --git a/scripts/nmk/scripts/build.mk b/scripts/nmk/scripts/build.mk
> index b9048aa142e3..acb2440e518d 100644
> --- a/scripts/nmk/scripts/build.mk
> +++ b/scripts/nmk/scripts/build.mk
> @@ -20,7 +20,8 @@ ifndef obj
> $(error obj is undefined)
> endif
>
> -include $(call objectify,$(makefile))
> +src-makefile := $(call objectify,$(makefile))
> +include $(src-makefile)
>
> ifneq ($(strip $(target)),)
> target := $(sort $(call uniq,$(target)))
> @@ -46,6 +47,16 @@ builtin-name := $(strip $(builtin-name))
> ld_flags := $(strip $(LDFLAGS) $(ldflags-y))
>
> #
> +# $(obj) related rules.
> +$(eval $(call gen-rule-o-from-c-by-name,$(obj)/%,$(obj)/%,$(src-makefile)))
> +$(eval $(call gen-rule-i-from-c-by-name,$(obj)/%,$(obj)/%,$(src-makefile)))
> +$(eval $(call gen-rule-s-from-c-by-name,$(obj)/%,$(obj)/%,$(src-makefile)))
> +$(eval $(call gen-rule-o-from-S-by-name,$(obj)/%,$(obj)/%,$(src-makefile)))
> +$(eval $(call gen-rule-d-from-c-by-name,$(obj)/%,$(obj)/%,$(src-makefile)))
> +$(eval $(call gen-rule-d-from-S-by-name,$(obj)/%,$(obj)/%,$(src-makefile)))
> +$(eval $(call gen-rule-i-from-S-by-name,$(obj)/%,$(obj)/%,$(src-makefile)))
Hmm, why not pulled from rules.mk (or added $(src-makefile) there)?
Where implicits expand:
>$(eval $(call gen-rule-o-from-c-by-name,%,%))
>$(eval $(call gen-rule-i-from-c-by-name,%,%))
>[...]
> +
> +#
> # Prepare targets.
> ifneq ($(lib-y),)
> lib-target :=
> @@ -89,14 +100,16 @@ ifdef builtin-target
> $(eval $(call gen-ld-target-rule, \
> $(builtin-target), \
> $(ld_flags), \
> - $(obj-y),$(obj-y) $(call objectify,$(obj-e))))
> + $(obj-y) $(src-makefile), \
> + $(obj-y) $(call objectify,$(obj-e))))
> endif
>
> ifdef lib-target
> $(eval $(call gen-ar-target-rule, \
> $(lib-target), \
> $(ARFLAGS) $(arflags-y), \
> - $(lib-y),$(lib-y) $(call objectify,$(lib-e))))
> + $(lib-y) $(src-makefile), \
> + $(lib-y) $(call objectify,$(lib-e))))
> endif
>
> #
> @@ -106,7 +119,8 @@ define gen-custom-target-rule
> $(eval $(call gen-ld-target-rule, \
> $(obj)/$(1).built-in.o, \
> $(ld_flags) $(LDFLAGS_$(1)), \
> - $(call objectify,$($(1)-obj-y)), \
> + $(call objectify,$($(1)-obj-y)) \
> + $(src-makefile), \
> $(call objectify,$($(1)-obj-y)) \
> $(call objectify,$($(1)-obj-e))))
> all-y += $(obj)/$(1).built-in.o
> @@ -117,7 +131,8 @@ define gen-custom-target-rule
> $(obj)/$(1).lib.a, \
> $(ARFLAGS) $($(1)-arflags-y), \
> $(call objectify,$($(1)-lib-y)) \
> - $(call objectify,$($(1)-lib-e)), \
> + $(call objectify,$($(1)-lib-e)) \
> + $(src-makefile), \
> $(call objectify,$($(1)-lib-y))))
> all-y += $(obj)/$(1).lib.a
> cleanup-y += $(obj)/$(1).lib.a
--
Regards,
Dmitry Safonov
More information about the CRIU
mailing list