cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1999/04/12/10:21:56

Date: Mon, 12 Apr 1999 16:21:28 +0200
From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
Message-Id: <199904121421.QAA02904@acp3bf.physik.rwth-aachen.de>
To: djgpp AT delorie DOT com
Subject: Re: Creating directories from a makefile
Newsgroups: comp.os.msdos.djgpp
Organization: RWTH Aachen, III. physikalisches Institut B
X-Newsreader: TIN [version 1.2 PL2]
Reply-To: djgpp AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019