www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/04/09/21:30:10

Message-ID: <KgQmuHA4LpD3EwP4@talula.demon.co.uk>
Date: Sat, 10 Apr 1999 00:53:28 +0100
To: djgpp AT delorie DOT com
From: Shawn Hargreaves <Shawn AT talula DOT demon DOT co DOT uk>
Subject: Creating directories from a makefile
MIME-Version: 1.0
X-Mailer: Turnpike (32) Version 4.01 <n4LQeHkuIZDKHuEabw2AtDS$Xl>
Reply-To: djgpp AT delorie DOT com

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. Eg. given the makefile:

---- makefile ----

testdir/file.h: file.h testdir
        copy file.h testdir

testdir:
        md testdir

---- end makefile ----

This will correctly create the testdir and copy the header the first
time it is run, but on subsequent runs it will always copy the header
even though the current version is up to date, although it is smart
enough not to try recreating the directory. If I remove testdir from the
testdir/file.h dependencies, the copy works correctly and only takes
place if file.h has changed.

This is using make 3.77, and occurs in both DOS, win95, and NT.

Any ideas? It looks like making a file depend on its parent directory is
confusing make, which is fair enough, but is there any other easy way
for me to write an install target that will create a directory only if
it does not already exist? (other than the really ugly approach of
always creating it and just ignoring any errors).


--
Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
"A binary is barely software: it's more like hardware on a floppy disk."

- Raw text -


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