tools/perf/build: Add 'autodep' functionality, generate feature test dependencies...
authorIngo Molnar <mingo@kernel.org>
Mon, 30 Sep 2013 11:51:28 +0000 (13:51 +0200)
committerIngo Molnar <mingo@kernel.org>
Wed, 9 Oct 2013 06:48:29 +0000 (08:48 +0200)
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 <acme@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/n/tip-Jfma8pmPnnqzpxjbs3hpgmsj@git.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
tools/perf/config/feature-checks/Makefile

index b3f6372..4708cca 100644 (file)
@@ -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