bug-make
[Top][All Lists]
Advanced

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

Re: feature request - order only deps


From: Sebastian Pipping
Subject: Re: feature request - order only deps
Date: Sun, 03 Feb 2013 00:45:33 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130113 Thunderbird/17.0.2

On 02.02.2013 18:38, Matěj Týč wrote:
>> How about something like this?
>>
>>   bar_deps = foo1 foo2
>>
>>   bar: $(bar_deps)
>>
>>   $(bar_deps):
>>      $(MAKE) cache-foo
>>      touch $@
>>
>>   %:
>>      touch $@
> 
> I have also thought of that, but this can work well reliably only in the
> case if there is only one make job. If I specify -j4, it may happen that
> all jobs will attempt to load the same cache simultaneously, which I
> have to avoid :-(

If that happens how about replacing

  $(MAKE) cache-foo

by something like

  mkdir .lock 2>/dev/null || exit 0 ; \
      $(MAKE) cache-foo ; \
      ret=$$?; \
      rmdir .lock && exit $${ret}

The idea is:

 - mkdir can only succeed once

 - if "$(MAKE) cache-foo" fails

    1. the whole should return non-zero

    2. .lock is not left laying around

If that works for you conceptually, you could abstract a little more and
turn it into something re-usable like

  $(call synced_make,cache-foo)

Best,



Sebastian




reply via email to

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