kbuild: add comments to Makefile.clean
authorSam Ravnborg <sam@mars.ravnborg.org>
Thu, 19 Aug 2004 01:17:03 +0000 (03:17 +0200)
committerSam Ravnborg <sam@mars.ravnborg.org>
Thu, 19 Aug 2004 01:17:03 +0000 (03:17 +0200)
Chris Wedgwood <cw@f00f.org> wrote:
> P.S. I'd love to see the rules in scripts/Makefile.* documented.  I
>      would offer a patch for this but I don't understand the rules
>      myself...
And provided the following patch, slightly modified by me.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>

scripts/Makefile.clean

index ab73032..b02ab1f 100644 (file)
@@ -29,13 +29,25 @@ subdir-ymn      := $(sort $(subdir-ym) $(subdir-n) $(subdir-))
 # Add subdir path
 
 subdir-ymn     := $(addprefix $(obj)/,$(subdir-ymn))
+
+# build a list of files to remove, usually releative to the current
+# directory
+
 __clean-files  := $(extra-y) $(EXTRA_TARGETS) $(always) \
                   $(targets) $(clean-files)             \
                   $(host-progs)                         \
                   $(hostprogs-y) $(hostprogs-m) $(hostprogs-)
+
+# as clean-files is given relative to the current directory, this adds
+# a $(obj) prefix, except for absolute paths
+
 __clean-files   := $(wildcard                                               \
                    $(addprefix $(obj)/, $(filter-out /%, $(__clean-files))) \
                   $(filter /%, $(__clean-files)))
+
+# as clean-dirs is given relative to the current directory, this adds
+# a $(obj) prefix, except for absolute paths
+
 __clean-dirs    := $(wildcard                                               \
                    $(addprefix $(obj)/, $(filter-out /%, $(clean-dirs)))    \
                   $(filter /%, $(clean-dirs)))