Re: [PATCH 12/12] Teach Makefile to check header dependencies

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH 12/12] Teach Makefile to check header dependencies

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:48:08

Jonathan Nieder [off-list ref] writes:
Junio C Hamano wrote:
...
quoted
Three observations:

 * "make distclean" should remove $(dep_files);
It removes $(dep_dirs) in "make clean".  Do you think they should be
kept around?  Or is this about when COMPUTE_HEADER_DEPENDENCIES is
turned off but .o.d files remain?
Yes, the last one.  After playing around, with or without COMPUTE/CHECK,
and then making a final build, it would be nice if "make distclean"
removed all the intermediate build products without the same special
"debug build" options (and without COMPUTE, dep_dirs is empty so nothing
is removed).  It is also fine if "make clean" did so.
quoted
 * I wish CHECK_HEADER_DEPENDENCIES pointed out unnecessary dependencies
   hardcoded in the Makefile.
That would not be hard to do, but wouldn’t the $(GIT_OBJS): $(LIB_H)
rule create a lot of noise?

How about if it checks for duplicate dependencies and unnecessary
dependencies that are not in LIB_H?
That would be ideal, I think.

[PATCH 14/12] Makefile: always remove .depend directories on 'make clean'

From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:48:08

Even if COMPUTE_HEADER_DEPENDENCIES is not set, some .o.d files
might be lying around from previous builds when it was.  This
is especially likely because using the CHECK_HEADER_DEPENDENCIES
feature requires building sometimes with COMPUTE... on and
sometimes with it off.  At the end of such an exercise, to get
a blank slate, the user ought to be able to just run 'make clean'.
Make it so.

Signed-off-by: Jonathan Nieder <redacted>
---
Junio C Hamano wrote:
Yes, the last one.  After playing around, with or without COMPUTE/CHECK,
and then making a final build, it would be nice if "make distclean"
removed all the intermediate build products without the same special
"debug build" options (and without COMPUTE, dep_dirs is empty so nothing
is removed).
Another good idea. :)

 Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/Makefile b/Makefile
index c939139..93e1a92 100644
--- a/Makefile
+++ b/Makefile
@@ -1693,9 +1693,9 @@ XDIFF_OBJS = xdiff/xdiffi.o xdiff/xprepare.o xdiff/xutils.o xdiff/xemit.o \
 OBJECTS := $(GIT_OBJS) $(XDIFF_OBJS)
 
 dep_files := $(foreach f,$(OBJECTS),$(dir $f).depend/$(notdir $f).d)
+dep_dirs := $(addsuffix .depend,$(sort $(dir $(OBJECTS))))
 
 ifdef COMPUTE_HEADER_DEPENDENCIES
-dep_dirs := $(addsuffix .depend,$(sort $(dir $(OBJECTS))))
 $(dep_dirs):
 	mkdir -p $@
 
-- 
1.7.0.rc1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help