[LLVMdev] Cleaning out .d files

Casey Carter ccarter at cs.uiuc.edu
Wed Aug 20 22:32:00 PDT 2003


Chris Lattner wrote:

>I just wanted to mention that there is a new global makefile target "make
>cleandeps", which recursively walks through the source tree, deleting .d
>files, without removing anything else.
>
>This is useful when you update from CVS, and find out that there has been
>a header file removed.  Before you'd have to go in and remove the
>outdated .d manually, now you can just run 'make cleandeps'.
>
>Obviously it would be nice if this probably didn't exist at all, but I
>don't know of a good solution to this problem...
>
>-Chris
>
>  
>
One slightly hackish way to deal with this problem is to have an 
implicit "empty" rule for .h files:

%.h: ;

make tries to use this rule to "generate" .h files that don't exist. 
 Nothing is actually done (the ";" is an empty command list) but make 
decides that it can/must rebuild stuff that depends on the .h file.  So 
the build can then continue to the point that the .d file gets 
regenerated by compilation.

Option 2 is to post-process the .d files and add a line for each header 
file with no dependencies and no commands:

foo.c: bar.h baz.h
bar.h:
baz.h:

which achieves the same end but without side effects.

-- 
Casey Carter
Casey at Carter.net
ccarter at cs.uiuc.edu
AIM: cartec69





More information about the llvm-dev mailing list