[LLVMdev] avoid creating .dir files
Dan Villiom Podlaski Christiansen
danchr at gmail.com
Tue Jan 20 03:46:47 PST 2009
On 20 Jan 2009, at 00:04, Mike Stump wrote:
> On Jan 19, 2009, at 1:58 PM, Chris Lattner wrote:
>> On Jan 19, 2009, at 10:02 AM, Mike Stump wrote:
>>
>>> There isn't a good reason to create files called .dir in the
>>> installation directory. This patch fixes that.
>>
>> If we don't have this line, every build with do the makedir.
>
> And?
>
> $ time mkdir -p /bin
>
> real 0m0.002s
> user 0m0.000s
> sys 0m0.002s
>
> an extra mkdir takes around 2ms per build. An up-to-date inc build
> takes 2231ms for me. If you want some of the extra 2231ms back, I'd
> recommend avoiding recursion in the makefiles. This will yield a
> larger benefit than worrying about the extra mkdir.
Not that it really matters, but do note that the LLVM build system
uses ‘$(LLVM_SRC_ROOT)/autoconf/mkinstalldirs’ for MKDIR, rather
than just ‘mkdir’.
> If we have it, then .dir files are created in the installation
> directories.
>
> Trivially one can do:
>
> /dir:
> mkdir /dir
>
> /dir/prog: /dir
> gcc hi.c -o /dir/prog
>
> and avoid the extra mkdir, if one wanted. Any down side to doing
> that?
Yes, ‘prog’ will be remade every time a file as added to or removed
from the directory. (I haven't checked just now, but I'm fairly
certain that's what will happen.) One way to solve this is by using an
order-only dependancy:
/dir/prog: | /dir
gcc hi.c -o /dir/prog
This will cause GNU Make to ensure that /dir is made _before_ /dir/
prog, but without invalidating the /dir/prog target when /dir is
updated/invalidated.
Is it possible that I could get you to wait a bit with these changes?
I just obtained commit access and set up a way to move over my changes
from Mercurial to Subversion. I hope to have most of my changes to the
build system integrated, and plan to post a proposal of how to get it
done within the next few days or so.
Apart from a general overhaul of the Makefiles, I integrated Clang
into much of the LLVM build system, for instance ‘llvm-config’.
--
Dan Villiom Podlaski Christiansen, stud. scient.,
danchr at cs.au.dk, danchr at gmail.com
More information about the llvm-dev
mailing list