tools build: Fix header removal build issue
Subsystems (3)
Jiri Olsa
reviewercover tools build: Fix header removal build issue
hi,
for dependency tracking we currently use targets that fall out of the gcc -MD command. We store this info in the .cmd file and include as makefile during the build.
This format put object as target and all the c and header files as dependencies, like:
util/abspath.o: util/abspath.c /usr/include/stdc-predef.h util/cache.h \ /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ ...
If any of those dependency header files (krava.h below) is removed the build fails on:
make[1]: *** No rule to make target 'krava.h', needed by 'inc.o'. Stop.
This patch adds fixdep helper, that is used by kbuild to alter the shape of the object dependencies like:
source_util/abspath.o := util/abspath.c
deps_util/abspath.o := \
/usr/include/stdc-predef.h \
util/cache.h \
...
util/abspath.o: $(deps_util/abspath.o)
$(deps_util/abspath.o):With this format the header removal won't make the build fail, because it'll be picked up by the last empty target defined for each header.
thanks,
jirka
---
Jiri Olsa (7):
tools build: Add Makefile.include
tools build: Add test for missing include
tools build: Add fixdep dependency helper
tools build: Move dependency copy into function tools build: Make fixdep helper part of the build process perf tools: Rename single_dep target to prepare tools build: Build fixdep helper from perf and basic libs
tools/build/Build | 1 + tools/build/Build.include | 17 +++++++++--- tools/build/Documentation/Build.txt | 52 +++++++++++++++++++++++++++--------- tools/build/Makefile | 43 ++++++++++++++++++++++++++++++ tools/build/Makefile.build | 7 +++++ tools/build/Makefile.include | 6 +++++ tools/build/fixdep.c | 168 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ tools/build/tests/ex/Build | 1 + tools/build/tests/ex/Makefile | 13 +++++---- tools/build/tests/ex/ex.c | 2 ++ tools/build/tests/ex/inc.c | 8 ++++++ tools/build/tests/run.sh | 27 +++++++++++++++++++ tools/lib/api/Makefile | 6 +++-- tools/lib/bpf/Makefile | 6 +++-- tools/lib/lockdep/Makefile | 6 +++-- tools/perf/Makefile.perf | 32 +++++++++++----------- 16 files changed, 352 insertions(+), 43 deletions(-) create mode 100644 tools/build/Build create mode 100644 tools/build/Makefile create mode 100644 tools/build/Makefile.include create mode 100644 tools/build/fixdep.c create mode 100644 tools/build/tests/ex/inc.c
Jiri Olsa
reviewerPATCH 1/7 tools build: Add Makefile.include
To ease up build framework code setup for users. More shared code will be added in following patches.
--- tools/build/Documentation/Build.txt | 45 ++++++++++++++++++++++++++----------- tools/build/Makefile.include | 1 + tools/build/tests/ex/Makefile | 3 ++- tools/lib/api/Makefile | 2 +- tools/lib/bpf/Makefile | 2 +- tools/lib/lockdep/Makefile | 2 +- tools/perf/Makefile.perf | 2 +- 7 files changed, 39 insertions(+), 18 deletions(-) create mode 100644 tools/build/Makefile.include
tools/build/Documentation/Build.txt +32 -13
@@ -11,8 +11,9 @@ Unlike the kernel we don't have a single build object 'obj-y' list that where we setup source objects, but we support more. This allows one 'Build' file to carry a sources list for multiple build objects. -a) Build framework makefiles ----------------------------- + +Build framework makefiles +------------------------- The build framework consists of 2 Makefiles:
@@ -23,7 +24,7 @@ While the 'Build.include' file contains just some generic definitions, the 'Makefile.build' file is the makefile used from the outside. It's interface/usage is following: - $ make -f tools/build/Makefile srctree=$(KSRC) dir=$(DIR) obj=$(OBJECT) + $ make -f tools/build/Makefile.build srctree=$(KSRC) dir=$(DIR) obj=$(OBJECT) where:
@@ -38,8 +39,9 @@ called $(OBJECT)-in.o: which includes all compiled sources described in 'Build' makefiles. -a) Build makefiles ------------------- + +Build makefiles +--------------- The user supplies 'Build' makefiles that contains a objects list, and connects the build to nested directories.
@@ -95,8 +97,24 @@ It's only a matter of 2 single commands to create the final binaries: You can check the 'ex' example in 'tools/build/tests/ex' for more details. -b) Rules --------- + +Makefile.include +---------------- + +The tools/build/Makefile.include makefile could be included +via user makefiles to get usefull definitions. + +It defines following interface: + + - build macro definition: + build := -f $(srctree)/tools/build/Makefile.build dir=. obj + + to make it easier to invoke build like: + make $(build)=ex + + +Rules +----- The build framework provides standard compilation rules to handle .S and .c compilation.
@@ -104,8 +122,9 @@ compilation. It's possible to include special rule if needed (like we do for flex or bison code generation). -c) CFLAGS ---------- + +CFLAGS +------ It's possible to alter the standard object C flags in the following way:
@@ -115,8 +134,8 @@ It's possible to alter the standard object C flags in the following way: This C flags changes has the scope of the Build makefile they are defined in. -d) Dependencies ---------------- +Dependencies +------------ For each built object file 'a.o' the '.a.cmd' is created and holds:
@@ -130,8 +149,8 @@ All existing '.cmd' files are included in the Build process to follow properly the dependencies and trigger a rebuild when necessary. -e) Single rules ---------------- +Single rules +------------ It's possible to build single object file by choice, like:
tools/build/Makefile.include new file +1 -0
@@ -0,0 +1 @@ +build := -f $(srctree)/tools/build/Makefile.build dir=. obj
tools/build/tests/ex/Makefile +2 -1
@@ -3,7 +3,8 @@ export CC := gcc export LD := ld export AR := ar -build := -f $(srctree)/tools/build/Makefile.build dir=. obj +include $(srctree)/tools/build/Makefile.include + ex: ex-in.o libex-in.o gcc -o $@ $^
tools/lib/api/Makefile +1 -1
@@ -21,10 +21,10 @@ CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 RM = rm -f -build := -f $(srctree)/tools/build/Makefile.build dir=. obj API_IN := $(OUTPUT)libapi-in.o export srctree OUTPUT CC LD CFLAGS V +include $(srctree)/tools/build/Makefile.include all: $(LIBFILE)
tools/lib/bpf/Makefile +1 -1
@@ -124,7 +124,7 @@ endif MAKEOVERRIDES= export srctree OUTPUT CC LD CFLAGS V -build := -f $(srctree)/tools/build/Makefile.build dir=. obj +include $(srctree)/tools/build/Makefile.include BPF_IN := $(OUTPUT)libbpf-in.o LIB_FILE := $(addprefix $(OUTPUT),$(LIB_FILE))
tools/lib/lockdep/Makefile +1 -1
@@ -94,7 +94,7 @@ else endif export srctree OUTPUT CC LD CFLAGS V -build := -f $(srctree)/tools/build/Makefile.build dir=. obj +include $(srctree)/tools/build/Makefile.include do_compile_shared_library = \ ($(print_shared_lib_compile) \
tools/perf/Makefile.perf +1 -1
@@ -297,7 +297,7 @@ strip: $(PROGRAMS) $(OUTPUT)perf PERF_IN := $(OUTPUT)perf-in.o export srctree OUTPUT RM CC LD AR CFLAGS V BISON FLEX AWK -build := -f $(srctree)/tools/build/Makefile.build dir=. obj +include $(srctree)/tools/build/Makefile.include $(PERF_IN): $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h FORCE $(Q)$(MAKE) $(build)=perf
Signature · 1 line
2.4.3
tip-bot for Jiri Olsa
merge bot[tip:perf/core] tools build: Add Makefile.include
tools build: Add Makefile.include
Commit-ID: ab6201d09b1840c7ffcd6606c1d3dae68b8b3048 Gitweb: http://git.kernel.org/tip/ab6201d09b1840c7ffcd6606c1d3dae68b8b3048 Author: Jiri Olsa <[email protected]> AuthorDate: Wed, 23 Sep 2015 12:33:56 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Mon, 28 Sep 2015 15:50:54 -0300
tools build: Add Makefile.include
To ease up build framework code setup for users.
More shared code will be added in the following patches.
--- tools/build/Documentation/Build.txt | 45 ++++++++++++++++++++++++++----------- tools/build/Makefile.include | 1 + tools/build/tests/ex/Makefile | 3 ++- tools/lib/api/Makefile | 2 +- tools/lib/bpf/Makefile | 2 +- tools/lib/lockdep/Makefile | 2 +- tools/perf/Makefile.perf | 2 +- 7 files changed, 39 insertions(+), 18 deletions(-)
tools/build/Documentation/Build.txt +32 -13
@@ -11,8 +11,9 @@ Unlike the kernel we don't have a single build object 'obj-y' list that where we setup source objects, but we support more. This allows one 'Build' file to carry a sources list for multiple build objects. -a) Build framework makefiles ----------------------------- + +Build framework makefiles +------------------------- The build framework consists of 2 Makefiles:
@@ -23,7 +24,7 @@ While the 'Build.include' file contains just some generic definitions, the 'Makefile.build' file is the makefile used from the outside. It's interface/usage is following: - $ make -f tools/build/Makefile srctree=$(KSRC) dir=$(DIR) obj=$(OBJECT) + $ make -f tools/build/Makefile.build srctree=$(KSRC) dir=$(DIR) obj=$(OBJECT) where:
@@ -38,8 +39,9 @@ called $(OBJECT)-in.o: which includes all compiled sources described in 'Build' makefiles. -a) Build makefiles ------------------- + +Build makefiles +--------------- The user supplies 'Build' makefiles that contains a objects list, and connects the build to nested directories.
@@ -95,8 +97,24 @@ It's only a matter of 2 single commands to create the final binaries: You can check the 'ex' example in 'tools/build/tests/ex' for more details. -b) Rules --------- + +Makefile.include +---------------- + +The tools/build/Makefile.include makefile could be included +via user makefiles to get usefull definitions. + +It defines following interface: + + - build macro definition: + build := -f $(srctree)/tools/build/Makefile.build dir=. obj + + to make it easier to invoke build like: + make $(build)=ex + + +Rules +----- The build framework provides standard compilation rules to handle .S and .c compilation.
@@ -104,8 +122,9 @@ compilation. It's possible to include special rule if needed (like we do for flex or bison code generation). -c) CFLAGS ---------- + +CFLAGS +------ It's possible to alter the standard object C flags in the following way:
@@ -115,8 +134,8 @@ It's possible to alter the standard object C flags in the following way: This C flags changes has the scope of the Build makefile they are defined in. -d) Dependencies ---------------- +Dependencies +------------ For each built object file 'a.o' the '.a.cmd' is created and holds:
@@ -130,8 +149,8 @@ All existing '.cmd' files are included in the Build process to follow properly the dependencies and trigger a rebuild when necessary. -e) Single rules ---------------- +Single rules +------------ It's possible to build single object file by choice, like:
tools/build/Makefile.include new file +1 -0
@@ -0,0 +1 @@ +build := -f $(srctree)/tools/build/Makefile.build dir=. obj
tools/build/tests/ex/Makefile +2 -1
@@ -3,7 +3,8 @@ export CC := gcc export LD := ld export AR := ar -build := -f $(srctree)/tools/build/Makefile.build dir=. obj +include $(srctree)/tools/build/Makefile.include + ex: ex-in.o libex-in.o gcc -o $@ $^
tools/lib/api/Makefile +1 -1
@@ -21,10 +21,10 @@ CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 RM = rm -f -build := -f $(srctree)/tools/build/Makefile.build dir=. obj API_IN := $(OUTPUT)libapi-in.o export srctree OUTPUT CC LD CFLAGS V +include $(srctree)/tools/build/Makefile.include all: $(LIBFILE)
tools/lib/bpf/Makefile +1 -1
@@ -124,7 +124,7 @@ endif MAKEOVERRIDES= export srctree OUTPUT CC LD CFLAGS V -build := -f $(srctree)/tools/build/Makefile.build dir=. obj +include $(srctree)/tools/build/Makefile.include BPF_IN := $(OUTPUT)libbpf-in.o LIB_FILE := $(addprefix $(OUTPUT),$(LIB_FILE))
tools/lib/lockdep/Makefile +1 -1
@@ -94,7 +94,7 @@ else endif export srctree OUTPUT CC LD CFLAGS V -build := -f $(srctree)/tools/build/Makefile.build dir=. obj +include $(srctree)/tools/build/Makefile.include do_compile_shared_library = \ ($(print_shared_lib_compile) \
tools/perf/Makefile.perf +1 -1
@@ -297,7 +297,7 @@ strip: $(PROGRAMS) $(OUTPUT)perf PERF_IN := $(OUTPUT)perf-in.o export srctree OUTPUT RM CC LD AR CFLAGS V BISON FLEX AWK -build := -f $(srctree)/tools/build/Makefile.build dir=. obj +include $(srctree)/tools/build/Makefile.include $(PERF_IN): $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h FORCE $(Q)$(MAKE) $(build)=perf
Jiri Olsa
reviewerPATCH 2/7 tools build: Add test for missing include
In reply to Jiri OlsaThe current build framework fails to cope with header file removal. The reason is the removed header file stays in the .cmd file target rule and force the build to fail.
This issue is fixed and explained in following patches.
Adding new build test that simulates header removal.
--- tools/build/tests/ex/Build | 1 + tools/build/tests/ex/Makefile | 2 +- tools/build/tests/ex/ex.c | 2 ++ tools/build/tests/ex/inc.c | 8 ++++++++ tools/build/tests/run.sh | 27 +++++++++++++++++++++++++++ 5 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 tools/build/tests/ex/inc.c
tools/build/tests/ex/Build +1 -0
@@ -4,6 +4,7 @@ ex-y += b.o ex-y += b.o ex-y += empty/ ex-y += empty2/ +ex-y += inc.o libex-y += c.o libex-y += d.o
tools/build/tests/ex/Makefile +1 -1
@@ -1,4 +1,4 @@ -export srctree := ../../../.. +export srctree := $(abspath ../../../..) export CC := gcc export LD := ld export AR := ar
tools/build/tests/ex/ex.c +2 -0
@@ -5,6 +5,7 @@ int c(void);int d (void );int e (void );int f (void ); +int inc (void );int main (void ) {
@@ -14,6 +15,7 @@ int main(void)d ();e ();f (); +inc ();return 0 ; }
tools/build/tests/ex/inc.c new file +8 -0
@@ -0,0 +1,8 @@ +#ifdef INCLUDE +#include "krava.h" +#endif + +int inc (void ) +{ +return 0 ; +}
tools/build/tests/run.sh +27 -0
@@ -34,9 +34,36 @@ function test_ex_suffix { make -C ex V=1 clean > /dev/null 2>&1 rm -f ex.out } + +function test_ex_include { + make -C ex V=1 clean > ex.out 2>&1 + + # build with krava.h include + touch ex/krava.h + make -C ex V=1 CFLAGS=-DINCLUDE >> ex.out 2>&1 + + if [ ! -x ./ex/ex ]; then + echo FAILED + exit -1 + fi + + # build without the include + rm -f ex/krava.h ex/ex + make -C ex V=1 >> ex.out 2>&1 + + if [ ! -x ./ex/ex ]; then + echo FAILED + exit -1 + fi + + make -C ex V=1 clean > /dev/null 2>&1 + rm -f ex.out +} + echo -n Testing.. test_ex test_ex_suffix +test_ex_include echo OK
Signature · 1 line
2.4.3
Arnaldo Carvalho de Melo
maintainerRe: [PATCH 2/7] tools build: Add test for missing include
Em Wed, Sep 23, 2015 at 12:33:57PM +0200, Jiri Olsa escreveu:
Quoted 3 lines
The current build framework fails to cope with header file removal. The reason is the removed header file stays in the .cmd file target rule and force the build to fail.
So, where is this test hooked up, is the way to test this to do:
cd tools/build/tests/
./run.sh
less ex.out
?
Quoted 114 lines
This issue is fixed and explained in following patches.
Adding new build test that simulates header removal.
Signed-off-by Jiri Olsa <[email protected]>--- tools/build/tests/ex/Build | 1 + tools/build/tests/ex/Makefile | 2 +- tools/build/tests/ex/ex.c | 2 ++ tools/build/tests/ex/inc.c | 8 ++++++++ tools/build/tests/run.sh | 27 +++++++++++++++++++++++++++ 5 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 tools/build/tests/ex/inc.ctools/build/tests/ex/Build +1
-0@@ -4,6 +4,7 @@ ex-y += b.o ex-y += b.o ex-y += empty/ ex-y += empty2/ +ex-y += inc.o libex-y += c.o libex-y += d.otools/build/tests/ex/Makefile +1
-1@@ -1,4 +1,4 @@ -export srctree := ../../../.. +export srctree := $(abspath ../../../..) export CC := gcc export LD := ld export AR := artools/build/tests/ex/ex.c +2
-0@@ -5,6 +5,7 @@ int c(void);int d (void );int e (void );int f (void ); +int inc (void );int main (void ) {@@ -14,6 +15,7 @@ int main(void)d ();e ();f (); +inc ();return 0 ; }tools/build/tests/ex/inc.c new file +8
-0@@ -0,0 +1,8 @@ +#ifdef INCLUDE +#include "krava.h" +#endif + +int inc (void ) +{ +return 0 ; +}tools/build/tests/run.sh +27
-0@@ -34,9 +34,36 @@ function test_ex_suffix { make -C ex V=1 clean > /dev/null 2>&1 rm -f ex.out } + +function test_ex_include { + make -C ex V=1 clean > ex.out 2>&1 + + # build with krava.h include + touch ex/krava.h + make -C ex V=1 CFLAGS=-DINCLUDE >> ex.out 2>&1 + + if [ ! -x ./ex/ex ]; then + echo FAILED + exit -1 + fi + + # build without the include + rm -f ex/krava.h ex/ex + make -C ex V=1 >> ex.out 2>&1 + + if [ ! -x ./ex/ex ]; then + echo FAILED + exit -1 + fi + + make -C ex V=1 clean > /dev/null 2>&1 + rm -f ex.out +} + echo -n Testing.. test_ex test_ex_suffix +test_ex_include echo OKSignature · 1 line
2.4.3
Re: [PATCH 2/7] tools build: Add test for missing include
Quoted 10 lines · Arnaldo Carvalho de Melo
Em Wed, Sep 23, 2015 at 12:33:57PM +0200, Jiri Olsa escreveu:
Quoted 3 lines
The current build framework fails to cope with header file removal. The reason is the removed header file stays in the .cmd file target rule and force the build to fail.
So, where is this test hooked up, is the way to test this to do:
cd
tools/build/tests/
./run.sh
less ex.out
yep, ex.out is there only in case of error
jirka
tip-bot for Jiri Olsa
merge bot[tip:perf/core] tools build: Add test for missing include
In reply to Jiri Olsatools build: Add test for missing include
Commit-ID: 0c00c3fb4e4a6ff714b7ad864f58e0fb33b3534c Gitweb: http://git.kernel.org/tip/0c00c3fb4e4a6ff714b7ad864f58e0fb33b3534c Author: Jiri Olsa <[email protected]> AuthorDate: Wed, 23 Sep 2015 12:33:57 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Mon, 28 Sep 2015 15:50:54 -0300
tools build: Add test for missing include
The current build framework fails to cope with header file removal. The reason is that the removed header file stays in the .cmd file target rule and forces the build to fail.
This issue is fixed and explained in the following patches.
Adding a new build test that simulates header removal.
--- tools/build/tests/ex/Build | 1 + tools/build/tests/ex/Makefile | 2 +- tools/build/tests/ex/ex.c | 2 ++ tools/build/tests/ex/inc.c | 8 ++++++++ tools/build/tests/run.sh | 27 +++++++++++++++++++++++++++ 5 files changed, 39 insertions(+), 1 deletion(-)
tools/build/tests/ex/Build +1 -0
@@ -4,6 +4,7 @@ ex-y += b.o ex-y += b.o ex-y += empty/ ex-y += empty2/ +ex-y += inc.o libex-y += c.o libex-y += d.o
tools/build/tests/ex/Makefile +1 -1
@@ -1,4 +1,4 @@ -export srctree := ../../../.. +export srctree := $(abspath ../../../..) export CC := gcc export LD := ld export AR := ar
tools/build/tests/ex/ex.c +2 -0
@@ -5,6 +5,7 @@ int c(void);int d (void );int e (void );int f (void ); +int inc (void );int main (void ) {
@@ -14,6 +15,7 @@ int main(void)d ();e ();f (); +inc ();return 0 ; }
tools/build/tests/ex/inc.c new file +8 -0
@@ -0,0 +1,8 @@ +#ifdef INCLUDE +#include "krava.h" +#endif + +int inc (void ) +{ +return 0 ; +}
tools/build/tests/run.sh +27 -0
@@ -34,9 +34,36 @@ function test_ex_suffix { make -C ex V=1 clean > /dev/null 2>&1 rm -f ex.out } + +function test_ex_include { + make -C ex V=1 clean > ex.out 2>&1 + + # build with krava.h include + touch ex/krava.h + make -C ex V=1 CFLAGS=-DINCLUDE >> ex.out 2>&1 + + if [ ! -x ./ex/ex ]; then + echo FAILED + exit -1 + fi + + # build without the include + rm -f ex/krava.h ex/ex + make -C ex V=1 >> ex.out 2>&1 + + if [ ! -x ./ex/ex ]; then + echo FAILED + exit -1 + fi + + make -C ex V=1 clean > /dev/null 2>&1 + rm -f ex.out +} + echo -n Testing.. test_ex test_ex_suffix +test_ex_include echo OK
Jiri Olsa
reviewerPATCH 3/7 tools build: Add fixdep dependency helper
In reply to Jiri OlsaFor dependency tracking we currently use targets that fall out of the gcc -MD command. We store this info in the .cmd file and include as makefile during the build.
This format put object as target and all the c and header files as dependencies, like:
util/abspath.o: util/abspath.c /usr/include/stdc-predef.h util/cache.h \ /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ ...
If any of those dependency header files (krava.h below) is removed the build fails on:
make[1]: *** No rule to make target 'krava.h', needed by 'inc.o'. Stop.
This patch adds fixdep helper, that is used by kbuild to alter the shape of the object dependencies like:
source_util/abspath.o := util/abspath.c
deps_util/abspath.o := \
/usr/include/stdc-predef.h \
util/cache.h \
...
util/abspath.o: $(deps_util/abspath.o)
$(deps_util/abspath.o):With this format the header removal won't make the build fail, because it'll be picked up by the last empty target defined for each header.
As previously mentioned the fixdep tool is taken from kbuild. It's not complete backport, only the part that alters the standard dependency info was taken, the part that adds the CONFIG_* dependency logic will be probably taken later on.
--- tools/build/Build | 1 + tools/build/Makefile | 43 +++++++++++++ tools/build/fixdep.c | 168 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 212 insertions(+) create mode 100644 tools/build/Build create mode 100644 tools/build/Makefile create mode 100644 tools/build/fixdep.c
tools/build/Build new file +1 -0
@@ -0,0 +1 @@ +fixdep-y := fixdep.o
tools/build/Makefile new file +43 -0
43 lines not on this page · raw message
tools/build/fixdep.c new file +168 -0
168 lines not on this page · raw message
Signature · 1 line
2.4.3
tip-bot for Jiri Olsa
merge bot[tip:perf/core] tools build: Add fixdep dependency helper
tools build: Add fixdep dependency helper
Commit-ID: 9f7ef9854e800bc3bab3d9a527e8f8f960eec1a6 Gitweb: http://git.kernel.org/tip/9f7ef9854e800bc3bab3d9a527e8f8f960eec1a6 Author: Jiri Olsa <[email protected]> AuthorDate: Wed, 23 Sep 2015 12:33:58 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Mon, 28 Sep 2015 15:50:55 -0300
tools build: Add fixdep dependency helper
For dependency tracking we currently use targets that fall out of the gcc -MD command. We store this info in the .cmd file and include as makefile during the build.
This format put object as target and all the c and header files as dependencies, like:
util/abspath.o: util/abspath.c /usr/include/stdc-predef.h util/cache.h \ /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ ...
If any of those dependency header files (krava.h below) is removed the build fails on:
make[1]: *** No rule to make target 'krava.h', needed by 'inc.o'. Stop.
This patch adds fixdep helper, that is used by kbuild to alter the shape of the object dependencies like:
source_util/abspath.o := util/abspath.c
deps_util/abspath.o := \
/usr/include/stdc-predef.h \
util/cache.h \
...
util/abspath.o: $(deps_util/abspath.o)
$(deps_util/abspath.o):With this format the header removal won't make the build fail, because it'll be picked up by the last empty target defined for each header.
As previously mentioned the fixdep tool is taken from kbuild. It's not complete backport, only the part that alters the standard dependency info was taken, the part that adds the CONFIG_* dependency logic will be probably taken later on.
--- tools/build/Build | 1 + tools/build/Makefile | 43 +++++++++++++ tools/build/fixdep.c | 168 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 212 insertions(+)
tools/build/Build new file +1 -0
@@ -0,0 +1 @@ +fixdep-y := fixdep.o
tools/build/Makefile new file +43 -0
43 lines not on this page · raw message
tools/build/fixdep.c new file +168 -0
168 lines not on this page · raw message
Jiri Olsa
reviewerPATCH 4/7 tools build: Move dependency copy into function
In reply to Jiri OlsaSo it's easier to add more functionality in following commit.
--- tools/build/Build.include | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
tools/build/Build.include +8 -3
@@ -55,14 +55,19 @@ make-cmd = $(call escsq,$(subst \#,\\\#,$(subst $$,$$$$,$(cmd_$(1))))) any-prereq = $(filter-out $(PHONY),$?) $(filter-out $(PHONY) $(wildcard $^),$^) ### +# Copy dependency data into .cmd file +# - gcc -M dependency info +# - command line to create object 'cmd_object :=' +dep-cmd = cat $(depfile) > $(dot-target).cmd; \ + printf '%s\n' 'cmd_$@ := $(make-cmd)' >> $(dot-target).cmd + +### # if_changed_dep - execute command if any prerequisite is newer than # target, or command line has changed and update # dependencies in the cmd file if_changed_dep = $(if $(strip $(any-prereq) $(arg-check)), \ @set -e; \ - $(echo-cmd) $(cmd_$(1)); \ - cat $(depfile) > $(dot-target).cmd; \ - printf '%s\n' 'cmd_$@ := $(make-cmd)' >> $(dot-target).cmd) + $(echo-cmd) $(cmd_$(1)) && $(dep-cmd)) # if_changed - execute command if any prerequisite is newer than # target, or command line has changed
Signature · 1 line
2.4.3
tip-bot for Jiri Olsa
merge bot[tip:perf/core] tools build: Move dependency copy into function
tools build: Move dependency copy into function
Commit-ID: 275e2d95591e2714d6b541d4e26959381d6b2705 Gitweb: http://git.kernel.org/tip/275e2d95591e2714d6b541d4e26959381d6b2705 Author: Jiri Olsa <[email protected]> AuthorDate: Wed, 23 Sep 2015 12:33:59 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Mon, 28 Sep 2015 15:50:55 -0300
tools build: Move dependency copy into function
So it's easier to add more functionality in the following commit.
--- tools/build/Build.include | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
tools/build/Build.include +8 -3
@@ -55,14 +55,19 @@ make-cmd = $(call escsq,$(subst \#,\\\#,$(subst $$,$$$$,$(cmd_$(1))))) any-prereq = $(filter-out $(PHONY),$?) $(filter-out $(PHONY) $(wildcard $^),$^) ### +# Copy dependency data into .cmd file +# - gcc -M dependency info +# - command line to create object 'cmd_object :=' +dep-cmd = cat $(depfile) > $(dot-target).cmd; \ + printf '%s\n' 'cmd_$@ := $(make-cmd)' >> $(dot-target).cmd + +### # if_changed_dep - execute command if any prerequisite is newer than # target, or command line has changed and update # dependencies in the cmd file if_changed_dep = $(if $(strip $(any-prereq) $(arg-check)), \ @set -e; \ - $(echo-cmd) $(cmd_$(1)); \ - cat $(depfile) > $(dot-target).cmd; \ - printf '%s\n' 'cmd_$@ := $(make-cmd)' >> $(dot-target).cmd) + $(echo-cmd) $(cmd_$(1)) && $(dep-cmd)) # if_changed - execute command if any prerequisite is newer than # target, or command line has changed
Jiri Olsa
reviewerPATCH 5/7 tools build: Make fixdep helper part of the build process
In reply to Jiri OlsaMaking fixdep helper to be invoked within the dep-cmd.
Each user of the build framework needs to make sure fixdep exists before executing the build itself.
If the build won't find fixdep, it falls back to the old style dependency tracking.
--- tools/build/Build.include | 10 ++++++++-- tools/build/Makefile.build | 7 +++++++ 2 files changed, 15 insertions(+), 2 deletions(-)
tools/build/Build.include +8 -2
@@ -58,8 +58,14 @@ any-prereq = $(filter-out $(PHONY),$?) $(filter-out $(PHONY) $(wildcard $^),$^) # Copy dependency data into .cmd file # - gcc -M dependency info # - command line to create object 'cmd_object :=' -dep-cmd = cat $(depfile) > $(dot-target).cmd; \ - printf '%s\n' 'cmd_$@ := $(make-cmd)' >> $(dot-target).cmd +dep-cmd = $(if $(wildcard $(fixdep)), \ + $(fixdep) $(depfile) $@ '$(make-cmd)' > $(dot-target).tmp; \ + rm -f $(depfile); \ + mv -f $(dot-target).tmp $(dot-target).cmd, \ + printf '\# cannot find fixdep (%s)\n' $(fixdep) > $(dot-target).cmd; \ + printf '\# using basic dep data\n\n' >> $(dot-target).cmd; \ + cat $(depfile) >> $(dot-target).cmd; \ + printf '%s\n' 'cmd_$@ := $(make-cmd)' >> $(dot-target).cmd) ### # if_changed_dep - execute command if any prerequisite is newer than
tools/build/Makefile.build +7 -0
@@ -21,6 +21,13 @@ endif build-dir := $(srctree)/tools/build +# Define $(fixdep) for dep-cmd function +ifeq ($(OUTPUT),) + fixdep := $(build-dir)/fixdep +else + fixdep := $(OUTPUT)/fixdep +endif + # Generic definitions include $(build-dir)/Build.include
Signature · 1 line
2.4.3
tip-bot for Jiri Olsa
merge bot[tip:perf/core] tools build: Make the fixdep helper part of the build process
tools build: Make the fixdep helper part of the build process
Commit-ID: 9fb81323eb3085b6a47fe81d78541958ae7eaea3 Gitweb: http://git.kernel.org/tip/9fb81323eb3085b6a47fe81d78541958ae7eaea3 Author: Jiri Olsa <[email protected]> AuthorDate: Wed, 23 Sep 2015 12:34:00 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Mon, 28 Sep 2015 15:50:55 -0300
tools build: Make the fixdep helper part of the build process
Making the fixdep helper to be invoked within dep-cmd.
Each user of the build framework needs to make sure fixdep exists before executing the build itself.
If the build doesn't find fixdep, it falls back to the old style dependency tracking.
--- tools/build/Build.include | 10 ++++++++-- tools/build/Makefile.build | 7 +++++++ 2 files changed, 15 insertions(+), 2 deletions(-)
tools/build/Build.include +8 -2
@@ -58,8 +58,14 @@ any-prereq = $(filter-out $(PHONY),$?) $(filter-out $(PHONY) $(wildcard $^),$^) # Copy dependency data into .cmd file # - gcc -M dependency info # - command line to create object 'cmd_object :=' -dep-cmd = cat $(depfile) > $(dot-target).cmd; \ - printf '%s\n' 'cmd_$@ := $(make-cmd)' >> $(dot-target).cmd +dep-cmd = $(if $(wildcard $(fixdep)), \ + $(fixdep) $(depfile) $@ '$(make-cmd)' > $(dot-target).tmp; \ + rm -f $(depfile); \ + mv -f $(dot-target).tmp $(dot-target).cmd, \ + printf '\# cannot find fixdep (%s)\n' $(fixdep) > $(dot-target).cmd; \ + printf '\# using basic dep data\n\n' >> $(dot-target).cmd; \ + cat $(depfile) >> $(dot-target).cmd; \ + printf '%s\n' 'cmd_$@ := $(make-cmd)' >> $(dot-target).cmd) ### # if_changed_dep - execute command if any prerequisite is newer than
tools/build/Makefile.build +7 -0
@@ -21,6 +21,13 @@ endif build-dir := $(srctree)/tools/build +# Define $(fixdep) for dep-cmd function +ifeq ($(OUTPUT),) + fixdep := $(build-dir)/fixdep +else + fixdep := $(OUTPUT)/fixdep +endif + # Generic definitions include $(build-dir)/Build.include
Jiri Olsa
reviewerPATCH 6/7 perf tools: Rename single_dep target to prepare
In reply to Jiri OlsaAnd use the new 'prepare' target for $(PERF_IN) target.
--- tools/perf/Makefile.perf | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
tools/perf/Makefile.perf +10 -10
@@ -299,7 +299,7 @@ PERF_IN := $(OUTPUT)perf-in.o export srctree OUTPUT RM CC LD AR CFLAGS V BISON FLEX AWK include $(srctree)/tools/build/Makefile.include -$(PERF_IN): $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h FORCE +$(PERF_IN): prepare FORCE $(Q)$(MAKE) $(build)=perf $(OUTPUT)perf: $(PERFLIBS) $(PERF_IN) $(LIBTRACEEVENT_DYNAMIC_LIST)
@@ -349,27 +349,27 @@ endif __build-dir = $(subst $(OUTPUT),,$(dir $@)) build-dir = $(if $(__build-dir),$(__build-dir),.) -single_dep: $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h +prepare: $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h -$(OUTPUT)%.o: %.c single_dep FORCE +$(OUTPUT)%.o: %.c prepare FORCE $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@ -$(OUTPUT)%.i: %.c single_dep FORCE +$(OUTPUT)%.i: %.c prepare FORCE $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@ -$(OUTPUT)%.s: %.c single_dep FORCE +$(OUTPUT)%.s: %.c prepare FORCE $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@ -$(OUTPUT)%-bison.o: %.c single_dep FORCE +$(OUTPUT)%-bison.o: %.c prepare FORCE $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@ -$(OUTPUT)%-flex.o: %.c single_dep FORCE +$(OUTPUT)%-flex.o: %.c prepare FORCE $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@ -$(OUTPUT)%.o: %.S single_dep FORCE +$(OUTPUT)%.o: %.S prepare FORCE $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@ -$(OUTPUT)%.i: %.S single_dep FORCE +$(OUTPUT)%.i: %.S prepare FORCE $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@ $(OUTPUT)perf-%: %.o $(PERFLIBS)
@@ -591,6 +591,6 @@ FORCE: .PHONY: all install clean config-clean strip install-gtk .PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell -.PHONY: $(GIT-HEAD-PHONY) TAGS tags cscope FORCE single_dep +.PHONY: $(GIT-HEAD-PHONY) TAGS tags cscope FORCE prepare .PHONY: libtraceevent_plugins
Signature · 1 line
2.4.3
tip-bot for Jiri Olsa
merge bot[tip:perf/core] perf tools: Rename the 'single_dep' target to ' prepare'
perf tools: Rename the 'single_dep' target to 'prepare'
Commit-ID: 324c824ade1cad094a21e6177b9aa7977146feeb Gitweb: http://git.kernel.org/tip/324c824ade1cad094a21e6177b9aa7977146feeb Author: Jiri Olsa <[email protected]> AuthorDate: Wed, 23 Sep 2015 12:34:01 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Mon, 28 Sep 2015 15:50:55 -0300
perf tools: Rename the 'single_dep' target to 'prepare'
And use the new 'prepare' target for the $(PERF_IN) target.
--- tools/perf/Makefile.perf | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
tools/perf/Makefile.perf +10 -10
@@ -299,7 +299,7 @@ PERF_IN := $(OUTPUT)perf-in.o export srctree OUTPUT RM CC LD AR CFLAGS V BISON FLEX AWK include $(srctree)/tools/build/Makefile.include -$(PERF_IN): $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h FORCE +$(PERF_IN): prepare FORCE $(Q)$(MAKE) $(build)=perf $(OUTPUT)perf: $(PERFLIBS) $(PERF_IN) $(LIBTRACEEVENT_DYNAMIC_LIST)
@@ -349,27 +349,27 @@ endif __build-dir = $(subst $(OUTPUT),,$(dir $@)) build-dir = $(if $(__build-dir),$(__build-dir),.) -single_dep: $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h +prepare: $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h -$(OUTPUT)%.o: %.c single_dep FORCE +$(OUTPUT)%.o: %.c prepare FORCE $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@ -$(OUTPUT)%.i: %.c single_dep FORCE +$(OUTPUT)%.i: %.c prepare FORCE $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@ -$(OUTPUT)%.s: %.c single_dep FORCE +$(OUTPUT)%.s: %.c prepare FORCE $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@ -$(OUTPUT)%-bison.o: %.c single_dep FORCE +$(OUTPUT)%-bison.o: %.c prepare FORCE $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@ -$(OUTPUT)%-flex.o: %.c single_dep FORCE +$(OUTPUT)%-flex.o: %.c prepare FORCE $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@ -$(OUTPUT)%.o: %.S single_dep FORCE +$(OUTPUT)%.o: %.S prepare FORCE $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@ -$(OUTPUT)%.i: %.S single_dep FORCE +$(OUTPUT)%.i: %.S prepare FORCE $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@ $(OUTPUT)perf-%: %.o $(PERFLIBS)
@@ -591,6 +591,6 @@ FORCE: .PHONY: all install clean config-clean strip install-gtk .PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell -.PHONY: $(GIT-HEAD-PHONY) TAGS tags cscope FORCE single_dep +.PHONY: $(GIT-HEAD-PHONY) TAGS tags cscope FORCE prepare .PHONY: libtraceevent_plugins
Jiri Olsa
reviewerPATCH 7/7 tools build: Build fixdep helper from perf and basic libs
In reply to Jiri OlsaAdding fixdep target into Makefile.include to ease up building of fixdep helper, that needs to be built before we dive in to the build itself. The user can invoke the fixdep target to build the helper.
--- tools/build/Documentation/Build.txt | 7 +++++++ tools/build/Makefile.include | 5 +++++ tools/build/tests/ex/Makefile | 8 +++++--- tools/lib/api/Makefile | 4 +++- tools/lib/bpf/Makefile | 4 +++- tools/lib/lockdep/Makefile | 4 +++- tools/perf/Makefile.perf | 12 ++++++------ 7 files changed, 32 insertions(+), 12 deletions(-)
tools/build/Documentation/Build.txt +7 -0
@@ -113,6 +113,13 @@ It defines following interface: make $(build)=ex +Fixdep +------ +It's needed build fixdep helper before invoking the build. +The Makefile.include adds fixdep target, that could be +invoked by user. + + Rules -----
tools/build/Makefile.include +5 -0
@@ -1 +1,6 @@ build := -f $(srctree)/tools/build/Makefile.build dir=. obj + +fixdep: + $(Q)$(MAKE) -C $(srctree)/tools/build fixdep + +.PHONY: fixdep
tools/build/tests/ex/Makefile +5 -3
@@ -3,18 +3,20 @@ export CC := gcc export LD := ld export AR := ar +ex: + include $(srctree)/tools/build/Makefile.include ex: ex-in.o libex-in.o gcc -o $@ $^ -ex.%: FORCE +ex.%: fixdep FORCE make -f $(srctree)/tools/build/Makefile.build dir=. $@ -ex-in.o: FORCE +ex-in.o: fixdep FORCE make $(build)=ex -libex-in.o: FORCE +libex-in.o: fixdep FORCE make $(build)=libex clean:
tools/lib/api/Makefile +3 -1
@@ -23,10 +23,12 @@ RM = rm -f API_IN := $(OUTPUT)libapi-in.o +all: + export srctree OUTPUT CC LD CFLAGS V include $(srctree)/tools/build/Makefile.include -all: $(LIBFILE) +all: fixdep $(LIBFILE) $(API_IN): FORCE @$(MAKE) $(build)=libapi
tools/lib/bpf/Makefile +3 -1
@@ -123,6 +123,8 @@ endif # the same command line setup. MAKEOVERRIDES= +all: + export srctree OUTPUT CC LD CFLAGS V include $(srctree)/tools/build/Makefile.include
@@ -133,7 +135,7 @@ CMD_TARGETS = $(LIB_FILE) TARGETS = $(CMD_TARGETS) -all: $(VERSION_FILES) all_cmd +all: fixdep $(VERSION_FILES) all_cmd all_cmd: $(CMD_TARGETS)
tools/lib/lockdep/Makefile +3 -1
@@ -93,6 +93,8 @@ else print_install = echo ' INSTALL '$1' to $(DESTDIR_SQ)$2'; endif +all: + export srctree OUTPUT CC LD CFLAGS V include $(srctree)/tools/build/Makefile.include
@@ -109,7 +111,7 @@ CMD_TARGETS = $(LIB_FILE) TARGETS = $(CMD_TARGETS) -all: all_cmd +all: fixdep all_cmd all_cmd: $(CMD_TARGETS)
tools/perf/Makefile.perf +6 -6
@@ -306,7 +306,7 @@ $(OUTPUT)perf: $(PERFLIBS) $(PERF_IN) $(LIBTRACEEVENT_DYNAMIC_LIST) $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $(LIBTRACEEVENT_DYNAMIC_LIST_LDFLAGS) \ $(PERF_IN) $(LIBS) -o $@ -$(GTK_IN): FORCE +$(GTK_IN): fixdep FORCE $(Q)$(MAKE) $(build)=gtk $(OUTPUT)libperf-gtk.so: $(GTK_IN) $(PERFLIBS)
@@ -349,7 +349,7 @@ endif __build-dir = $(subst $(OUTPUT),,$(dir $@)) build-dir = $(if $(__build-dir),$(__build-dir),.) -prepare: $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h +prepare: $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h fixdep $(OUTPUT)%.o: %.c prepare FORCE $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
@@ -389,7 +389,7 @@ $(patsubst perf-%,%.o,$(PROGRAMS)): $(wildcard */*.h) LIBPERF_IN := $(OUTPUT)libperf-in.o -$(LIBPERF_IN): FORCE +$(LIBPERF_IN): fixdep FORCE $(Q)$(MAKE) $(build)=libperf $(LIB_FILE): $(LIBPERF_IN)
@@ -397,10 +397,10 @@ $(LIB_FILE): $(LIBPERF_IN) LIBTRACEEVENT_FLAGS += plugin_dir=$(plugindir_SQ) -$(LIBTRACEEVENT): FORCE +$(LIBTRACEEVENT): fixdep FORCE $(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) $(OUTPUT)libtraceevent.a -libtraceevent_plugins: FORCE +libtraceevent_plugins: fixdep FORCE $(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) plugins $(LIBTRACEEVENT_DYNAMIC_LIST): libtraceevent_plugins
@@ -413,7 +413,7 @@ $(LIBTRACEEVENT)-clean: install-traceevent-plugins: $(LIBTRACEEVENT) $(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) install_plugins -$(LIBAPI): FORCE +$(LIBAPI): fixdep FORCE $(Q)$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) $(OUTPUT)libapi.a $(LIBAPI)-clean:
Signature · 1 line
2.4.3
tip-bot for Jiri Olsa
merge bot[tip:perf/core] tools build: Build fixdep helper from perf and basic libs
tools build: Build fixdep helper from perf and basic libs
Commit-ID: 7c422f5572667fef0db38d2046ecce69dcf0afc8 Gitweb: http://git.kernel.org/tip/7c422f5572667fef0db38d2046ecce69dcf0afc8 Author: Jiri Olsa <[email protected]> AuthorDate: Wed, 23 Sep 2015 12:34:02 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Mon, 28 Sep 2015 15:50:55 -0300
tools build: Build fixdep helper from perf and basic libs
Adding the fixdep target into the Makefile.include to ease up building of fixdep helper, that needs to be built before we dive in to the build itself. The user can invoke the fixdep target to build the helper.
--- tools/build/Documentation/Build.txt | 7 +++++++ tools/build/Makefile.include | 5 +++++ tools/build/tests/ex/Makefile | 8 +++++--- tools/lib/api/Makefile | 4 +++- tools/lib/bpf/Makefile | 4 +++- tools/lib/lockdep/Makefile | 4 +++- tools/perf/Makefile.perf | 12 ++++++------ 7 files changed, 32 insertions(+), 12 deletions(-)
tools/build/Documentation/Build.txt +7 -0
@@ -113,6 +113,13 @@ It defines following interface: make $(build)=ex +Fixdep +------ +It is necessary to build the fixdep helper before invoking the build. +The Makefile.include file adds the fixdep target, that could be +invoked by the user. + + Rules -----
tools/build/Makefile.include +5 -0
@@ -1 +1,6 @@ build := -f $(srctree)/tools/build/Makefile.build dir=. obj + +fixdep: + $(Q)$(MAKE) -C $(srctree)/tools/build fixdep + +.PHONY: fixdep
tools/build/tests/ex/Makefile +5 -3
@@ -3,18 +3,20 @@ export CC := gcc export LD := ld export AR := ar +ex: + include $(srctree)/tools/build/Makefile.include ex: ex-in.o libex-in.o gcc -o $@ $^ -ex.%: FORCE +ex.%: fixdep FORCE make -f $(srctree)/tools/build/Makefile.build dir=. $@ -ex-in.o: FORCE +ex-in.o: fixdep FORCE make $(build)=ex -libex-in.o: FORCE +libex-in.o: fixdep FORCE make $(build)=libex clean:
tools/lib/api/Makefile +3 -1
@@ -23,10 +23,12 @@ RM = rm -f API_IN := $(OUTPUT)libapi-in.o +all: + export srctree OUTPUT CC LD CFLAGS V include $(srctree)/tools/build/Makefile.include -all: $(LIBFILE) +all: fixdep $(LIBFILE) $(API_IN): FORCE @$(MAKE) $(build)=libapi
tools/lib/bpf/Makefile +3 -1
@@ -123,6 +123,8 @@ endif # the same command line setup. MAKEOVERRIDES= +all: + export srctree OUTPUT CC LD CFLAGS V include $(srctree)/tools/build/Makefile.include
@@ -133,7 +135,7 @@ CMD_TARGETS = $(LIB_FILE) TARGETS = $(CMD_TARGETS) -all: $(VERSION_FILES) all_cmd +all: fixdep $(VERSION_FILES) all_cmd all_cmd: $(CMD_TARGETS)
tools/lib/lockdep/Makefile +3 -1
@@ -93,6 +93,8 @@ else print_install = echo ' INSTALL '$1' to $(DESTDIR_SQ)$2'; endif +all: + export srctree OUTPUT CC LD CFLAGS V include $(srctree)/tools/build/Makefile.include
@@ -109,7 +111,7 @@ CMD_TARGETS = $(LIB_FILE) TARGETS = $(CMD_TARGETS) -all: all_cmd +all: fixdep all_cmd all_cmd: $(CMD_TARGETS)
tools/perf/Makefile.perf +6 -6
@@ -306,7 +306,7 @@ $(OUTPUT)perf: $(PERFLIBS) $(PERF_IN) $(LIBTRACEEVENT_DYNAMIC_LIST) $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $(LIBTRACEEVENT_DYNAMIC_LIST_LDFLAGS) \ $(PERF_IN) $(LIBS) -o $@ -$(GTK_IN): FORCE +$(GTK_IN): fixdep FORCE $(Q)$(MAKE) $(build)=gtk $(OUTPUT)libperf-gtk.so: $(GTK_IN) $(PERFLIBS)
@@ -349,7 +349,7 @@ endif __build-dir = $(subst $(OUTPUT),,$(dir $@)) build-dir = $(if $(__build-dir),$(__build-dir),.) -prepare: $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h +prepare: $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h fixdep $(OUTPUT)%.o: %.c prepare FORCE $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
@@ -389,7 +389,7 @@ $(patsubst perf-%,%.o,$(PROGRAMS)): $(wildcard */*.h) LIBPERF_IN := $(OUTPUT)libperf-in.o -$(LIBPERF_IN): FORCE +$(LIBPERF_IN): fixdep FORCE $(Q)$(MAKE) $(build)=libperf $(LIB_FILE): $(LIBPERF_IN)
@@ -397,10 +397,10 @@ $(LIB_FILE): $(LIBPERF_IN) LIBTRACEEVENT_FLAGS += plugin_dir=$(plugindir_SQ) -$(LIBTRACEEVENT): FORCE +$(LIBTRACEEVENT): fixdep FORCE $(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) $(OUTPUT)libtraceevent.a -libtraceevent_plugins: FORCE +libtraceevent_plugins: fixdep FORCE $(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) plugins $(LIBTRACEEVENT_DYNAMIC_LIST): libtraceevent_plugins
@@ -413,7 +413,7 @@ $(LIBTRACEEVENT)-clean: install-traceevent-plugins: $(LIBTRACEEVENT) $(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) install_plugins -$(LIBAPI): FORCE +$(LIBAPI): fixdep FORCE $(Q)$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) $(OUTPUT)libapi.a $(LIBAPI)-clean: