Improvements to incremental builds
Subsystems (2)
Ian Rogers
reviewercover Improvements to incremental builds
Switching to using install_headers caused incremental builds to always rebuild most targets. This was caused by the headers always being reinstalled and then getting new timestamps causing dependencies to be rebuilt. Follow the convention in libbpf where the install targets are separated and trigger when the target isn't present or is out-of-date.
Further, fix an issue in the perf build with libpython where python/perf.so was also regenerated as the target name was incorrect.
Ian Rogers (5):
tools lib api: Add dependency test to install_headers tools lib perf: Add dependency test to install_headers tools lib subcmd: Add dependency test to install_headers tools lib symbol: Add dependency test to install_headers perf build: Fix python/perf.so library's name
tools/lib/api/Makefile | 38 ++++++++++++++++++++++----------- tools/lib/perf/Makefile | 43 +++++++++++++++++++------------------- tools/lib/subcmd/Makefile | 23 +++++++++++--------- tools/lib/symbol/Makefile | 21 ++++++++++++------- tools/perf/Makefile.config | 4 +++- tools/perf/Makefile.perf | 2 +- 6 files changed, 79 insertions(+), 52 deletions(-)
Signature · 1 line
2.39.0.rc0.267.gcb52ba06e7-goog
Ian Rogers
reviewerPATCH 1/5 tools lib api: Add dependency test to install_headers
Compute the headers to be installed from their source headers and make each have its own build target to install it. Using dependencies avoids headers being reinstalled and getting a new timestamp which then causes files that depend on the header to be rebuilt.
--- tools/lib/api/Makefile | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-)
tools/lib/api/Makefile +26 -12
@@ -88,10 +88,10 @@ define do_install_mkdir endef define do_install - if [ ! -d '$(DESTDIR_SQ)$2' ]; then \ - $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$2'; \ - fi; \ - $(INSTALL) $1 $(if $3,-m $3,) '$(DESTDIR_SQ)$2' + if [ ! -d '$2' ]; then \ + $(INSTALL) -d -m 755 '$2'; \ + fi; \ + $(INSTALL) $1 $(if $3,-m $3,) '$2' endef install_lib: $(LIBFILE)
@@ -99,14 +99,28 @@ install_lib: $(LIBFILE) $(call do_install_mkdir,$(libdir_SQ)); \ cp -fpR $(LIBFILE) $(DESTDIR)$(libdir_SQ) -install_headers: - $(call QUIET_INSTALL, libapi_headers) \ - $(call do_install,cpu.h,$(prefix)/include/api,644); \ - $(call do_install,debug.h,$(prefix)/include/api,644); \ - $(call do_install,io.h,$(prefix)/include/api,644); \ - $(call do_install,fd/array.h,$(prefix)/include/api/fd,644); \ - $(call do_install,fs/fs.h,$(prefix)/include/api/fs,644); \ - $(call do_install,fs/tracing_path.h,$(prefix)/include/api/fs,644); +HDRS := cpu.h debug.h io.h +FD_HDRS := fd/array.h +FS_HDRS := fs/fs.h fs/tracing_path.h +INSTALL_HDRS_PFX := $(DESTDIR)$(prefix)/include/api +INSTALL_HDRS := $(addprefix $(INSTALL_HDRS_PFX)/, $(HDRS)) +INSTALL_FD_HDRS := $(addprefix $(INSTALL_HDRS_PFX)/, $(FD_HDRS)) +INSTALL_FS_HDRS := $(addprefix $(INSTALL_HDRS_PFX)/, $(FS_HDRS)) + +$(INSTALL_HDRS): $(INSTALL_HDRS_PFX)/%.h: %.h + $(call QUIET_INSTALL, $@) \ + $(call do_install,$<,$(INSTALL_HDRS_PFX)/,644) + +$(INSTALL_FD_HDRS): $(INSTALL_HDRS_PFX)/fd/%.h: fd/%.h + $(call QUIET_INSTALL, $@) \ + $(call do_install,$<,$(INSTALL_HDRS_PFX)/fd/,644) + +$(INSTALL_FS_HDRS): $(INSTALL_HDRS_PFX)/fs/%.h: fs/%.h + $(call QUIET_INSTALL, $@) \ + $(call do_install,$<,$(INSTALL_HDRS_PFX)/fs/,644) + +install_headers: $(INSTALL_HDRS) $(INSTALL_FD_HDRS) $(INSTALL_FS_HDRS) + $(call QUIET_INSTALL, libapi_headers) install: install_lib install_headers
Signature · 1 line
2.39.0.rc0.267.gcb52ba06e7-goog
Ian Rogers
reviewerPATCH 2/5 tools lib perf: Add dependency test to install_headers
In reply to Ian RogersCompute the headers to be installed from their source headers and make each have its own build target to install it. Using dependencies avoids headers being reinstalled and getting a new timestamp which then causes files that depend on the header to be rebuilt.
--- tools/lib/perf/Makefile | 43 +++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 21 deletions(-)
tools/lib/perf/Makefile +22 -21
@@ -176,10 +176,10 @@ define do_install_mkdir endef define do_install - if [ ! -d '$(DESTDIR_SQ)$2' ]; then \ - $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$2'; \ - fi; \ - $(INSTALL) $1 $(if $3,-m $3,) '$(DESTDIR_SQ)$2' + if [ ! -d '$2' ]; then \ + $(INSTALL) -d -m 755 '$2'; \ + fi; \ + $(INSTALL) $1 $(if $3,-m $3,) '$2' endef install_lib: libs
@@ -187,23 +187,24 @@ install_lib: libs $(call do_install_mkdir,$(libdir_SQ)); \ cp -fpR $(LIBPERF_ALL) $(DESTDIR)$(libdir_SQ) -install_headers: - $(call QUIET_INSTALL, libperf_headers) \ - $(call do_install,include/perf/bpf_perf.h,$(prefix)/include/perf,644); \ - $(call do_install,include/perf/core.h,$(prefix)/include/perf,644); \ - $(call do_install,include/perf/cpumap.h,$(prefix)/include/perf,644); \ - $(call do_install,include/perf/threadmap.h,$(prefix)/include/perf,644); \ - $(call do_install,include/perf/evlist.h,$(prefix)/include/perf,644); \ - $(call do_install,include/perf/evsel.h,$(prefix)/include/perf,644); \ - $(call do_install,include/perf/event.h,$(prefix)/include/perf,644); \ - $(call do_install,include/perf/mmap.h,$(prefix)/include/perf,644); \ - $(call do_install,include/internal/cpumap.h,$(prefix)/include/internal,644); \ - $(call do_install,include/internal/evlist.h,$(prefix)/include/internal,644); \ - $(call do_install,include/internal/evsel.h,$(prefix)/include/internal,644); \ - $(call do_install,include/internal/lib.h,$(prefix)/include/internal,644); \ - $(call do_install,include/internal/mmap.h,$(prefix)/include/internal,644); \ - $(call do_install,include/internal/threadmap.h,$(prefix)/include/internal,644); \ - $(call do_install,include/internal/xyarray.h,$(prefix)/include/internal,644); +HDRS := bpf_perf.h core.h cpumap.h threadmap.h evlist.h evsel.h event.h mmap.h +INTERNAL_HDRS := cpumap.h evlist.h evsel.h lib.h mmap.h threadmap.h xyarray.h + +INSTALL_HDRS_PFX := $(DESTDIR)$(prefix)/include/perf +INSTALL_HDRS := $(addprefix $(INSTALL_HDRS_PFX)/, $(HDRS)) +INSTALL_INTERNAL_HDRS_PFX := $(DESTDIR)$(prefix)/include/internal +INSTALL_INTERNAL_HDRS := $(addprefix $(INSTALL_INTERNAL_HDRS_PFX)/, $(INTERNAL_HDRS)) + +$(INSTALL_HDRS): $(INSTALL_HDRS_PFX)/%.h: include/perf/%.h + $(call QUIET_INSTALL, $@) \ + $(call do_install,$<,$(INSTALL_HDRS_PFX)/,644) + +$(INSTALL_INTERNAL_HDRS): $(INSTALL_INTERNAL_HDRS_PFX)/%.h: include/internal/%.h + $(call QUIET_INSTALL, $@) \ + $(call do_install,$<,$(INSTALL_INTERNAL_HDRS_PFX)/,644) + +install_headers: $(INSTALL_HDRS) $(INSTALL_INTERNAL_HDRS) + $(call QUIET_INSTALL, libperf_headers) install_pkgconfig: $(LIBPERF_PC) $(call QUIET_INSTALL, $(LIBPERF_PC)) \
Signature · 1 line
2.39.0.rc0.267.gcb52ba06e7-goog
Re: [PATCH 2/5] tools lib perf: Add dependency test to install_headers
On Thu, Dec 01, 2022 at 08:57:40PM -0800, Ian Rogers wrote:
Hi Ian,
Quoted 4 lines
Compute the headers to be installed from their source headers and make each have its own build target to install it. Using dependencies avoids headers being reinstalled and getting a new timestamp which then causes files that depend on the header to be rebuilt.
[...]
This fix causes the below error in linux-next:
install: cannot create regular file '/usr/lib64/pkgconfig/libperf.pc': Permission denied
make: *** [Makefile:210: install_pkgconfig] Error 1
I am posting a follow-up fix. To me the end result does not look nice, as do_install and do_install_mkdir are inconsistent, but the above error goes away.
Thanks!
PATCH 1/1 tools lib perf: fix install_pkgconfig target
Commit 47e02b94a4c9 ("tools lib perf: Add dependency test to install_headers") misses the notion of $(DESTDIR_SQ) for install_pkgconfig target, which leads to error:
install: cannot create regular file '/usr/lib64/pkgconfig/libperf.pc': Permission denied
make: *** [Makefile:210: install_pkgconfig] Error 1
--- tools/lib/perf/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/lib/perf/Makefile +1 -1
@@ -208,7 +208,7 @@ install_headers: $(INSTALL_HDRS) $(INSTALL_INTERNAL_HDRS) install_pkgconfig: $(LIBPERF_PC) $(call QUIET_INSTALL, $(LIBPERF_PC)) \ - $(call do_install,$(LIBPERF_PC),$(libdir_SQ)/pkgconfig,644) + $(call do_install,$(LIBPERF_PC),$(DESTDIR_SQ)$(libdir_SQ)/pkgconfig,644) install_doc: $(Q)$(MAKE) -C Documentation install-man install-html install-examples
Signature · 1 line
2.34.1
Re: [PATCH] tools lib perf: fix install_pkgconfig target
Em Fri, Dec 16, 2022 at 10:50:41AM +0100, Alexander Gordeev escreveu:
Quoted 6 lines
Commit
47e02b94a4c9("tools lib perf: Add dependency test toinstall_headers") misses the notion of $(DESTDIR_SQ) forinstall_pkgconfigtarget, which leads to error:install: cannot create regular file '
/usr/lib64/pkgconfig/libperf.pc': Permission denied
make: *** [Makefile:210:install_pkgconfig] Error 1
Thanks, applied.
- Arnaldo
Quoted 20 lines
Signed-off-by Alexander Gordeev <[email protected]>--- tools/lib/perf/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/lib/perf/Makefile +1
-1@@ -208,7 +208,7 @@ install_headers: $(INSTALL_HDRS) $(INSTALL_INTERNAL_HDRS) install_pkgconfig: $(LIBPERF_PC) $(call QUIET_INSTALL, $(LIBPERF_PC)) \ - $(call do_install,$(LIBPERF_PC),$(libdir_SQ)/pkgconfig,644) + $(call do_install,$(LIBPERF_PC),$(DESTDIR_SQ)$(libdir_SQ)/pkgconfig,644) install_doc: $(Q)$(MAKE) -C Documentation install-man install-html install-examplesSignature · 1 line
2.34.1
Signature · 1 line
- Arnaldo
Ian Rogers
reviewerPATCH 3/5 tools lib subcmd: Add dependency test to install_headers
In reply to Ian RogersCompute the headers to be installed from their source headers and make each have its own build target to install it. Using dependencies avoids headers being reinstalled and getting a new timestamp which then causes files that depend on the header to be rebuilt.
--- tools/lib/subcmd/Makefile | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-)
tools/lib/subcmd/Makefile +13 -10
@@ -89,10 +89,10 @@ define do_install_mkdir endef define do_install - if [ ! -d '$(DESTDIR_SQ)$2' ]; then \ - $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$2'; \ + if [ ! -d '$2' ]; then \ + $(INSTALL) -d -m 755 '$2'; \ fi; \ - $(INSTALL) $1 $(if $3,-m $3,) '$(DESTDIR_SQ)$2' + $(INSTALL) $1 $(if $3,-m $3,) '$2' endef install_lib: $(LIBFILE)
@@ -100,13 +100,16 @@ install_lib: $(LIBFILE) $(call do_install_mkdir,$(libdir_SQ)); \ cp -fpR $(LIBFILE) $(DESTDIR)$(libdir_SQ) -install_headers: - $(call QUIET_INSTALL, libsubcmd_headers) \ - $(call do_install,exec-cmd.h,$(prefix)/include/subcmd,644); \ - $(call do_install,help.h,$(prefix)/include/subcmd,644); \ - $(call do_install,pager.h,$(prefix)/include/subcmd,644); \ - $(call do_install,parse-options.h,$(prefix)/include/subcmd,644); \ - $(call do_install,run-command.h,$(prefix)/include/subcmd,644); +HDRS := exec-cmd.h help.h pager.h parse-options.h run-command.h +INSTALL_HDRS_PFX := $(DESTDIR)$(prefix)/include/subcmd +INSTALL_HDRS := $(addprefix $(INSTALL_HDRS_PFX)/, $(HDRS)) + +$(INSTALL_HDRS): $(INSTALL_HDRS_PFX)/%.h: %.h + $(call QUIET_INSTALL, $@) \ + $(call do_install,$<,$(INSTALL_HDRS_PFX)/,644) + +install_headers: $(INSTALL_HDRS) + $(call QUIET_INSTALL, libsubcmd_headers) install: install_lib install_headers
Signature · 1 line
2.39.0.rc0.267.gcb52ba06e7-goog
Re: [PATCH 3/5] tools lib subcmd: Add dependency test to install_headers
Quoted 15 lines · On Thu, Dec 01, 2022 at 08:57:41PM -0800 Ian Rogers wrote:
Compute the headers to be installed from their source headers and make each have its own build target to install it. Using dependencies avoids headers being reinstalled and getting a new timestamp which then causes files that depend on the header to be rebuilt.
Signed-off-by Ian Rogers <[email protected]>--- tools/lib/subcmd/Makefile | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-)tools/lib/subcmd/Makefile +0
-0
tools/lib/subcmd/Makefile define do_install_mkdir · line 95
Quoted 10 lines
tools/lib/subcmd/Makefile +3
-3@@ -89,10 +89,10 @@ define do_install_mkdir endef define do_install - if [ ! -d '$(DESTDIR_SQ)$2' ]; then \ - $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$2'; \ + if [ ! -d '$2' ]; then \ + $(INSTALL) -d -m 755 '$2'; \ fi; \ - $(INSTALL) $1 $(if $3,-m $3,) '$(DESTDIR_SQ)$2' + $(INSTALL) $1 $(if $3,-m $3,) '$2'
What about using '$(INSTALL) -D ...' instead of the if-mkdir-block above? (E.g. as in tools/debugging/Makefile.)
Kind regards,
Nicolas
Quoted 29 lines
tools/lib/subcmd/Makefile +10
-7endef install_lib: $(LIBFILE)@@ -100,13 +100,16 @@ install_lib: $(LIBFILE) $(call do_install_mkdir,$(libdir_SQ)); \ cp -fpR $(LIBFILE) $(DESTDIR)$(libdir_SQ) -install_headers: - $(call QUIET_INSTALL, libsubcmd_headers) \ - $(call do_install,exec-cmd.h,$(prefix)/include/subcmd,644); \ - $(call do_install,help.h,$(prefix)/include/subcmd,644); \ - $(call do_install,pager.h,$(prefix)/include/subcmd,644); \ - $(call do_install,parse-options.h,$(prefix)/include/subcmd,644); \ - $(call do_install,run-command.h,$(prefix)/include/subcmd,644); +HDRS := exec-cmd.h help.h pager.h parse-options.h run-command.h +INSTALL_HDRS_PFX := $(DESTDIR)$(prefix)/include/subcmd +INSTALL_HDRS := $(addprefix $(INSTALL_HDRS_PFX)/, $(HDRS)) + +$(INSTALL_HDRS): $(INSTALL_HDRS_PFX)/%.h: %.h + $(call QUIET_INSTALL, $@) \ + $(call do_install,$<,$(INSTALL_HDRS_PFX)/,644) + +install_headers: $(INSTALL_HDRS) + $(call QUIET_INSTALL, libsubcmd_headers) install: install_lib install_headersSignature · 1 line
2.39.0.rc0.267.gcb52ba06e7-goog
Signature · 3 lines
epost|xmpp: [email protected] irc://oftc.net/nsc ↳ gpg: 18ed 52db e34f 860e e9fb c82b 7d97 0932 55a0 ce7f -- frykten for herren er opphav til kunnskap --
Ian Rogers
reviewerRe: [PATCH 3/5] tools lib subcmd: Add dependency test to install_headers
Quoted 31 lines · Nicolas Schier
Quoted 15 lines · On Thu, Dec 01, 2022 at 08:57:41PM -0800 Ian Rogers wrote:
Compute the headers to be installed from their source headers and make each have its own build target to install it. Using dependencies avoids headers being reinstalled and getting a new timestamp which then causes files that depend on the header to be rebuilt.
Signed-off-by Ian Rogers <[email protected]>--- tools/lib/subcmd/Makefile | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-)tools/lib/subcmd/Makefile +0
-0tools/lib/subcmd/Makefile define do_install_mkdir · line 95
Quoted 10 lines
tools/lib/subcmd/Makefile +3
-3@@ -89,10 +89,10 @@ define do_install_mkdir endef define do_install - if [ ! -d '$(DESTDIR_SQ)$2' ]; then \ - $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$2'; \ + if [ ! -d '$2' ]; then \ + $(INSTALL) -d -m 755 '$2'; \ fi; \ - $(INSTALL) $1 $(if $3,-m $3,) '$(DESTDIR_SQ)$2' + $(INSTALL) $1 $(if $3,-m $3,) '$2'What about using '$(INSTALL) -D ...' instead of the if-mkdir-block above? (E.g. as in
tools/debugging/Makefile.)
Quoted 2 lines
Kind regards,
Nicolas
Thanks Nicolas, the reason was to keep the code consistent. That's not to say this is the best approach. For example, here is the same thing for tools/lib/api:
https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/tree/tools/lib/api/Makefile?h=perf/core&id=f43368371888694a2eceaaad8f5e9775c092009a#n84
If you'd like to improve this in all the versions and send patches I'd be happy to take a look.
Thanks,
Ian
Quoted 34 lines
Quoted 28 lines
tools/lib/subcmd/Makefile +10
-8endef install_lib: $(LIBFILE)@@ -100,13 +100,16 @@ install_lib: $(LIBFILE) $(call do_install_mkdir,$(libdir_SQ)); \ cp -fpR $(LIBFILE) $(DESTDIR)$(libdir_SQ) -install_headers: - $(call QUIET_INSTALL, libsubcmd_headers) \ - $(call do_install,exec-cmd.h,$(prefix)/include/subcmd,644); \ - $(call do_install,help.h,$(prefix)/include/subcmd,644); \ - $(call do_install,pager.h,$(prefix)/include/subcmd,644); \ - $(call do_install,parse-options.h,$(prefix)/include/subcmd,644); \ - $(call do_install,run-command.h,$(prefix)/include/subcmd,644); +HDRS := exec-cmd.h help.h pager.h parse-options.h run-command.h +INSTALL_HDRS_PFX := $(DESTDIR)$(prefix)/include/subcmd +INSTALL_HDRS := $(addprefix $(INSTALL_HDRS_PFX)/, $(HDRS)) + +$(INSTALL_HDRS): $(INSTALL_HDRS_PFX)/%.h: %.h + $(call QUIET_INSTALL, $@) \ + $(call do_install,$<,$(INSTALL_HDRS_PFX)/,644) + +install_headers: $(INSTALL_HDRS) + $(call QUIET_INSTALL, libsubcmd_headers) install: install_lib install_headers --Quoted 1 line
2.39.0.rc0.267.gcb52ba06e7-goog
--
epost|xmpp: [email protected] irc://oftc.net/nsc
↳ gpg: 18ed 52db e34f 860e e9fb c82b 7d97 0932 55a0 ce7f
-- frykten for herren er opphav til kunnskap --
Re: [PATCH 3/5] tools lib subcmd: Add dependency test to install_headers
Quoted 40 lines · Ian Rogers
Quoted 31 lines · Nicolas Schier
Quoted 15 lines · On Thu, Dec 01, 2022 at 08:57:41PM -0800 Ian Rogers wrote:
Compute the headers to be installed from their source headers and make each have its own build target to install it. Using dependencies avoids headers being reinstalled and getting a new timestamp which then causes files that depend on the header to be rebuilt.
Signed-off-by Ian Rogers <[email protected]>--- tools/lib/subcmd/Makefile | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-)tools/lib/subcmd/Makefile +0
-0tools/lib/subcmd/Makefile define do_install_mkdir · line 95
Quoted 10 lines
tools/lib/subcmd/Makefile +3
-3@@ -89,10 +89,10 @@ define do_install_mkdir endef define do_install - if [ ! -d '$(DESTDIR_SQ)$2' ]; then \ - $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$2'; \ + if [ ! -d '$2' ]; then \ + $(INSTALL) -d -m 755 '$2'; \ fi; \ - $(INSTALL) $1 $(if $3,-m $3,) '$(DESTDIR_SQ)$2' + $(INSTALL) $1 $(if $3,-m $3,) '$2'What about using '$(INSTALL) -D ...' instead of the if-mkdir-block above? (E.g. as in
tools/debugging/Makefile.)Quoted 2 lines
Kind regards,
NicolasThanks Nicolas, the reason was to keep the code consistent. That's not to say this is the best approach. For example, here is the same thing for
tools/lib/api:
https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/tree/tools/lib/api/Makefile?h=perf/core&id=f43368371888694a2eceaaad8f5e9775c092009a#n84
Quoted 5 lines
If you'd like to improve this in all the versions and send patches I'd be happy to take a look.
Thanks,
Ian
Ian, while watching at tools/lib/*/Makefile I stumple across the special single-quote handling (e.g. 'DESTDIR_SQ') several times.
Top-level Makefile and kbuild are not designed to work with file or directory names containing spaces. Do you know whether this is needed for the installation rules in tools/lib/? I'd like to remove support for path names with spaces for a increasing simplicity and consistency.
Kind regards,
Nicolas
Ian Rogers
reviewerPATCH 4/5 tools lib symbol: Add dependency test to install_headers
In reply to Ian RogersCompute the headers to be installed from their source headers and make each have its own build target to install it. Using dependencies avoids headers being reinstalled and getting a new timestamp which then causes files that depend on the header to be rebuilt.
--- tools/lib/symbol/Makefile | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
tools/lib/symbol/Makefile +14 -7
@@ -89,10 +89,10 @@ define do_install_mkdir endef define do_install - if [ ! -d '$(DESTDIR_SQ)$2' ]; then \ - $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$2'; \ - fi; \ - $(INSTALL) $1 $(if $3,-m $3,) '$(DESTDIR_SQ)$2' + if [ ! -d '$2' ]; then \ + $(INSTALL) -d -m 755 '$2'; \ + fi; \ + $(INSTALL) $1 $(if $3,-m $3,) '$2' endef install_lib: $(LIBFILE)
@@ -100,9 +100,16 @@ install_lib: $(LIBFILE) $(call do_install_mkdir,$(libdir_SQ)); \ cp -fpR $(LIBFILE) $(DESTDIR)$(libdir_SQ) -install_headers: - $(call QUIET_INSTALL, libsymbol_headers) \ - $(call do_install,kallsyms.h,$(prefix)/include/symbol,644); +HDRS := kallsyms.h +INSTALL_HDRS_PFX := $(DESTDIR)$(prefix)/include/symbol +INSTALL_HDRS := $(addprefix $(INSTALL_HDRS_PFX)/, $(HDRS)) + +$(INSTALL_HDRS): $(INSTALL_HDRS_PFX)/%.h: %.h + $(call QUIET_INSTALL, $@) \ + $(call do_install,$<,$(INSTALL_HDRS_PFX)/,644) + +install_headers: $(INSTALL_HDRS) + $(call QUIET_INSTALL, libsymbol_headers) install: install_lib install_headers
Signature · 1 line
2.39.0.rc0.267.gcb52ba06e7-goog
Ian Rogers
reviewerPATCH 5/5 perf build: Fix python/perf.so library's name
In reply to Ian RogersSince Python 3.3 extensions have a suffix encoding platform and version information. For example, the perf extension was previously perf.so but now maybe perf.cpython-310-x86_64-linux-gnu.so. Compute the extension using Python and then use this in the target name. Doing this avoids the "perf.so" target always being rebuilt.
--- tools/perf/Makefile.config | 4 +++- tools/perf/Makefile.perf | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-)
tools/perf/Makefile.config +3 -1
@@ -871,6 +871,7 @@ define disable-python_code NO_LIBPYTHON := 1 endef +PYTHON_EXTENSION_SUFFIX := '.so' ifdef NO_LIBPYTHON $(call disable-python,Python support disabled by user) else
@@ -889,7 +890,8 @@ else else LDFLAGS += $(PYTHON_EMBED_LDFLAGS) EXTLIBS += $(PYTHON_EMBED_LIBADD) - LANG_BINDINGS += $(obj-perf)python/perf.so + PYTHON_EXTENSION_SUFFIX := $(shell $(PYTHON) -c 'from importlib import machinery; print(machinery.EXTENSION_SUFFIXES[0])') + LANG_BINDINGS += $(obj-perf)python/perf$(PYTHON_EXTENSION_SUFFIX) CFLAGS += -DHAVE_LIBPYTHON_SUPPORT $(call detected,CONFIG_LIBPYTHON) endif
tools/perf/Makefile.perf +1 -1
@@ -642,7 +642,7 @@ all: shell_compatibility_test $(ALL_PROGRAMS) $(LANG_BINDINGS) $(OTHER_PROGRAMS) # Create python binding output directory if not already present _dummy := $(shell [ -d '$(OUTPUT)python' ] || mkdir -p '$(OUTPUT)python') -$(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS) $(LIBPERF) +$(OUTPUT)python/perf$(PYTHON_EXTENSION_SUFFIX): $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS) $(LIBPERF) $(QUIET_GEN)LDSHARED="$(CC) -pthread -shared" \ CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS)' \ $(PYTHON_WORD) util/setup.py \
Signature · 1 line
2.39.0.rc0.267.gcb52ba06e7-goog
Arnaldo Carvalho de Melo
maintainerEm Thu, Dec 01, 2022 at 08:57:38PM -0800, Ian Rogers escreveu:
Quoted 9 lines
Switching to using
install_headerscaused incremental builds to always rebuild most targets. This was caused by the headers always being reinstalled and then getting new timestamps causing dependencies to be rebuilt. Follow the convention in libbpf where the install targets are separated and trigger when the target isn't present or is out-of-date.Further, fix an issue in the perf build with libpython where python/perf.so was also regenerated as the target name was incorrect.
Quoted 6 lines
Ian Rogers (5):
tools lib api: Add dependency test toinstall_headerstools lib perf: Add dependency test toinstall_headerstools lib subcmd: Add dependency test toinstall_headerstools lib symbol: Add dependency test toinstall_headersperf build: Fix python/perf.so library's name
The last one isn't applying:
Applying: perf build: Fix python/perf.so library's name
error: patch failed: tools/perf/Makefile.perf:642
error: tools/perf/Makefile.perf: patch does not apply
Patch failed at 0005 perf build: Fix python/perf.so library's name
hint: Use 'git am --show-current-patch=diff' to see the failed patch When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort". ⬢[acme@toolbox perf]$
I'll have the first 4 applied to make progress, later I'll check what went wrong and to fix it.
- Arnaldo
Quoted 16 lines · On Thu, Dec 01, 2022 at 08:57:38PM -0800 Ian Rogers wrote:
Switching to using
install_headerscaused incremental builds to always rebuild most targets. This was caused by the headers always being reinstalled and then getting new timestamps causing dependencies to be rebuilt. Follow the convention in libbpf where the install targets are separated and trigger when the target isn't present or is out-of-date.Further, fix an issue in the perf build with libpython where python/perf.so was also regenerated as the target name was incorrect.
Ian Rogers (5):
tools lib api: Add dependency test toinstall_headerstools lib perf: Add dependency test toinstall_headerstools lib subcmd: Add dependency test toinstall_headerstools lib symbol: Add dependency test toinstall_headersperf build: Fix python/perf.so library's name
Quoted 10 lines
tools/lib/api/Makefile | 38 ++++++++++++++++++++++----------- tools/lib/perf/Makefile | 43 +++++++++++++++++++------------------- tools/lib/subcmd/Makefile | 23 +++++++++++--------- tools/lib/symbol/Makefile | 21 ++++++++++++------- tools/perf/Makefile.config | 4 +++- tools/perf/Makefile.perf | 2 +- 6 files changed, 79 insertions(+), 52 deletions(-)Signature · 1 line
2.39.0.rc0.267.gcb52ba06e7-goog
Hi Ian,
which tree is your patch set based on? At least it doesn't apply on the current kbuild trees.
Kind regards,
Nicolas
Signature · 3 lines
epost|xmpp: [email protected] irc://oftc.net/nsc ↳ gpg: 18ed 52db e34f 860e e9fb c82b 7d97 0932 55a0 ce7f -- frykten for herren er opphav til kunnskap --
Ian Rogers
reviewerQuoted 29 lines · Nicolas Schier
Quoted 24 lines · On Thu, Dec 01, 2022 at 08:57:38PM -0800 Ian Rogers wrote:
Switching to using
install_headerscaused incremental builds to always rebuild most targets. This was caused by the headers always being reinstalled and then getting new timestamps causing dependencies to be rebuilt. Follow the convention in libbpf where the install targets are separated and trigger when the target isn't present or is out-of-date.Further, fix an issue in the perf build with libpython where python/perf.so was also regenerated as the target name was incorrect.
Ian Rogers (5):
tools lib api: Add dependency test toinstall_headerstools lib perf: Add dependency test toinstall_headerstools lib subcmd: Add dependency test toinstall_headerstools lib symbol: Add dependency test toinstall_headersperf build: Fix python/perf.so library's nametools/lib/api/Makefile | 38 ++++++++++++++++++++++----------- tools/lib/perf/Makefile | 43 +++++++++++++++++++------------------- tools/lib/subcmd/Makefile | 23 +++++++++++--------- tools/lib/symbol/Makefile | 21 ++++++++++++------- tools/perf/Makefile.config | 4 +++- tools/perf/Makefile.perf | 2 +- 6 files changed, 79 insertions(+), 52 deletions(-)Quoted 2 lines
--
2.39.0.rc0.267.gcb52ba06e7-goog
Quoted 7 lines
Hi Ian,
which tree is your patch set based on? At least it doesn't apply on the current kbuild trees.
Kind regards,
Nicolas
Hi Nicolas,
for the perf tool the branch to follow is Arnaldo's perf/core one:
https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/?h=perf%2Fcore
I may have done this work on Arnaldo's tmp.perf/core branch, which is used for work-in-progress merges.
Thanks,
Ian
Quoted 4 lines
--
epost|xmpp: [email protected] irc://oftc.net/nsc
↳ gpg: 18ed 52db e34f 860e e9fb c82b 7d97 0932 55a0 ce7f
-- frykten for herren er opphav til kunnskap --