Use GCC's -MD feature to generate a dependency file for each feature test .c 
file,
and include that .d file in the config/feature-checks/Makefile.

This allows us to do two things:

 - speed up feature tests
 - detect removal or changes in build dependencies - including system 
libraries/headers

Cc: Arnaldo Carvalho de Melo <a...@redhat.com>
Cc: Peter Zijlstra <a.p.zijls...@chello.nl>
Cc: Namhyung Kim <namhy...@kernel.org>
Cc: David Ahern <dsah...@gmail.com>
Cc: Jiri Olsa <jo...@redhat.com>
Link: http://lkml.kernel.org/n/tip-jfma8pmpnnqzpxjbs3hpg...@git.kernel.org
Signed-off-by: Ingo Molnar <mi...@kernel.org>
---
 tools/perf/config/feature-checks/Makefile | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tools/perf/config/feature-checks/Makefile 
b/tools/perf/config/feature-checks/Makefile
index b3f6372..4708cca 100644
--- a/tools/perf/config/feature-checks/Makefile
+++ b/tools/perf/config/feature-checks/Makefile
@@ -1,16 +1,20 @@
 
 FILES=test-hello
 
+CC := $(CC) -MD
+
 all: $(FILES)
 
 BUILD = $(CC) -o $(OUTPUT)$@ $@.c
 
 ###############################
 
-test-hello: test-hello.c
+test-hello:
        $(BUILD)
 
+-include *.d */*.d
+
 ###############################
 
 clean:
-       rm -f $(FILES)
+       rm -f $(FILES) *.d
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to