"Paul D. Smith" wrote:
> 
> %% Noel Yap <[EMAIL PROTECTED]> writes:
> 
>   >> $(shell for d in $(dirs); do [ -d $$d ] || mkdir -p $$d; done)
> 
>   ny> Exactly.  IMHO, it also unnecessarily spawns off a bunch of
>   ny> processes.  Using the hack (or, if widely accepted, idiom :-), a
>   ny> shell for mkdir is spawned only if the directory hasn't been
>   ny> created.  Initially, this may spawn more processes than the
>   ny> $(shell) alternative, but it'll spawn none thenceforth.
> 
> The alternative above spawns exactly one shell every time you run make,
> regardless of how many directories you need.  To me that's not a big
> deal, but I guess YMMV :).

YMMV, indeed.  I think I wasn't clear in my last post.  Since the OBJDIR info will be 
split among several makefiles, several $(shell)'s will need to be done, one for each 
makefile.

> The only possible problem you might have is if you run two mkdirs at the
> same time and one of them _fails_ and exits with a non-0 exit code, then
> your rule above would fail and the build would fail.

I didn't think of that.  I'll have to test it out.

>   ny> I haven't heard anyone say this violates Paul's Secord Rule.
> 
> Hm.  Well, I think it follows the spirit of it.  The idea behind that
> rule is to keep people from trying to do silly things like:
> 
>     foo.o: foo.c
>             $(CC) $(CFLAGS) -o objdir/foo.o -c foo.c
> 
> or whatever.  Your rule does the same thing _in effect_.

That's how I was hoping the rule would be interpreted :-)

Thanks,
Noel


_______________________________________________
Help-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/help-make

Reply via email to