[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Make: Using directories as dependencies???
From: |
Ken Glasson |
Subject: |
Make: Using directories as dependencies??? |
Date: |
Tue, 15 May 2001 10:19:57 +0930 |
<this was originally posted on gnu.utils.help yesterday, but have sent here
after looking at http://www.paulandlesley.org/gmake/#mail>
I have been trying to use directories as dependencies to build objects
into a different obj directory (rather than using VPATH from the
destination obj dir) and am having problems.
I want the directory to be created if it doesn't exist - so have set it
as a dependency for the target objects:
e.g.:
<make version 3.79.1 built for i386-redhat-linux-gnu (Redhat 7.0
distribution).>
BINLOC = ../ bin/i686
OBJLOC = ../obj/i686
DIRECT = $(BINLOC) $(OBJLOC)
all: $(OBJECTS) $(BINS)
$(OBJECTS): $(OBJLOC)
$(OBJLOC)/%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
$(DIRECT):
@echo ' ** Making Directory: $@ **'
@(if [ ! -d $@ ]; then umask 007; mkdir -p $@; fi)
(obviously not all the detail of the makefile is shown)
When used this way and make is run repeatedly I get objects (and
binaries - not shown) being rebuilt unnecessarily due to what appears to
be the fact the the timestamp of the $(OBJLOC) directory is being
updated every time a new object is placed into it.... Is there any way
to get around this? I.e. can the directory 'create' time rather than
its 'modify' time be used by make to determine its dependency
relationship time? Or am I doing something blatantly wrong and not
obvious to myself? I have been scratching my head on this one for quite
some time.
TIA
Ken
- Make: Using directories as dependencies???,
Ken Glasson <=