All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] Don't reset timestamps in include/generated if not needed
@ 2015-03-04  1:07 Valdis Kletnieks
  2015-03-08 23:08 ` Linus Torvalds
  0 siblings, 1 reply; 7+ messages in thread
From: Valdis Kletnieks @ 2015-03-04  1:07 UTC (permalink / raw)
  To: akpm, linus; +Cc: linux-kernel

Kbuild regenerates bounds.h and asm-offsets.h, resetting the timestamps
and forcing rebuilds even if the contents haven't changed.  Add a bit of
shell magic to only replace the file if the contents have in fact changed,
which should speed up git bisects and similar.

Signed-off-by: Valdis Kletnieks <valdis.kletnieks@vt.edu>

---
So I was doing a git bisect, and getting towards the end, and wondering why
it's taking a long time for each build, and I notice that netfilter modules
are being rebuilt, even though 'git bisect visualize' doesn't show anything
that should have touched netfilter.  Turns out the offender is bounds.h

Fully 3/4 of my modules have a dependency on bounds.h - and we touch it
all the time, even if the contents haven't changed.

RFC because I can't wrap my head around why this wasn't done ages ago.
If I'm missing something something obvious, please apply a cluestick. :)

Lightly tested - if I rm one of those two files, it gets rebuilt. If I
insert some whitespace, it gets replaced. If I don't touch it, the datestamp
doesn't change.

--- linux-next/Kbuild.dist	2015-03-03 19:50:45.175673346 -0500
+++ linux-next/Kbuild	2015-03-03 20:03:20.107820199 -0500
@@ -15,7 +15,7 @@
 
 quiet_cmd_offsets = GEN     $@
 define cmd_offsets
-	(set -e; \
+	( (set -e; \
 	 echo "#ifndef $2"; \
 	 echo "#define $2"; \
 	 echo "/*"; \
@@ -26,7 +26,10 @@
 	 echo ""; \
 	 sed -ne $(sed-y) $<; \
 	 echo ""; \
-	 echo "#endif" ) > $@
+	 echo "#endif" ) > $@.tmp; \
+	 if [ ! -f $@ ]; then mv $@.tmp $@; \
+	 elif cmp -s $@ $@.tmp ; then rm $@.tmp; \
+	 else mv -f $@.tmp $@; fi )
 endef
 
 #####



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-03-24 16:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-04  1:07 [RFC PATCH] Don't reset timestamps in include/generated if not needed Valdis Kletnieks
2015-03-08 23:08 ` Linus Torvalds
2015-03-11 10:01   ` Michal Marek
2015-03-13  4:59     ` Masahiro Yamada
2015-03-13 10:00       ` Michal Marek
2015-03-24 15:36         ` [PATCH] kbuild: " Michal Marek
2015-03-24 16:08           ` Valdis.Kletnieks

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.