Commit 83a26d41 authored by Kai Germaschewski's avatar Kai Germaschewski

kbuild: Small cleanups

o Use a function "descend" for descending into subdirectories
o Remove unused (?) "boot" target
o Remove unnecessary intermediate "sub_dirs" target from Rules.make
o Use /bin/true instead of echo -n to suppress spurious
  "nothing to be done for ..." output from make
parent e14956f3
......@@ -52,13 +52,6 @@ CROSS_COMPILE =
all: vmlinux
# Print entire command lines instead of short version
# For now, leave the default
ifndef KBUILD_VERBOSE
KBUILD_VERBOSE = 1
endif
# Decide whether to build built-in, modular, or both.
# Normally, just do built-in.
......@@ -105,6 +98,12 @@ export KBUILD_MODULES KBUILD_BUILTIN
# If it is set to "silent_", nothing wil be printed at all, since
# the variable $(silent_cmd_cc_o_c) doesn't exist.
# For now, leave verbose as default
ifndef KBUILD_VERBOSE
KBUILD_VERBOSE = 1
endif
# If the user wants quiet mode, echo short versions of the commands
# only and suppress the 'Entering/Leaving directory' messages
......@@ -120,7 +119,7 @@ ifneq ($(findstring s,$(MAKEFLAGS)),)
quiet=silent_
endif
export quiet
export quiet KBUILD_VERBOSE
#
# Include the make variables (CC, etc...)
......@@ -183,7 +182,7 @@ scripts/docproc scripts/fixdep scripts/split-include : scripts ;
.PHONY: scripts
scripts:
@$(MAKE) -C scripts
@$(call descend,scripts,)
ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
......@@ -276,12 +275,6 @@ LIBS += $(patsubst %/, %/lib.a, $(libs-y))
export NETWORKS DRIVERS LIBS HEAD LDFLAGS MAKEBOOT
# boot target
# ---------------------------------------------------------------------------
boot: vmlinux
@$(MAKE) -C arch/$(ARCH)/boot
# Build vmlinux
# ---------------------------------------------------------------------------
......@@ -314,7 +307,7 @@ define rule_vmlinux
echo ' Generating build number'
. scripts/mkversion > .tmp_version
mv -f .tmp_version .version
+$(MAKE) -C init
+$(call descend,init,)
$(call cmd,link_vmlinux)
echo 'cmd_$@ := $(cmd_link_vmlinux)' > $(@D)/.$(@F).cmd
$(NM) $@ | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > System.map
......@@ -363,7 +356,7 @@ $(sort $(vmlinux-objs)): $(SUBDIRS) ;
.PHONY: $(SUBDIRS)
$(SUBDIRS): .hdepend prepare
@$(MAKE) -C $@
@$(call descend,$@,)
# Things we need done before we descend to build or make
# module versions are listed in "prepare"
......@@ -386,17 +379,17 @@ targets += arch/$(ARCH)/vmlinux.lds.s
# ---------------------------------------------------------------------------
%.s: %.c FORCE
@$(MAKE) -C $(@D) $(@F)
@$(call descend,$(@D),$(@F))
%.i: %.c FORCE
@$(MAKE) -C $(@D) $(@F)
@$(call descend,$(@D),$(@F))
%.o: %.c FORCE
@$(MAKE) -C $(@D) $(@F)
@$(call descend,$(@D),$(@F))
%.lst: %.c FORCE
@$(MAKE) -C $(@D) $(@F)
@$(call descend,$(@D),$(@F))
%.s: %.S FORCE
@$(MAKE) -C $(@D) $(@F)
@$(call descend,$(@D),$(@F))
%.o: %.S FORCE
@$(MAKE) -C $(@D) $(@F)
@$(call descend,$(@D),$(@F))
# FIXME: The asm symlink changes when $(ARCH) changes. That's
# hard to detect, but I suppose "make mrproper" is a good idea
......@@ -481,7 +474,7 @@ include/linux/modversions.h: scripts/fixdep prepare FORCE
$(update-if-changed)
$(patsubst %,_sfdep_%,$(SUBDIRS)): FORCE
@$(MAKE) -C $(patsubst _sfdep_%, %, $@) fastdep
@$(call descend,$(patsubst _sfdep_%,%,$@),fastdep)
else # !CONFIG_MODVERSIONS
......@@ -533,7 +526,7 @@ _modinst_post:
.PHONY: $(patsubst %, _modinst_%, $(SUBDIRS))
$(patsubst %, _modinst_%, $(SUBDIRS)) :
@$(MAKE) -C $(patsubst _modinst_%, %, $@) modules_install
$(descend,$(patsubst _modinst_%,%,$@),modules_install)
else # CONFIG_MODULES
......@@ -631,11 +624,11 @@ ifeq ($(filter-out $(noconfig_targets),$(MAKECMDGOALS)),)
make_with_config
xconfig:
@$(MAKE) -C scripts kconfig.tk
@$(call descend,scripts,kconfig.tk)
wish -f scripts/kconfig.tk
menuconfig:
@$(MAKE) -C scripts lxdialog
@$(call descend,scripts,lxdialog)
$(CONFIG_SHELL) $(src)/scripts/Menuconfig arch/$(ARCH)/config.in
config:
......@@ -734,7 +727,7 @@ mrproper: clean archmrproper
-type f -print | xargs rm -f
@rm -rf $(MRPROPER_DIRS)
@rm -f $(MRPROPER_FILES)
@$(MAKE) -C scripts mrproper
@$(call descend,scripts,mrproper)
@$(MAKE) -f Documentation/DocBook/Makefile mrproper
distclean: mrproper
......@@ -909,5 +902,9 @@ define update-if-changed
fi
endef
# $(call descend,<dir>,<target>)
# Recursively call a sub-make in <dir> with target <target>
descend = $(MAKE) -C $(1) $(2)
FORCE:
......@@ -136,8 +136,8 @@ ifeq ($(strip $(export-objs)),)
# If we don't export any symbols in this dir, just descend
# ---------------------------------------------------------------------------
fastdep: sub_dirs
@echo -n
fastdep: $(subdir-ym)
@/bin/true
else
......@@ -206,7 +206,7 @@ $(MODVERDIR)/%.ver: %.c FORCE
targets := $(addprefix $(MODVERDIR)/,$(export-objs:.o=.ver))
fastdep: $(targets) sub_dirs
fastdep: $(targets) $(subdir-ym)
@mkdir -p $(TOPDIR)/.tmp_export-objs/modules/$(RELDIR)
@touch $(addprefix $(TOPDIR)/.tmp_export-objs/modules/$(RELDIR)/,$(export-objs:.o=.ver))
......@@ -221,13 +221,13 @@ ifeq ($(MAKECMDGOALS),modules_install)
.PHONY: modules_install
modules_install: sub_dirs
modules_install: $(subdir-ym)
ifneq ($(obj-m),)
@echo Installing modules in $(MODLIB)/kernel/$(RELDIR)
@mkdir -p $(MODLIB)/kernel/$(RELDIR)
@cp $(obj-m) $(MODLIB)/kernel/$(RELDIR)
else
@echo -n
@/bin/true
endif
else # ! modules_install
......@@ -248,8 +248,8 @@ endif
# The echo suppresses the "Nothing to be done for first_rule"
first_rule: $(if $(KBUILD_BUILTIN),$(O_TARGET) $(L_TARGET) $(EXTRA_TARGETS)) \
$(if $(KBUILD_MODULES),$(obj-m)) \
sub_dirs
@echo -n
$(subdir-ym)
@/bin/true
# Compile C sources (.c)
# ---------------------------------------------------------------------------
......@@ -324,7 +324,7 @@ targets += $(real-objs-y) $(real-objs-m) $(EXTRA_TARGETS) $(MAKECMDGOALS)
# ---------------------------------------------------------------------------
# To build objects in subdirs, we need to descend into the directories
$(sort $(subdir-obj-y)): sub_dirs ;
$(sort $(subdir-obj-y)): $(subdir-ym) ;
#
# Rule to compile a set of .o files into one .o file
......@@ -454,12 +454,10 @@ cmd_gzip = gzip -f -9 < $< > $@
# Descending
# ---------------------------------------------------------------------------
.PHONY: sub_dirs $(subdir-ym)
sub_dirs: $(subdir-ym)
.PHONY: $(subdir-ym)
$(subdir-ym):
@$(MAKE) -C $@ $(MAKECMDGOALS)
@$(call descend,$@,$(MAKECMDGOALS))
# Add FORCE to the prequisites of a target to force it to be always rebuilt.
# ---------------------------------------------------------------------------
......@@ -574,3 +572,8 @@ define do_cmd
$(2)
endef
# $(call descend,<dir>,<target>)
# Recursively call a sub-make in <dir> with target <target>
descend = $(MAKE) -C $(1) $(2)
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