Moving the tests to a separate file, feature-tests.mak and using a try-cc
function similar to the try-run in Kbuild.
This also makes the output more quiet as we can stop using the INTERMEDIATE
target to remove the .perf.dev.null file needed for some gcc versions where
/dev/null can't be used as the output file name.
As the tests get shorter by uninlining the source code used to test for
features, we can more properly use identation.
The feature tests itself can be made more clear and reused, like when trying to
see what is needed to have bfd_demangle.
We also get a bit closer to reusing scripts/Kbuild.include, reducing the
distance from the kernel build system.
Tests performed:
[root@emilia perf]# make -j9 O=/tmp/perf
PERF_VERSION = 0.0.2.PERF
GEN /tmp/perf/common-cmds.h
* new build flags or prefix
GEN perf-archive
CC /tmp/perf/builtin-annotate.o
CC /tmp/perf/bench/sched-messaging.o
CC /tmp/perf/builtin-diff.o
<SNIP>
CC /tmp/perf/scripts/python/Perf-Trace-Util/Context.o
CC /tmp/perf/perf.o
CC /tmp/perf/builtin-help.o
AR /tmp/perf/libperf.a
LINK /tmp/perf/perf
[root@emilia perf]#
If we uninstall, for instance newt-devel we get:
[root@emilia perf]# rpm -e newt-devel
[root@emilia perf]# make -j9 O=/tmp/perf
Makefile:564: newt not found, disables TUI support. Please install newt-devel or libnewt-dev
* new build flags or prefix
GEN perf-archive
CC /tmp/perf/perf.o
CC /tmp/perf/builtin-annotate.o
<SNIP>
AR /tmp/perf/libperf.a
LINK /tmp/perf/perf
[root@emilia perf]#
And then binutils-devel:
[root@emilia perf]# make -j9 O=/tmp/perf
Makefile:564: newt not found, disables TUI support. Please install newt-devel or libnewt-dev
Makefile:632: No bfd.h/libbfd found, install binutils-dev[el]/zlib-static to gain symbol demangling
* new build flags or prefix
GEN perf-archive
CC /tmp/perf/perf.o
<SNIP>
AR /tmp/perf/libperf.a
LINK /tmp/perf/perf
[root@emilia perf]#
And then strictly required devel packages:
[root@emilia perf]# rpm -e elfutils-libelf-devel elfutils-devel
[root@emilia perf]# make -j9 O=/tmp/perf
Makefile:509: No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev
Makefile:542: *** No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel. Stop.
[root@emilia perf]#
After installing everything back on:
[root@emilia perf]# yum install elfutils-devel binutils-devel newt-devel
<SNIP>
Installed:
binutils-devel.x86_64 0:2.20.51.0.2-5.11.el6
elfutils-devel.x86_64 0:0.147-1.el6
elfutils-libelf-devel.x86_64 0:0.147-1.el6
newt-devel.x86_64 0:0.52.11-1.el6
Complete!
[root@emilia perf]# make -j9
PERF_VERSION = 0.0.2.PERF
GEN common-cmds.h
* new build flags or prefix
GEN perf-archive
CC builtin-annotate.o
<SNIP>
AR libperf.a
LINK perf
[root@emilia perf]# make -j9
[root@emilia perf]#
Thanks to Sam for pointing me to try-run.
Cc: David S. Miller <davem@davemloft.net>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Michal Marek <mmarek@suse.cz>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>