mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 20:51:44 +00:00
762323eb39
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: 211a741cd3
("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>
55 lines
1.3 KiB
Makefile
55 lines
1.3 KiB
Makefile
# SPDX-License-Identifier: GPL-2.0
|
|
ifeq ($(srctree),)
|
|
srctree := $(patsubst %/,%,$(dir $(CURDIR)))
|
|
srctree := $(patsubst %/,%,$(dir $(srctree)))
|
|
endif
|
|
|
|
include $(srctree)/tools//scripts/Makefile.include
|
|
|
|
define allow-override
|
|
$(if $(or $(findstring environment,$(origin $(1))),\
|
|
$(findstring command line,$(origin $(1)))),,\
|
|
$(eval $(1) = $(2)))
|
|
endef
|
|
|
|
$(call allow-override,CC,$(CROSS_COMPILE)gcc)
|
|
$(call allow-override,LD,$(CROSS_COMPILE)ld)
|
|
|
|
export HOSTCC HOSTLD HOSTAR
|
|
|
|
ifeq ($(V),1)
|
|
Q =
|
|
else
|
|
Q = @
|
|
endif
|
|
|
|
export Q srctree CC LD
|
|
|
|
MAKEFLAGS := --no-print-directory
|
|
build := -f $(srctree)/tools/build/Makefile.build dir=. obj
|
|
|
|
all: $(OUTPUT)fixdep
|
|
|
|
# Make sure there's anything to clean,
|
|
# feature contains check for existing OUTPUT
|
|
TMP_O := $(if $(OUTPUT),$(OUTPUT)/feature,./)
|
|
|
|
clean:
|
|
$(call QUIET_CLEAN, fixdep)
|
|
$(Q)find $(if $(OUTPUT),$(OUTPUT),.) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
|
|
$(Q)rm -f $(OUTPUT)fixdep
|
|
$(call QUIET_CLEAN, feature-detect)
|
|
ifneq ($(wildcard $(TMP_O)),)
|
|
$(Q)$(MAKE) -C feature OUTPUT=$(TMP_O) clean >/dev/null
|
|
endif
|
|
|
|
$(OUTPUT)fixdep-in.o: FORCE
|
|
$(Q)$(MAKE) $(build)=fixdep
|
|
|
|
$(OUTPUT)fixdep: $(OUTPUT)fixdep-in.o
|
|
$(QUIET_LINK)$(HOSTCC) $(KBUILD_HOSTLDFLAGS) -o $@ $<
|
|
|
|
FORCE:
|
|
|
|
.PHONY: FORCE
|