Skip to content

Commit

Permalink
kbuild: Do not remove vmlinux when cleaning external module
Browse files Browse the repository at this point in the history
Since commit 1f2bfbd "kbuild:
link of vmlinux moved to a script" make clean with M=<dir>
argument (so cleaning external module) removes vmlinux,
System.map and couple of other files from the *main* kernel
build directory! This not what was happening before and almost
certainly not what one would expect.

This patch moves makes the clean target of the script called
only when !KBUILD_EXTMOD.

Signed-off-by: Pawel Moll <[email protected]>
Cc: [email protected] [v3.5+]
Signed-off-by: Michal Marek <[email protected]>
  • Loading branch information
pawelmoll authored and michal42 committed Dec 9, 2012
1 parent fc96b21 commit bd1ee80
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1008,11 +1008,14 @@ clean: rm-dirs := $(CLEAN_DIRS)
clean: rm-files := $(CLEAN_FILES)
clean-dirs := $(addprefix _clean_, . $(vmlinux-alldirs) Documentation samples)

PHONY += $(clean-dirs) clean archclean
PHONY += $(clean-dirs) clean archclean vmlinuxclean
$(clean-dirs):
$(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)

clean: archclean
vmlinuxclean:
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/link-vmlinux.sh clean

clean: archclean vmlinuxclean

# mrproper - Delete all generated files, including .config
#
Expand Down Expand Up @@ -1239,7 +1242,6 @@ scripts: ;
endif # KBUILD_EXTMOD

clean: $(clean-dirs)
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/link-vmlinux.sh clean
$(call cmd,rmdirs)
$(call cmd,rmfiles)
@find $(if $(KBUILD_EXTMOD), $(KBUILD_EXTMOD), .) $(RCS_FIND_IGNORE) \
Expand Down

0 comments on commit bd1ee80

Please sign in to comment.