Since it's actually small portion of kbuild that perf needs,
I realized it's actually better to steal it than 'reconfigure'
kbuild to be usable for perf.
Also this patchset is kind of incremental version of the latest:
perf tools: Add kbuild support into Makefile.kbuild
so it should be easier to review.
NOTE I couldn't find any copyright/credit messages in the kbuild
system, but would be happy to include it if someone suggests one.
The stolen parts are in files:
Makefile.kbuild
Build.include
The idea and more details are explained in the 'Documentation/Build'
file. The basic idea is the same as in kbuild system, with some minor
changes to allow for multiple binaries build definitions.
User provides 'Build' files with objects definitions like:
perf-y += perf.o
perf-y += builtin-bench.o
...
libperf-y += util/
...
and the build framework outputs files:
perf-in.o
libperf-in.o
which are then linked into appropriate binaries/libraries.
(perf libperf.a libperf-gtk.so)