%% "Robert Mecklenburg" <[EMAIL PROTECTED]> writes:

  rm> Is there a reason why you didn't use either of:

  rm>   @mkdir -p $(dir $(dir $(dir $@)))
  rm>   @mkdir -p $(dir $(patsubst %/../...,%,$@))

  rm> I haven't tried them, but I assume they work. ;-)

Nope.  $(dir ...) is defined very strangely: it leaves the trailing
slash, so multiple dir's are no-ops.  $(dir $(dir ...)) is identical to
just $(dir ...).

Just try it and see:

  $ echo 'all: ; @echo $(dir $(dir /foo/bar/baz))' | make -f-
  /foo/bar

  rm> .PRECIOUS: %.mkdir
  rm> %.mkdir:
  rm>         @mkdir -p $(dir $@)
  rm>         @touch $@

In this case you can just use $*.

  rm> Now I grant you, the "cool factor" of yours is way beyond the
  rm> "slow" version, but this one actually follows Paul's second rule
  rm> at the cost of more files created and visible to the user.  (Not a
  rm> trivial cost, I admit.)

  rm> A very interesting idea!

I don't see how this is that useful.  I prefer the very straightforward:

  OBJDIR = ../../foo/bar

  $(shell [ -d $(OBJDIR) ] || mkdir -p $(OBJDIR))


The downside is directories are created which you might not need, but
it's quite a bit simpler and more reliable.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <[EMAIL PROTECTED]>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.paulandlesley.org
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist


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

Reply via email to