help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Existence-based dependencies.


From: Todd Showalter
Subject: Existence-based dependencies.
Date: Sun, 14 Feb 2010 23:00:05 -0500

    Is there some method I've missed for doing existence-based
dependency in make?  I have several related problems that are making
me jump through hoops to get the behavior I want.  An example (with
screwed up tabs due to webmail):

$(TARGET): $(TARGET_OUTDIR)
  $(CC) $(OBJS) -o $(TARGET)

    (yes, I know I could just stick a mkdir -p $(TARGET_OUTDIR) in
this particular example, but I'm trying to keep the example simple)

    The problem I'm having here is that (from what I can see) I'm
trying to specify an existence-based dependency (ie: I want the output
directory to exist), but the dependency I've actually specified
requires that the target be younger than the dependency.  When the
target is written into the directory it updates the directory
timestamp, and I have this sporadically triggering bogus rebuilds.

    I'm working around it by force-creating the directories in the
top-level target, but it's kind if nasty; it means that I can't call
directly in to build a specific subtarget.

    I have similar problems with files; I've never found a
satisfactory way to call makedepend, for example, without either
sidestepping the dependency system or jumping through hoops with
temporary files, diff and mv.

    It seems like there ought to be a better way to do this; all of
the problems basically stem from wanting to tell make "this file must
exist, but existing is good enough".  The cases where it matters are
always one of two things:

- directories which must exist so that a target or targets can be created within
- generated files which will be included by another makefile in a
recursive invocation

    I have working makefiles that do this, but they make my colleagues
scream "Ia Ia Chthulu Fhtagn!" and run from the room.  Does anyone
have any suggestions?

                                           Todd.

-- 
 Todd Showalter, President,
 Electron Jump Games, Inc.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]