Robert Mecklenburg wrote:
> I basically agree with you, Paul. I've been using this approach for quite a
> while (after reading your post about it). However, if you have many source
> files across many directories this can be troublesome:
>
> # Find the source.
> sources := $(shell find . -name '*.c')
>
> # Gather the directories to create.
> dirs := $(sort $(dir $(sources)))
>
> # Create them
> $(shell for d in $(dirs); do [ -d $$d ] || mkdir -p $$d; done)
> # or
> $(foreach d,$(dirs),$(shell [ -d $$d ] || mkdir -p $$d))
> # of
> $(foreach d,$(dirs),$(if $(wildcard $d),,$(shell mkdir -p $$d)))
Exactly. IMHO, it also unnecessarily spawns off a bunch of processes. Using the hack
(or, if widely accepted, idiom :-), a shell for mkdir is spawned only if the directory
hasn't been created. Initially, this may spawn more processes than the $(shell)
alternative, but it'll spawn none thenceforth.
It just occured to me. If one has:
%: %/../...
@: >> $@
.PRECIOUS: %/../...
%/../...:
@mkdir -p $(dir $*) && : >> $(dir $*)$(@F)
then does:
$ gmake --jobs=2 aoeu/aoeu/aoeu aoeu/ueoa/ueoa
it looks like there's an opportunity for a race condition. Is this right?
I haven't heard anyone say this violates Paul's Secord Rule. Is this good news?
Thanks,
Noel
--
NOTICE: If received in error, please destroy and notify sender. Sender does not waive
confidentiality or privilege, and use is prohibited.
_______________________________________________
Help-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/help-make