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
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.
>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...
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.
So right you are.
I've just checked this fix into the tree:
http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20030818/006326.html
This means that everyone should do something like this next time you want
to update your tree:
cd ~/llvm # from the top...
make cleandeps # remove all .d files
utils/cvsupdate.sh # Get new Makefile.common
make # rebuild all "new and improved" .d files
The new .d files won't cause errors when headers get moved, so I removed
the 'cleandeps' target from CVS, it should be unnecessary now.

If you update your tree before running cleandeps, you can manually remove
all .d files as before with a 'find' command.
Thanks Casey!
-Chris