%% [EMAIL PROTECTED] (Jagadish Prasad) writes:

  jp>   It has nothing to do with permissions. If i turn off the -j switch
  jp>   then everything goes fine. When i turn it on, then according to
  jp>   my rule.

  jp>   all: $(ODIR) $(LIB)

  jp>   causes make to run the two commands simultaneously.
  jp>   The $(ODIR) target is used to creating a "depend" directory
  jp>   which is used by the $(LIB) target. Since those two commands
  jp>   are run simultaneously. the dependency check fails to create
  jp>   the file.

Ah.  I was confused because the output of your command showed them
happening in the right order, and I didn't notice the -j.

You can't do that.

When you use -j, you can't depend on any ordering of targets that isn't
explicitly stated as a target/prerequisite relationship; here you
haven't said that $(ODIR) is a prerequisite of $(LIB), so make is free
to build them at the same time... and will.  Technically it could even
build $(LIB) first; that's allowed.

This is correct behavior on make's part, obviously.

Using a target to create the directory is never a good idea, IMO.
There're all kinds of problems with it.  I always recommend (and use
myself) a shell function, like this:

  __tmp := $(shell [ -d $(ODIR) ] || $(MKDIR) $(ODIR))

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

Reply via email to