[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: feature request - order only deps
From: |
Matěj Týč |
Subject: |
Re: feature request - order only deps |
Date: |
Sun, 03 Feb 2013 23:20:30 +0100 |
On Ne, 2013-02-03 at 00:45 +0100, Sebastian Pipping wrote:
> 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
Thank you,
but just by looking at it, I think that if .lock exists, 0 is returned
and while one make job is busy loading the cache, the others act like
the cache was loaded.
Writing the makefile and trying it confirms this assumption, so I guess
that it has to behave like that.
I am beginning to think that the most elegant (from the user's point of
view) would be (probably optional) ignore of order-only dependencies if
the target exists and is more up-to-date than its ordinary dependencies.
How difficult could be writing a patch that would enable this?
Matej
- feature request - order only deps, Matěj Týč, 2013/02/01
- Re: feature request - order only deps, Sebastian Pipping, 2013/02/01
- Re: feature request - order only deps, Matěj Týč, 2013/02/02
- Re: feature request - order only deps, Sebastian Pipping, 2013/02/02
- Re: feature request - order only deps, Matěj Týč, 2013/02/02
- Re: feature request - order only deps, Sebastian Pipping, 2013/02/02
- Re: feature request - order only deps,
Matěj Týč <=
- Re: feature request - order only deps, Sebastian Pipping, 2013/02/03
- Re: feature request - order only deps, Matěj Týč, 2013/02/03
- Re: feature request - order only deps, Sebastian Pipping, 2013/02/03
- Re: feature request - order only deps, Matěj Týč, 2013/02/04