[CRIU] [PATCH 02/11] nmk: Filter out already seen targets from collect-deps

Dmitry Safonov 0x7f454c46 at gmail.com
Wed Jul 18 18:16:19 MSK 2018


2018-07-18 15:48 GMT+01:00 Cyrill Gorcunov <gorcunov at gmail.com>:
> On Wed, Jul 18, 2018 at 03:45:21PM +0100, Dmitry Safonov wrote:
>> 2018-07-12 13:51 GMT+01:00 Cyrill Gorcunov <gorcunov at gmail.com>:
>> > Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>
>> > ---
>> >  scripts/nmk/scripts/build.mk | 2 +-
>> >  1 file changed, 1 insertion(+), 1 deletion(-)
>> >
>> > diff --git a/scripts/nmk/scripts/build.mk b/scripts/nmk/scripts/build.mk
>> > index 890a912d09b0..f16af03f2519 100644
>> > --- a/scripts/nmk/scripts/build.mk
>> > +++ b/scripts/nmk/scripts/build.mk
>> > @@ -261,7 +261,7 @@ define collect-deps
>> >          ifeq ($(lib-target),$(1))
>> >                  deps-y += $(lib-y:.o=.d)
>> >          endif
>> > -        ifneq ($(filter all $(all-y) $(hostprogs-y),$(1)),)
>> > +        ifneq ($(filter all $(filter-out $(builtin-target) $(lib-target), $(all-y)) $(hostprogs-y),$(1)),)
>> >                  deps-y += $(obj-y:.o=.d)
>> >                  deps-y += $(lib-y:.o=.d)
>> >                  deps-y += $(foreach t,$(target),$(call objectify,$($(t)-lib-y:.o=.d)) $(call objectify,$($(t)-obj-y:.o=.d)))
>>
>> I wish it was a bit less messy :<
>>
>> So, before for the $(lib-target):
>> ifneq ($(filter all $(all-y) $(hostprogs-y),$(1)),)
>>
>> $(all-y) contains $(lib-target) and in result we don't do deps-y
>> inside ifneq, right?
>>
>> After the change filter-out of lib-target will make sure that ifneq is true and
>> deps-y are updated (again?)
>>
>> So, we will have `deps-y += $(lib-y:.o=.d)` twice?
>>
>> IOW, I did:
>> --- a/scripts/nmk/scripts/build.mk
>> +++ b/scripts/nmk/scripts/build.mk
>> @@ -266,6 +266,9 @@ define collect-deps
>>                  deps-y += $(lib-y:.o=.d)
>>                  deps-y += $(foreach t,$(target),$(call
>> objectify,$($(t)-lib-y:.o=.d)) $(call objectify,$($(t)-obj-y:.o=.d)))
>>                  deps-y += $(foreach t,$(hostprogs-y),$(addprefix
>> $(obj)/,$($(t)-objs:.o=.d)))
>> +                ifeq ($(lib-target),$(1))
>> +                       $(error lib-target adds deps again)
>> +                endif
>>          endif
>>  endef
>>
>> And the result is:
>>   GEN      include/common/config.h
>> /home/dima/src/criu/scripts/nmk/scripts/build.mk:277: *** lib-target
>> adds deps again.  Stop.
>> make: *** [Makefile.compel:52: compel/plugins/std.lib.a] Error 2
>> make: *** Waiting for unfinished jobs....
>
> This actually then filtered out via uniq call, so there won't be error.
> Still I would love if you take a look on the final result, ie where
> all patches are applied.

Ok, but then do we need those lines at all in collect-deps:
:         ifeq ($(builtin-target),$(1))
:                deps-y += $(obj-y:.o=.d)
:        endif
:        ifeq ($(lib-target),$(1))
:                deps-y += $(lib-y:.o=.d)
:        endif

If your change will add them to deps-y for both cases.

Thanks,
             Dmitry


More information about the CRIU mailing list