Mail Archives: djgpp/1999/04/12/10:21:56
In article <KgQmuHA4LpD3EwP4 AT talula DOT demon DOT co DOT uk> you wrote:
> In the Allegro makefile, I want to copy a bunch of header files into
> %DJDIR%/include/allegro/, which requires me to create this directory if
> it doesn't already exist. That is easy enough to do, but for some reason
> make doesn't seem to like the situation where a file depends on the
> directory that contains it.
Most GNU makefiles do not bother checking dates at all for the
'install' target, which is a good plan, I think. At 'make install'
time, I would expect it to just copy everything, and that's it. For
directories, GNU makefiles generally contain a mkdir that is executed
unconditionally, with it's error status being ignored. Another method
is to check if the directory exists, and only make it if it
doesn't. In a nutshell (caution: completely untested!), the makefile
would look like this:
.PHONY: install install-dirs
install: all install-dirs
copy file $(BINDIR)
install-dirs:
#any of the following would do:
-mkdir $(BINDIR)
$(INSTALL) -d $(BINDIR)
( test -d $BINDIR || mkdir $BINDIR )
if [ ! -d $BINDIR ] ; then mkdir $BINDIR ; fi
# or, for command.com as the shell:
if ! exist $BINDIR\NUL then md $BINDIR
The problem with giving the directory name itself as the target might
be that (at least on Unix) the directory modtime changes each time you
write a file into it.
For real diagnosis, you'll have to 'make -d install > make.log' and
read make.log to see why make thinks it has to copy the file anew. My
guess would be something like "dependency 'testdir' is newer than
'testdir/file'"
--
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.
- Raw text -