Skip to content

Commit 762323e

Browse files
olsajiriacmel
authored andcommitted
perf build: Move feature cleanup under tools/build
Arnaldo reported issue for following build command: $ rm -rf /tmp/krava; mkdir /tmp/krava; make O=/tmp/krava clean CLEAN config /bin/sh: line 0: cd: /tmp/krava/feature/: No such file or directory ../../scripts/Makefile.include:17: *** output directory "/tmp/krava/feature/" does not exist. Stop. make[1]: *** [Makefile.perf:1010: config-clean] Error 2 make: *** [Makefile:90: clean] Error 2 The problem is that now that we include scripts/Makefile.include in feature's Makefile (which is fine and needed), we need to ensure the OUTPUT directory exists, before executing (out of tree) clean command. Removing the feature's cleanup from perf Makefile and fixing feature's cleanup under build Makefile, so it now checks that there's existing OUTPUT directory before calling the clean. Fixes: 211a741 ("tools: Factor Clang, LLC and LLVM utils definitions") Reported-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Jiri Olsa <jolsa@kernel.org> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Tested-by: Sedat Dilek <sedat.dilek@gmail.com> # LLVM/Clang v13-git Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Ian Rogers <irogers@google.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Michael Petlan <mpetlan@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lore.kernel.org/lkml/20210224150831.409639-1-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent ded2e51 commit 762323e

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

tools/build/Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,18 @@ build := -f $(srctree)/tools/build/Makefile.build dir=. obj
3030

3131
all: $(OUTPUT)fixdep
3232

33+
# Make sure there's anything to clean,
34+
# feature contains check for existing OUTPUT
35+
TMP_O := $(if $(OUTPUT),$(OUTPUT)/feature,./)
36+
3337
clean:
3438
$(call QUIET_CLEAN, fixdep)
3539
$(Q)find $(if $(OUTPUT),$(OUTPUT),.) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
3640
$(Q)rm -f $(OUTPUT)fixdep
3741
$(call QUIET_CLEAN, feature-detect)
38-
$(Q)$(MAKE) -C feature/ clean >/dev/null
42+
ifneq ($(wildcard $(TMP_O)),)
43+
$(Q)$(MAKE) -C feature OUTPUT=$(TMP_O) clean >/dev/null
44+
endif
3945

4046
$(OUTPUT)fixdep-in.o: FORCE
4147
$(Q)$(MAKE) $(build)=fixdep

tools/perf/Makefile.perf

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,14 +1001,6 @@ $(INSTALL_DOC_TARGETS):
10011001

10021002
### Cleaning rules
10031003

1004-
#
1005-
# This is here, not in Makefile.config, because Makefile.config does
1006-
# not get included for the clean target:
1007-
#
1008-
config-clean:
1009-
$(call QUIET_CLEAN, config)
1010-
$(Q)$(MAKE) -C $(srctree)/tools/build/feature/ $(if $(OUTPUT),OUTPUT=$(OUTPUT)feature/,) clean >/dev/null
1011-
10121004
python-clean:
10131005
$(python-clean)
10141006

@@ -1048,7 +1040,7 @@ endif # BUILD_BPF_SKEL
10481040
bpf-skel-clean:
10491041
$(call QUIET_CLEAN, bpf-skel) $(RM) -r $(SKEL_TMP_OUT) $(SKELETONS)
10501042

1051-
clean:: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clean $(LIBPERF)-clean config-clean fixdep-clean python-clean bpf-skel-clean
1043+
clean:: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clean $(LIBPERF)-clean fixdep-clean python-clean bpf-skel-clean
10521044
$(call QUIET_CLEAN, core-objs) $(RM) $(LIBPERF_A) $(OUTPUT)perf-archive $(OUTPUT)perf-with-kcore $(LANG_BINDINGS)
10531045
$(Q)find $(if $(OUTPUT),$(OUTPUT),.) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
10541046
$(Q)$(RM) $(OUTPUT).config-detected

0 commit comments

Comments
 (0)