From: Jan Kiszka <[email protected]>

Since kernel 5.4, clean-dirs is dead and clean-files works for
directories as well. Detect the kernel version and switch over in case
we are on a recent kernel.

Reported-by: Ralf Ramsauer <[email protected]>
Signed-off-by: Jan Kiszka <[email protected]>
---
 Kbuild              | 8 +++++++-
 hypervisor/Makefile | 8 +++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/Kbuild b/Kbuild
index 2863c121..c12f1aef 100644
--- a/Kbuild
+++ b/Kbuild
@@ -71,5 +71,11 @@ endif
 
 clean-files := pyjailhouse/*.pyc pyjailhouse/pci_defs.py
 
-clean-dirs := Documentation/generated hypervisor/include/generated \
+CLEAN_DIRS := Documentation/generated hypervisor/include/generated \
              pyjailhouse/__pycache__
+
+ifeq ($(shell test $(VERSION) -ge 5 && test $(PATCHLEVEL) -ge 4 && echo 1),1)
+clean-files += $(CLEAN_DIRS)
+else
+clean-dirs += $(CLEAN_DIRS)
+endif
diff --git a/hypervisor/Makefile b/hypervisor/Makefile
index 8ae4e332..c31ad6cf 100644
--- a/hypervisor/Makefile
+++ b/hypervisor/Makefile
@@ -50,7 +50,13 @@ endif
 ccflags-$(CONFIG_JAILHOUSE_GCOV) += -fprofile-arcs -ftest-coverage
 clean-files += *.gcda arch/*/.*.gcda
 
-clean-dirs := arch/$(SRCARCH)/include/generated
+CLEAN_DIRS := arch/$(SRCARCH)/include/generated
+
+ifeq ($(shell test $(VERSION) -ge 5 && test $(PATCHLEVEL) -ge 4 && echo 1),1)
+clean-files += $(CLEAN_DIRS)
+else
+clean-dirs += $(CLEAN_DIRS)
+endif
 
 define sed-y
        "/^=>/{s:=>#\(.*\):/* \1 */:; \
-- 
2.31.1

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/ef2ea9dc-4e55-482d-b53a-c9a1d0e02a9f%40siemens.com.

Reply via email to