On 02.02.2013 16:19, Matěj Týč wrote:
>> This is what I understand to be our current Makefile:
>>
>>   bar_deps = foo1 foo2
>>
>>   bar: $(bar_deps)
>>
>>   $(bar_deps): | cache-foo
>>
>>   %:
>>      touch $@
> [..]
> 
> Thank you for your quick help, your example indeed works, but it has one
> weakness.
> Consider a case when eg. 'foo1' depends on 'baz' and suddenly 'baz' is
> updated, so 'foo1' should be updated, too.
> However, the old 'foo1' is still there, so the 'file_missing' function
> assumes that nothing has to be done => cache-foo is not needed, which is
> not true.
> 
> Since I generate the makefile using some M4sugar macros, I don't mind
> having to write some extra stuff; however now the workaround path seems
> to complicate quite a lot...

How about something like this?

  bar_deps = foo1 foo2

  bar: $(bar_deps)

  $(bar_deps):
        $(MAKE) cache-foo
        touch $@

  %:
        touch $@

Now cache-foo is remade iff at least one of $(bar_deps) needs a rebuild.

Best,



Sebastian


_______________________________________________
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make

Reply via email to