[PATCH] DVB: AV7110 DVB driver updates
[linux-2.6/history.git] / scripts / Makefile.clean
blob7277dd208ead79c040be92a98e9124e605e07b0b
1 # ==========================================================================
2 # Cleaning up
3 # ==========================================================================
5 src := $(obj)
7 .PHONY: __clean
8 __clean:
10 include $(obj)/Makefile
12 # Figure out what we need to build from the various variables
13 # ==========================================================================
15 __subdir-y := $(patsubst %/,%,$(filter %/, $(obj-y)))
16 subdir-y += $(__subdir-y)
17 __subdir-m := $(patsubst %/,%,$(filter %/, $(obj-m)))
18 subdir-m += $(__subdir-m)
19 __subdir-n := $(patsubst %/,%,$(filter %/, $(obj-n)))
20 subdir-n += $(__subdir-n)
21 __subdir- := $(patsubst %/,%,$(filter %/, $(obj-)))
22 subdir- += $(__subdir-)
24 # Subdirectories we need to descend into
26 subdir-ym := $(sort $(subdir-y) $(subdir-m))
27 subdir-ymn := $(sort $(subdir-ym) $(subdir-n) $(subdir-))
29 # Add subdir path
31 subdir-ymn := $(addprefix $(obj)/,$(subdir-ymn))
32 __clean-files := $(wildcard $(addprefix $(obj)/, \
33 $(extra-y) $(EXTRA_TARGETS) $(always) $(host-progs) \
34 $(targets) $(clean-files)))
36 # ==========================================================================
38 quiet_cmd_clean = CLEAN $(obj)
39 cmd_clean = rm -f $(__clean-files); $(clean-rule)
41 __clean: $(subdir-ymn)
42 ifneq ($(strip $(__clean-files) $(clean-rule)),)
43 +$(call cmd,clean)
44 else
46 endif
48 # ===========================================================================
49 # Generic stuff
50 # ===========================================================================
52 # Descending
53 # ---------------------------------------------------------------------------
55 .PHONY: $(subdir-ymn)
56 $(subdir-ymn):
57 $(Q)$(MAKE) $(clean)=$@
59 # If quiet is set, only print short version of command
61 cmd = @$(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))' &&) $(cmd_$(1))
63 # Shorthand for $(Q)$(MAKE) scripts/Makefile.clean obj=dir
64 # Usage:
65 # $(Q)$(MAKE) $(clean)=dir
66 clean := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.clean obj