From cb56ef33764ffe503aa1e1a0848ae097e200d954 Mon Sep 17 00:00:00 2001 From: Kai Germaschewski Date: Wed, 16 Oct 2002 12:10:27 -0500 Subject: kbuild: Speed up new "make clean/mrproper" Do as little as possible apart from calling sub-makes and calling 'rm', which makes things go quite a bit faster. --- scripts/Makefile.clean | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 scripts/Makefile.clean (limited to 'scripts') diff --git a/scripts/Makefile.clean b/scripts/Makefile.clean new file mode 100644 index 000000000000..fa809a7e88ad --- /dev/null +++ b/scripts/Makefile.clean @@ -0,0 +1,42 @@ + +src := $(obj) + +no-rules.make := 1 + +.PHONY: __clean +__clean: + +include $(obj)/Makefile + +__subdir-y := $(patsubst %/,%,$(filter %/, $(obj-y))) +subdir-y += $(__subdir-y) +__subdir-m := $(patsubst %/,%,$(filter %/, $(obj-m))) +subdir-m += $(__subdir-m) +__subdir-n := $(patsubst %/,%,$(filter %/, $(obj-n))) +subdir-n += $(__subdir-n) +__subdir- := $(patsubst %/,%,$(filter %/, $(obj-))) +subdir- += $(__subdir-) + +subdir-ym := $(sort $(subdir-y) $(subdir-m)) +subdir-ymn := $(sort $(subdir-ym) $(subdir-n) $(subdir-)) + +EXTRA_TARGETS := $(addprefix $(obj)/,$(EXTRA_TARGETS)) +clean-files := $(addprefix $(obj)/,$(clean-files)) +host-progs := $(addprefix $(obj)/,$(host-progs)) +subdir-ymn := $(addprefix $(obj)/,$(subdir-ymn)) + +__clean-files := $(wildcard $(EXTRA_TARGETS) $(host-progs) $(clean-files)) + +__clean: $(subdir-ymn) +ifneq ($(strip $(__clean-files) $(clean-rule)),) + rm -f $(__clean-files) + $(clean-rule) +else + @/bin/true +endif + +.PHONY: $(subdir-ymn) + +$(subdir-ymn): + $(MAKE) -rR -f scripts/Makefile.clean obj=$@ + -- cgit v1.2.3