forked from luck/tmp_suning_uos_patched
kbuild: remove clean-dirs syntax
The only the difference between clean-files and clean-dirs is the -r option passed to the 'rm' command. You can always pass -r, and then remove the clean-dirs syntax. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
This commit is contained in:
parent
36de077b20
commit
1634f2bfdb
|
@ -750,7 +750,8 @@ Files matching the patterns "*.[oas]", "*.ko", plus some additional files
|
||||||
generated by kbuild are deleted all over the kernel src tree when
|
generated by kbuild are deleted all over the kernel src tree when
|
||||||
"make clean" is executed.
|
"make clean" is executed.
|
||||||
|
|
||||||
Additional files can be specified in kbuild makefiles by use of $(clean-files).
|
Additional files or directories can be specified in kbuild makefiles by use of
|
||||||
|
$(clean-files).
|
||||||
|
|
||||||
Example::
|
Example::
|
||||||
|
|
||||||
|
@ -761,17 +762,8 @@ When executing "make clean", the file "crc32table.h" will be deleted.
|
||||||
Kbuild will assume files to be in the same relative directory as the
|
Kbuild will assume files to be in the same relative directory as the
|
||||||
Makefile, except if prefixed with $(objtree).
|
Makefile, except if prefixed with $(objtree).
|
||||||
|
|
||||||
To delete a directory hierarchy use:
|
To exclude certain files or directories from make clean, use the
|
||||||
|
$(no-clean-files) variable.
|
||||||
Example::
|
|
||||||
|
|
||||||
#scripts/package/Makefile
|
|
||||||
clean-dirs := $(objtree)/debian/
|
|
||||||
|
|
||||||
This will delete the directory debian in the toplevel directory, including all
|
|
||||||
subdirectories.
|
|
||||||
|
|
||||||
To exclude certain files from make clean, use the $(no-clean-files) variable.
|
|
||||||
|
|
||||||
Usually kbuild descends down in subdirectories due to "obj-* := dir/",
|
Usually kbuild descends down in subdirectories due to "obj-* := dir/",
|
||||||
but in the architecture makefiles where the kbuild infrastructure
|
but in the architecture makefiles where the kbuild infrastructure
|
||||||
|
|
|
@ -52,26 +52,14 @@ __clean-files := $(wildcard \
|
||||||
$(addprefix $(obj)/, $(filter-out $(objtree)/%, $(__clean-files))) \
|
$(addprefix $(obj)/, $(filter-out $(objtree)/%, $(__clean-files))) \
|
||||||
$(filter $(objtree)/%, $(__clean-files)))
|
$(filter $(objtree)/%, $(__clean-files)))
|
||||||
|
|
||||||
# same as clean-files
|
|
||||||
|
|
||||||
__clean-dirs := $(wildcard \
|
|
||||||
$(addprefix $(obj)/, $(filter-out $(objtree)/%, $(clean-dirs))) \
|
|
||||||
$(filter $(objtree)/%, $(clean-dirs)))
|
|
||||||
|
|
||||||
# ==========================================================================
|
# ==========================================================================
|
||||||
|
|
||||||
quiet_cmd_clean = CLEAN $(obj)
|
quiet_cmd_clean = CLEAN $(obj)
|
||||||
cmd_clean = rm -f $(__clean-files)
|
cmd_clean = rm -rf $(__clean-files)
|
||||||
quiet_cmd_cleandir = CLEAN $(__clean-dirs)
|
|
||||||
cmd_cleandir = rm -rf $(__clean-dirs)
|
|
||||||
|
|
||||||
|
|
||||||
__clean: $(subdir-ymn)
|
__clean: $(subdir-ymn)
|
||||||
ifneq ($(strip $(__clean-files)),)
|
ifneq ($(strip $(__clean-files)),)
|
||||||
+$(call cmd,clean)
|
+$(call cmd,clean)
|
||||||
endif
|
|
||||||
ifneq ($(strip $(__clean-dirs)),)
|
|
||||||
+$(call cmd,cleandir)
|
|
||||||
endif
|
endif
|
||||||
@:
|
@:
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,7 @@ testconfig: $(obj)/conf
|
||||||
$(PYTHON3) -B -m pytest $(srctree)/$(src)/tests \
|
$(PYTHON3) -B -m pytest $(srctree)/$(src)/tests \
|
||||||
-o cache_dir=$(abspath $(obj)/tests/.cache) \
|
-o cache_dir=$(abspath $(obj)/tests/.cache) \
|
||||||
$(if $(findstring 1,$(KBUILD_VERBOSE)),--capture=no)
|
$(if $(findstring 1,$(KBUILD_VERBOSE)),--capture=no)
|
||||||
clean-dirs += tests/.cache
|
clean-files += tests/.cache
|
||||||
|
|
||||||
# Help text used by make help
|
# Help text used by make help
|
||||||
help:
|
help:
|
||||||
|
|
|
@ -115,6 +115,4 @@ header-test-y += $(filter-out $(header-test-), \
|
||||||
$(patsubst $(obj)/%,%, $(wildcard \
|
$(patsubst $(obj)/%,%, $(wildcard \
|
||||||
$(addprefix $(obj)/, *.h */*.h */*/*.h */*/*/*.h))))
|
$(addprefix $(obj)/, *.h */*.h */*/*.h */*/*/*.h))))
|
||||||
|
|
||||||
# For GNU Make <= 4.2.1, $(wildcard $(obj)/*/) matches to not only directories
|
clean-files += $(filter-out Makefile, $(notdir $(wildcard $(obj)/*)))
|
||||||
# but also regular files. Use $(filter %/, ...) just in case.
|
|
||||||
clean-dirs += $(patsubst $(obj)/%/,%,$(filter %/, $(wildcard $(obj)/*/)))
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user