Commit c3ef0e83 authored by Kai Germaschewski's avatar Kai Germaschewski

kbuild: More cleaning work...

o Having .config depend on all Config.in's via a find is
  annoying, since it causes a long break before "make" actually
  gets going. Comment it out for now.

o Fix some "make -j" issues with generating module versions.

o Unify "make distclean" and "make mrproper", they were doing nearly the
  same thing anyway.

o Use the new "make clean" infrastructure for arch/i386/boot/ and
  scripts/

o Reorganize the "make clean" stuff a little, do the 
  find -name '*.[oas]' | xargs rm -f from the top-level Makefile again
  and only use the per-subdir rule for special cases like generated files,
  host-progs and the like.
parent 20d4607f
...@@ -239,7 +239,7 @@ ifdef include-config ...@@ -239,7 +239,7 @@ ifdef include-config
# If .config doesn't exist - tough luck # If .config doesn't exist - tough luck
.config: arch/$(ARCH)/config.in $(shell find . -name Config.in) .config: arch/$(ARCH)/config.in # FIXME $(shell find . -name Config.in)
@echo '***' @echo '***'
@if [ -f $@ ]; then \ @if [ -f $@ ]; then \
echo '*** The tree was updated, so your .config may be'; \ echo '*** The tree was updated, so your .config may be'; \
...@@ -456,18 +456,23 @@ include/linux/version.h: Makefile ...@@ -456,18 +456,23 @@ include/linux/version.h: Makefile
depend dep: .hdepend depend dep: .hdepend
# .hdepend is our (misnomed) marker for whether we've run # .hdepend is our (misnomed) marker for whether we've
# generated module versions # generated module versions
.hdepend: $(if $(filter dep depend,$(MAKECMDGOALS)),FORCE) make-versions := $(strip $(if $(filter dep depend,$(MAKECMDGOALS)),1) \
$(if $(wildcard .hdepend),,1))
.hdepend: prepare FORCE
ifneq ($(make-versions),)
@$(MAKE) include/linux/modversions.h @$(MAKE) include/linux/modversions.h
@touch $@ @touch $@
endif
ifdef CONFIG_MODVERSIONS ifdef CONFIG_MODVERSIONS
# Update modversions.h, but only if it would change. # Update modversions.h, but only if it would change.
include/linux/modversions.h: scripts/fixdep prepare FORCE include/linux/modversions.h: FORCE
@rm -rf .tmp_export-objs @rm -rf .tmp_export-objs
@$(MAKE) $(patsubst %,_sfdep_%,$(SUBDIRS)) @$(MAKE) $(patsubst %,_sfdep_%,$(SUBDIRS))
@echo -n ' Generating $@' @echo -n ' Generating $@'
...@@ -688,42 +693,34 @@ MRPROPER_DIRS += \ ...@@ -688,42 +693,34 @@ MRPROPER_DIRS += \
include/config \ include/config \
include/linux/modules include/linux/modules
# clean - Delete all intermidiate files # clean - Delete all intermediate files
# #
clean-dirs += $(ALL_SUBDIRS) Documentation/DocBook clean-dirs += $(ALL_SUBDIRS) Documentation/DocBook scripts
cleanprint:
@echo ' Cleaning the srctree'
$(addprefix _clean_,$(clean-dirs)): cleanprint $(addprefix _clean_,$(clean-dirs)):
+@$(call descend,$(patsubst _clean_%,%,$@), subdirclean) +@$(call descend,$(patsubst _clean_%,%,$@), subdirclean)
quiet_cmd_rmclean = RM $$(CLEAN_FILES) quiet_cmd_rmclean = RM $$(CLEAN_FILES)
cmd_rmclean = rm -f $(CLEAN_FILES) cmd_rmclean = rm -f $(CLEAN_FILES)
clean: archclean $(addprefix _clean_,$(clean-dirs)) clean: archclean $(addprefix _clean_,$(clean-dirs))
$(call cmd,rmclean) $(call cmd,rmclean)
@find . $(RCS_FIND_IGNORE) \
\( -name '*.[oas]' -o -name '.*.cmd' -o -name '.*.d' \
-o -name '.*.tmp' \) -type f -print | xargs rm -f
# mrproper - delete configuration + modules + core files # mrproper - delete configuration + modules + core files
# #
quiet_cmd_mrproper = RM $$(MRPROPER_DIRS) + $$(MRPROPER_FILES) quiet_cmd_mrproper = RM $$(MRPROPER_DIRS) + $$(MRPROPER_FILES)
cmd_mrproper = rm -rf $(MRPROPER_DIRS) && rm -f $(MRPROPER_FILES) cmd_mrproper = rm -rf $(MRPROPER_DIRS) && rm -f $(MRPROPER_FILES)
mrproper: clean archmrproper mrproper distclean: clean archmrproper
@echo ' Making mrproper in the srctree' @echo ' Making $@ in the srctree'
@find . $(RCS_FIND_IGNORE) \
\( -name .depend -o -name .\*.cmd -o -name core \) \
-type f -print | xargs rm -f
$(call cmd,mrproper)
+@$(call descend,scripts,mrproper)
# distclean - remove all temporaries left behind by patch, vi, emacs etc.
#
distclean: mrproper
@echo ' Making distclean in the srctree'
@find . $(RCS_FIND_IGNORE) \ @find . $(RCS_FIND_IGNORE) \
\( -not -type d \) -and \
\( -name '*.orig' -o -name '*.rej' -o -name '*~' \ \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
-o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \ -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
-o -name '.*.rej' -o -name '.SUMS' -o -size 0 \) -type f \ -o -name '.*.rej' -o -size 0 \
-print | xargs rm -f -o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \
-type f -print | xargs rm -f
$(call cmd,mrproper)
# Generate tags for editors # Generate tags for editors
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
......
...@@ -155,11 +155,17 @@ depfile = $(subst $(comma),_,$(@D)/.$(@F).d) ...@@ -155,11 +155,17 @@ depfile = $(subst $(comma),_,$(@D)/.$(@F).d)
# targets (That happens when someone does make some/dir/foo.[ois]) # targets (That happens when someone does make some/dir/foo.[ois])
ifeq ($(MAKECMDGOALS),subdirclean) ifeq ($(MAKECMDGOALS),subdirclean)
__clean-files := $(wildcard $(EXTRA_TARGETS) $(host-progs) $(clean-files))
subdirclean: $(subdir-ymn) subdirclean: $(subdir-ymn)
ifneq ($(strip $(__clean-files) $(clean-rule)),)
rm -f $(__clean-files)
$(clean-rule)
else
@/bin/true @/bin/true
@rm -f $(EXTRA_TARGETS) $(host-progs) $(clean-files) \ endif
$(addprefix $(obj)/,*.[oas] .*.cmd .*.tmp .*.d)
@$(clean-rule)
else else
ifeq ($(MAKECMDGOALS),fastdep) ifeq ($(MAKECMDGOALS),fastdep)
...@@ -180,7 +186,7 @@ else ...@@ -180,7 +186,7 @@ else
# This sets version suffixes on exported symbols # This sets version suffixes on exported symbols
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
MODVERDIR := include/linux/modules/ MODVERDIR := include/linux/modules
# #
# Added the SMP separator to stop module accidents between uniprocessor # Added the SMP separator to stop module accidents between uniprocessor
......
...@@ -86,6 +86,6 @@ install: vmlinux ...@@ -86,6 +86,6 @@ install: vmlinux
+@$(call makeboot,BOOTIMAGE=$(BOOTIMAGE) install) +@$(call makeboot,BOOTIMAGE=$(BOOTIMAGE) install)
archclean: archclean:
+@$(call makeboot,clean) +@$(call makeboot,subdirclean)
archmrproper: archmrproper:
...@@ -28,6 +28,8 @@ SVGA_MODE := -DSVGA_MODE=NORMAL_VGA ...@@ -28,6 +28,8 @@ SVGA_MODE := -DSVGA_MODE=NORMAL_VGA
EXTRA_TARGETS := vmlinux.bin bootsect bootsect.o \ EXTRA_TARGETS := vmlinux.bin bootsect bootsect.o \
setup setup.o zImage bzImage setup setup.o zImage bzImage
subdir- := compressed
host-progs := tools/build host-progs := tools/build
# Default # Default
...@@ -79,11 +81,6 @@ zlilo: $(BOOTIMAGE) ...@@ -79,11 +81,6 @@ zlilo: $(BOOTIMAGE)
install: $(BOOTIMAGE) install: $(BOOTIMAGE)
sh $(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)" sh $(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)"
clean:
@echo 'Cleaning up (boot)'
@rm -f $(host-progs) $(EXTRA_TARGETS)
+@$(call descend,$(obj)/compressed) clean
archhelp: archhelp:
@echo '* bzImage - Compressed kernel image (arch/$(ARCH)/boot/bzImage)' @echo '* bzImage - Compressed kernel image (arch/$(ARCH)/boot/bzImage)'
@echo ' install - Install kernel using' @echo ' install - Install kernel using'
......
...@@ -24,7 +24,3 @@ LDFLAGS_piggy.o := -r --format binary --oformat elf32-i386 -T ...@@ -24,7 +24,3 @@ LDFLAGS_piggy.o := -r --format binary --oformat elf32-i386 -T
$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.gz FORCE $(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.gz FORCE
$(call if_changed,ld) $(call if_changed,ld)
clean:
@echo 'Cleaning up (boot/compressed)'
@rm -f $(EXTRA_TARGETS)
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
EXTRA_TARGETS := fixdep split-include docproc conmakehash EXTRA_TARGETS := fixdep split-include docproc conmakehash
subdir- := lxdialog
# Yikes. We need to build this stuff here even if the user only wants # Yikes. We need to build this stuff here even if the user only wants
# modules. # modules.
...@@ -24,6 +26,8 @@ KBUILD_BUILTIN := 1 ...@@ -24,6 +26,8 @@ KBUILD_BUILTIN := 1
host-progs := fixdep split-include conmakehash docproc tkparse host-progs := fixdep split-include conmakehash docproc tkparse
tkparse-objs := tkparse.o tkcond.o tkgen.o tkparse-objs := tkparse.o tkcond.o tkgen.o
clean-files := kconfig.tk
include $(TOPDIR)/Rules.make include $(TOPDIR)/Rules.make
# In reality kconfig.tk should depend on all Config.in files, # In reality kconfig.tk should depend on all Config.in files,
...@@ -56,8 +60,3 @@ lxdialog: ...@@ -56,8 +60,3 @@ lxdialog:
# fixdep is needed to compile other host programs # fixdep is needed to compile other host programs
$(obj)/split-include $(obj)/docproc $(addprefix $(obj)/,$(tkparse-objs)) \ $(obj)/split-include $(obj)/docproc $(addprefix $(obj)/,$(tkparse-objs)) \
$(obj)/conmakehash lxdialog: $(obj)/fixdep $(obj)/conmakehash lxdialog: $(obj)/fixdep
mrproper:
@rm -f $(host-progs) $(addprefix $(obj)/,$(tkparse-objs) kconfig.tk core)
@$(call descend,scripts/lxdialog,mrproper)
...@@ -42,6 +42,3 @@ ncurses: ...@@ -42,6 +42,3 @@ ncurses:
echo ;\ echo ;\
exit 1 ;\ exit 1 ;\
fi fi
mrproper:
@rm -f $(host-progs) $(addprefix $(obj)/,$(lxdialog-objs))
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment