kbuild: Switch "make modules_install" to fast mode ;)
[linux-flexiantxendom0-3.2.10.git] / scripts / Makefile.clean
1 # ==========================================================================
2 # Cleaning up
3 # ==========================================================================
4
5 src := $(obj)
6
7 no-rules.make := 1
8
9 .PHONY: __clean
10 __clean:
11
12 include $(obj)/Makefile
13
14 # Figure out what we need to build from the various variables
15 # ==========================================================================
16
17 __subdir-y      := $(patsubst %/,%,$(filter %/, $(obj-y)))
18 subdir-y        += $(__subdir-y)
19 __subdir-m      := $(patsubst %/,%,$(filter %/, $(obj-m)))
20 subdir-m        += $(__subdir-m)
21 __subdir-n      := $(patsubst %/,%,$(filter %/, $(obj-n)))
22 subdir-n        += $(__subdir-n)
23 __subdir-       := $(patsubst %/,%,$(filter %/, $(obj-)))
24 subdir-         += $(__subdir-)
25
26 # Subdirectories we need to descend into
27
28 subdir-ym       := $(sort $(subdir-y) $(subdir-m))
29 subdir-ymn      := $(sort $(subdir-ym) $(subdir-n) $(subdir-))
30
31 # Add subdir path
32
33 EXTRA_TARGETS   := $(addprefix $(obj)/,$(EXTRA_TARGETS))
34 clean-files     := $(addprefix $(obj)/,$(clean-files))
35 host-progs      := $(addprefix $(obj)/,$(host-progs))
36 subdir-ymn      := $(addprefix $(obj)/,$(subdir-ymn))
37
38 # ==========================================================================
39
40 __clean-files := $(wildcard $(EXTRA_TARGETS) $(host-progs) $(clean-files))
41
42 quiet_cmd_clean = CLEAN   $(__cleanfiles)
43       cmd_clean =       rm -f $(__clean-files); $(clean-rule)
44
45 __clean: $(subdir-ymn)
46 ifneq ($(strip $(__clean-files) $(clean-rule)),)
47         $(call cmd,clean)
48 else
49         @:
50 endif
51
52 # ===========================================================================
53 # Generic stuff
54 # ===========================================================================
55
56 # Descending
57 # ---------------------------------------------------------------------------
58
59 .PHONY: $(subdir-ymn)
60 $(subdir-ymn):
61         $(Q)$(MAKE) -rR -f scripts/Makefile.clean obj=$@
62
63 # If quiet is set, only print short version of command
64
65 cmd = @$(if $($(quiet)cmd_$(1)),echo '  $($(quiet)cmd_$(1))' &&) $(cmd_$(1))