Commit a16c5f99a28c9945165c46da27fff8e6f26f8736

Authored by Michal Marek
1 parent 97bf6af1f9

kbuild: Fix removal of the debian/ directory

scripts/Makefile.clean treats absolute path specially, but
$(objtree)/debian is no longer an absolute path since 7e1c0477 (kbuild:
Use relative path for $(objtree). Work around this by checking if the
path starts with $(objtree)/.

Reported-and-tested-by: Sedat Dilek <sedat.dilek@gmail.com>
Fixes: 7e1c0477 (kbuild: Use relative path for $(objtree)
Signed-off-by: Michal Marek <mmarek@suse.cz>

Showing 1 changed file with 8 additions and 8 deletions Side-by-side Diff

scripts/Makefile.clean
... ... @@ -42,19 +42,19 @@
42 42  
43 43 __clean-files := $(filter-out $(no-clean-files), $(__clean-files))
44 44  
45   -# as clean-files is given relative to the current directory, this adds
46   -# a $(obj) prefix, except for absolute paths
  45 +# clean-files is given relative to the current directory, unless it
  46 +# starts with $(objtree)/ (which means "./", so do not add "./" unless
  47 +# you want to delete a file from the toplevel object directory).
47 48  
48 49 __clean-files := $(wildcard \
49   - $(addprefix $(obj)/, $(filter-out /%, $(__clean-files))) \
50   - $(filter /%, $(__clean-files)))
  50 + $(addprefix $(obj)/, $(filter-out $(objtree)/%, $(__clean-files))) \
  51 + $(filter $(objtree)/%, $(__clean-files)))
51 52  
52   -# as clean-dirs is given relative to the current directory, this adds
53   -# a $(obj) prefix, except for absolute paths
  53 +# same as clean-files
54 54  
55 55 __clean-dirs := $(wildcard \
56   - $(addprefix $(obj)/, $(filter-out /%, $(clean-dirs))) \
57   - $(filter /%, $(clean-dirs)))
  56 + $(addprefix $(obj)/, $(filter-out $(objtree)/%, $(clean-dirs))) \
  57 + $(filter $(objtree)/%, $(clean-dirs)))
58 58  
59 59 # ==========================================================================
60 60