Skip to content

Commit a29ee6a

Browse files
ouptonnamhyung
authored andcommitted
perf build: Ensure sysreg-defs Makefile respects output dir
Currently the sysreg-defs are written out to the source tree unconditionally, ignoring the specified output directory. Correct the build rule to emit the header to the output directory. Opportunistically reorganize the rules to avoid interleaving with the set of beauty make rules. Reported-by: Ian Rogers <[email protected]> Signed-off-by: Oliver Upton <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Namhyung Kim <[email protected]>
1 parent ef5c958 commit a29ee6a

File tree

4 files changed

+20
-13
lines changed

4 files changed

+20
-13
lines changed

tools/arch/arm64/tools/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ endif
2222
arm64_tools_dir = $(top_srcdir)/arch/arm64/tools
2323
arm64_sysreg_tbl = $(arm64_tools_dir)/sysreg
2424
arm64_gen_sysreg = $(arm64_tools_dir)/gen-sysreg.awk
25-
arm64_generated_dir = $(top_srcdir)/tools/arch/arm64/include/generated
25+
arm64_generated_dir = $(OUTPUT)arch/arm64/include/generated
2626
arm64_sysreg_defs = $(arm64_generated_dir)/asm/sysreg-defs.h
2727

2828
all: $(arm64_sysreg_defs)

tools/perf/Makefile.perf

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,21 @@ export INSTALL SHELL_PATH
434434

435435
SHELL = $(SHELL_PATH)
436436

437+
arm64_gen_sysreg_dir := $(srctree)/tools/arch/arm64/tools
438+
ifneq ($(OUTPUT),)
439+
arm64_gen_sysreg_outdir := $(OUTPUT)
440+
else
441+
arm64_gen_sysreg_outdir := $(CURDIR)
442+
endif
443+
444+
arm64-sysreg-defs: FORCE
445+
$(Q)$(MAKE) -C $(arm64_gen_sysreg_dir) O=$(arm64_gen_sysreg_outdir)
446+
447+
arm64-sysreg-defs-clean:
448+
$(call QUIET_CLEAN,arm64-sysreg-defs)
449+
$(Q)$(MAKE) -C $(arm64_gen_sysreg_dir) O=$(arm64_gen_sysreg_outdir) \
450+
clean > /dev/null
451+
437452
beauty_linux_dir := $(srctree)/tools/perf/trace/beauty/include/linux/
438453
linux_uapi_dir := $(srctree)/tools/include/uapi/linux
439454
asm_generic_uapi_dir := $(srctree)/tools/include/uapi/asm-generic
@@ -450,15 +465,6 @@ drm_ioctl_tbl := $(srctree)/tools/perf/trace/beauty/drm_ioctl.sh
450465
# Create output directory if not already present
451466
_dummy := $(shell [ -d '$(beauty_ioctl_outdir)' ] || mkdir -p '$(beauty_ioctl_outdir)')
452467

453-
arm64_gen_sysreg_dir := $(srctree)/tools/arch/arm64/tools
454-
455-
arm64-sysreg-defs: FORCE
456-
$(Q)$(MAKE) -C $(arm64_gen_sysreg_dir)
457-
458-
arm64-sysreg-defs-clean:
459-
$(call QUIET_CLEAN,arm64-sysreg-defs)
460-
$(Q)$(MAKE) -C $(arm64_gen_sysreg_dir) clean > /dev/null
461-
462468
$(drm_ioctl_array): $(drm_hdr_dir)/drm.h $(drm_hdr_dir)/i915_drm.h $(drm_ioctl_tbl)
463469
$(Q)$(SHELL) '$(drm_ioctl_tbl)' $(drm_hdr_dir) > $@
464470

tools/perf/util/Build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ CFLAGS_rbtree.o += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ET
347347
CFLAGS_libstring.o += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
348348
CFLAGS_hweight.o += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
349349
CFLAGS_header.o += -include $(OUTPUT)PERF-VERSION-FILE
350-
CFLAGS_arm-spe.o += -I$(srctree)/tools/arch/arm64/include/ -I$(srctree)/tools/arch/arm64/include/generated/
350+
CFLAGS_arm-spe.o += -I$(srctree)/tools/arch/arm64/include/ -I$(OUTPUT)arch/arm64/include/generated/
351351

352352
$(OUTPUT)util/argv_split.o: ../lib/argv_split.c FORCE
353353
$(call rule_mkdir)

tools/testing/selftests/kvm/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@ else
1818
endif
1919

2020
ifeq ($(ARCH),arm64)
21-
arm64_tools_dir := $(top_srcdir)/tools/arch/arm64/tools/
21+
tools_dir := $(top_srcdir)/tools
22+
arm64_tools_dir := $(tools_dir)/arch/arm64/tools/
2223
GEN_HDRS := $(top_srcdir)/tools/arch/arm64/include/generated/
2324
CFLAGS += -I$(GEN_HDRS)
2425

2526
$(GEN_HDRS): $(wildcard $(arm64_tools_dir)/*)
26-
$(MAKE) -C $(arm64_tools_dir)
27+
$(MAKE) -C $(arm64_tools_dir) O=$(tools_dir)
2728
endif
2829

2930
LIBKVM += lib/assert.c

0 commit comments

Comments
 (0)