help-make
[Top][All Lists]
Advanced

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

Re: Parallel jobs with order-only prerequisites


From: Dawid Gosławski
Subject: Re: Parallel jobs with order-only prerequisites
Date: Mon, 13 Oct 2014 22:56:44 +0200

I was talking about something like that:

all:: | foo.done
    @echo "\nCompilation finished !!!\n"
    @echo "----\nListing timestamps:"
    @find ./ -name "*api*" -printf "%f - %c\n" | sort

DATA := "BASIC API"
FILES :=foo.src bar.src baz.src

%.src:
    @touch $@

%.done: %.src
    @echo "1-$(@F)) Starting"
    @echo "  1.1-$(@F)) Making"
    @echo $(DATA) >  $(patsubst %.done,%.api-tmp, $@) # Of course it's only
for example
    @echo "  1.2-$(@F)) Generated api-tmp"
    @echo "  1.3-$(@F)) COMPILED !!!"


# Ensure that api exist only AFTER compilation of %.done succeded
# Because
# Empty cause "done" step created api-tmp (for comparing with old one) we
use api it should also exists at this stage - provided by done
%.api-tmp: %.done
    @echo "2.0-$(@F)) Api-tmp hit so $^ is ready and $(patsubst
%.api-tmp,%.api, $@) too !!!"
    @cmp -s "$@" "$(patsubst %.api-tmp,%.api, $@)" || \
        ( cp "$@" "$(patsubst %.api-tmp,%.api, $@)" ; echo "  3.1) $@" API
COPIED!!! )

foo.done: bar.done baz.done bar.api-tmp baz.api-tmp

clean::
    $(RM) *~
    $(RM) *.done
    $(RM) *.api
    $(RM) *.api-tmp

Of course you have to pass api-tmp as prerequesite. You can comment out
creating of "api-tmp" to check if it's really changing.

BR
Dawid


2014-10-13 16:59 GMT+02:00 Steven Simpson <address@hidden>:

> On 13/10/14 08:45, Steven Simpson wrote:
>
>> There's a relationship between %.done and %.api, which is that %.api is a
>> (potentially non-updating) by-product of building %.done, and that
>> information is needed for parallelism, but it can't be represented using :
>> or :| between them.
>>
>> However, I just tried adding:
>>
>> bar.api: | bar.src
>> baz.api: | baz.src
>>
>> ...and that appears not to break the serial semantics I've managed to
>> get, while making it work in parallel too!
>>
>
> This turns out to be one of the things I'd already tried.  A
> profile-influencing change to bar causes it to be recompiled, and bar.api
> to be restamped.  However, it isn't detected by foo, until Make is invoked
> again.  This only happens on a parallel build.
>
>
> _______________________________________________
> Help-make mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/help-make
>



-- 
http://about.me/alkuzad


reply via email to

[Prev in Thread] Current Thread [Next in Thread]