blob: f97ecd3b8eee0729ac81ddc638741715ba9d8f1a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# SPDX-License-Identifier: GPL-2.0
# ==========================================================================
# Cleaning up
# ==========================================================================
src := $(obj)
# shortcuts
srcdir := $(srctree)/$(src)
clean::
include $(srctree)/scripts/Kbuild.include
include $(src)/Makefile
# Figure out what we need to clean from the various variables
# ==========================================================================
subdir-all := $(subdir-y) $(subdir-n) $(subdir-) \
$(patsubst %/,%, $(filter %/, $(obj-y) $(obj-n) $(obj-)))
subdir-all := $(addprefix $(obj)/,$(subdir-all))
__clean-files := \
$(clean-files) $(hostprogs-y) $(hostprogs-) \
$(extra-y) $(extra-) $(targets) \
$(hostprogs-always-y) $(hostprogs-always-)
# clean-files is given relative to the current directory, unless it
# starts with $(objtree)/ (which means "./", so do not add "./" unless
# you want to delete a file from the toplevel object directory).
__clean-files := $(wildcard \
$(addprefix $(obj)/, $(filter-out /% $(objtree)/%, $(__clean-files))) \
$(filter /% $(objtree)/%, $(__clean-files)))
.PHONY: clean
clean:: $(subdir-all)
ifneq ($(strip $(__clean-files)),)
rm -rf $(__clean-files)
endif
@:
# Descending
# ---------------------------------------------------------------------------
PHONY += $(subdir-all)
$(subdir-all):
$(Q)$(MAKE) $(clean)=$@
.PHONY: $(PHONY)
|