diff options
| author | Kai Germaschewski <kai@tp1.ruhr-uni-bochum.de> | 2002-06-05 02:05:21 -0500 |
|---|---|---|
| committer | Kai Germaschewski <kai@tp1.ruhr-uni-bochum.de> | 2002-06-05 02:05:21 -0500 |
| commit | 00b454db90622ce85e11be0ec60f53dd375d6d0a (patch) | |
| tree | 33ed8f9e0b3e8be683fb4e883803e24486d0c8e3 | |
| parent | 77c83c756413d33d8aff4c213ae3882416c7cf55 (diff) | |
kbuild: Fix make -s (silent) and add a quiet mode
Suppress echoing of commands when using "make -s", so that make -s
does indeed have the effect one would expect.
Add a quiet mode, which will print not the entire command but only
one line per rule. To turn it on, use
make KBUILD_VERBOSE=0 vmlinux/whatever
or set KBUILD_VERBOSE=0 in your environment.
For now, the verbose mode is default, which gives you the old behavior
of printing all commands.
The output in quiet mode is based on what Keith Owens' kbuild-2.5 does,
I like, I did not want to invent yet another output format.
| -rw-r--r-- | Documentation/DocBook/Makefile | 26 | ||||
| -rw-r--r-- | Makefile | 75 | ||||
| -rw-r--r-- | Rules.make | 51 | ||||
| -rw-r--r-- | init/Makefile | 1 | ||||
| -rw-r--r-- | scripts/mkcompile_h | 3 | ||||
| -rw-r--r-- | scripts/mkversion_h | 3 |
6 files changed, 113 insertions, 46 deletions
diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile index 442924cf6d22..0502eeee672e 100644 --- a/Documentation/DocBook/Makefile +++ b/Documentation/DocBook/Makefile @@ -161,18 +161,20 @@ LOG := $(patsubst %.sgml, %.log, $(BOOKS)) OUT := $(patsubst %.sgml, %.out, $(BOOKS)) clean: - rm -f core *~ - rm -f $(BOOKS) - rm -f $(DVI) $(AUX) $(TEX) $(LOG) $(OUT) - rm -f $(PNG-parportbook) $(EPS-parportbook) - rm -f $(C-procfs-example) - -mrproper: clean - rm -f $(PS) $(PDF) - rm -f -r $(HTML) - rm -f .depend - rm -f $(TOPDIR)/scripts/mkdep-docbook - rm -rf DBTOHTML_OUTPUT* + @echo 'Cleaning up (DocBook)' + @rm -f core *~ + @rm -f $(BOOKS) + @rm -f $(DVI) $(AUX) $(TEX) $(LOG) $(OUT) + @rm -f $(PNG-parportbook) $(EPS-parportbook) + @rm -f $(C-procfs-example) + +mrproper: + @echo 'Making mrproper (DocBook)' + @rm -f $(PS) $(PDF) + @rm -f -r $(HTML) + @rm -f .depend + @rm -f $(TOPDIR)/scripts/mkdep-docbook + @rm -rf DBTOHTML_OUTPUT* %.ps : %.sgml @(which db2ps > /dev/null 2>&1) || \ @@ -41,6 +41,43 @@ CROSS_COMPILE = all: vmlinux +# Print entire command lines instead of short version +# For now, leave the default + +#KBUILD_VERBOSE := 1 + +# Beautify output +# --------------------------------------------------------------------------- +# +# Normally, we echo the whole command before executing it. By making +# that echo $($(quiet)$(cmd)), we now have the possibility to set +# $(quiet) to choose other forms of output instead, e.g. +# +# quiet_cmd_cc_o_c = Compiling $(RELDIR)/$@ +# cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< +# +# If $(quiet) is empty, the whole command will be printed. +# If it is set to "quiet_", only the short version will be printed. +# If it is set to "silent_", nothing wil be printed at all, since +# the variable $(silent_cmd_cc_o_c) doesn't exist. + +# If the user wants quiet mode, echo short versions of the commands +# only and suppress the 'Entering/Leaving directory' messages + +ifneq ($(KBUILD_VERBOSE),1) + quiet=quiet_ + MAKEFLAGS += --no-print-directory +endif + +# If the user is running make -s (silent mode), suppress echoing of +# commands + +ifneq ($(findstring s,$(MAKEFLAGS)),) + quiet=silent_ +endif + +export quiet + # # Include the make variables (CC, etc...) # @@ -164,6 +201,7 @@ boot: vmlinux vmlinux-objs := $(HEAD) $(INIT) $(CORE_FILES) $(LIBS) $(DRIVERS) $(NETWORKS) +quiet_cmd_link_vmlinux = LD $@ cmd_link_vmlinux = $(LD) $(LINKFLAGS) $(HEAD) $(INIT) \ --start-group \ $(CORE_FILES) \ @@ -181,7 +219,7 @@ define rule_link_vmlinux . scripts/mkversion > .tmpversion mv -f .tmpversion .version $(MAKE) -C init - echo $(cmd_link_vmlinux) + $(call cmd,cmd_link_vmlinux) $(cmd_link_vmlinux) echo 'cmd_$@ := $(cmd_link_vmlinux)' > $(@D)/.$(@F).cmd $(NM) vmlinux | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > System.map @@ -255,7 +293,6 @@ include/linux/autoconf.h: .config # this Makefile include/linux/version.h: Makefile - @echo Generating $@ @. scripts/mkversion_h $@ $(KERNELRELEASE) $(VERSION) $(PATCHLEVEL) $(SUBLEVEL) # Helpers built in scripts/ @@ -281,9 +318,12 @@ depend dep: .hdepend # we make "FORCE" a prequisite, to force redoing the # dependencies. Yeah, that's ugly, and it'll go away soon. +quiet_cmd_depend = Making dependencies (include) +cmd_depend = scripts/mkdep -- `find $(FINDHPATH) -name SCCS -prune -o -follow -name \*.h ! -name modversions.h -print` > $@ + .hdepend: scripts/mkdep include/linux/version.h include/asm \ $(if $(filter dep depend,$(MAKECMDGOALS)),FORCE) - scripts/mkdep -- `find $(FINDHPATH) -name SCCS -prune -o -follow -name \*.h ! -name modversions.h -print` > $@ + $(call cmd,cmd_depend) @$(MAKE) $(patsubst %,_sfdep_%,$(SUBDIRS)) ifdef CONFIG_MODVERSIONS @$(MAKE) include/linux/modversions.h @@ -549,7 +589,7 @@ MRPROPER_FILES += \ include/asm \ .hdepend scripts/mkdep scripts/split-include scripts/docproc \ $(TOPDIR)/include/linux/modversions.h \ - kernel.spec + tags TAGS kernel.spec \ # directories removed with 'make mrproper' MRPROPER_DIRS += \ @@ -561,23 +601,27 @@ MRPROPER_DIRS += \ include arch/$(ARCH)/Makefile clean: archclean - find . \( -name '*.[oas]' -o -name core -o -name '.*.cmd' \) -type f -print \ + @echo 'Cleaning up' + @find . \( -name \*.[oas] -o -name core -o -name .\*.cmd \) -type f -print \ | grep -v lxdialog/ | xargs rm -f - rm -f $(CLEAN_FILES) - rm -rf $(CLEAN_DIRS) + @rm -f $(CLEAN_FILES) + @rm -rf $(CLEAN_DIRS) @$(MAKE) -C Documentation/DocBook clean mrproper: clean archmrproper - find . \( -size 0 -o -name .depend \) -type f -print | xargs rm -f - rm -f $(MRPROPER_FILES) - rm -rf $(MRPROPER_DIRS) + @echo 'Making mrproper' + @find . \( -size 0 -o -name .depend \) -type f -print | xargs rm -f + @rm -f $(MRPROPER_FILES) + @rm -rf $(MRPROPER_DIRS) @$(MAKE) -C Documentation/DocBook mrproper distclean: mrproper - rm -f core `find . \( -not -type d \) -and \ - \( -name '*.orig' -o -name '*.rej' -o -name '*~' \ + @echo 'Making distclean' + @find . \( -not -type d \) -and \ + \( -name '*.orig' -o -name '*.rej' -o -name '*~' \ -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \ - -o -name '.*.rej' -o -name '.SUMS' -o -size 0 \) -type f -print` TAGS tags + -o -name '.*.rej' -o -name '.SUMS' -o -size 0 \) -type f \ + -print | xargs rm -f endif # ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),) @@ -600,4 +644,9 @@ if_changed_rule = $(if $(strip $? \ $(filter-out $(cmd_$(@F)),$(cmd_$(1)))),\ @$(rule_$(1))) +# If quiet is set, only print short version of rule + +cmd = @$(if $($(quiet)$(1)),echo ' $($(quiet)$(1))' &&) $($(1)) + + FORCE: diff --git a/Rules.make b/Rules.make index 03b28bb1ddff..a87d7e57e950 100644 --- a/Rules.make +++ b/Rules.make @@ -86,15 +86,12 @@ subdir-obj-y := $(foreach o,$(obj-y),$(if $(filter-out $(o),$(notdir $(o))),$(o) real-objs-y := $(foreach m, $(filter-out $(subdir-obj-y), $(obj-y)), $(if $($(m:.o=-objs)),$($(m:.o=-objs)),$(m))) $(EXTRA_TARGETS) real-objs-m := $(foreach m, $(obj-m), $(if $($(m:.o=-objs)),$($(m:.o=-objs)),$(m))) -# ========================================================================== -# # Get things started. -# -first_rule: vmlinux $(if $(BUILD_MODULES),$(obj-m)) +# ========================================================================== -# -# Common rules -# +# The echo suppresses the "Nothing to be done for first_rule" +first_rule: vmlinux $(if $(BUILD_MODULES),$(obj-m)) + @echo -n # Compile C sources (.c) # --------------------------------------------------------------------------- @@ -117,17 +114,20 @@ $(export-objs:.o=.s): export_flags := $(EXPORT_FLAGS) c_flags = $(CFLAGS) $(modkern_cflags) $(EXTRA_CFLAGS) $(CFLAGS_$(*F).o) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) $(export_flags) -cmd_cc_s_c = $(CC) $(c_flags) -S -o $@ $< +quiet_cmd_cc_s_c = CC $(RELDIR)/$@ +cmd_cc_s_c = $(CC) $(c_flags) -S -o $@ $< %.s: %.c FORCE $(call if_changed,cmd_cc_s_c) -cmd_cc_i_c = $(CPP) $(c_flags) -o $@ $< +quiet_cmd_cc_i_c = CPP $(RELDIR)/$@ +cmd_cc_i_c = $(CPP) $(c_flags) -o $@ $< %.i: %.c FORCE $(call if_changed,cmd_cc_i_c) -cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< +quiet_cmd_cc_o_c = CC $(RELDIR)/$@ +cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< %.o: %.c FORCE $(call if_changed,cmd_cc_o_c) @@ -146,12 +146,14 @@ $(real-objs-m:.o=.s): modkern_aflags := $(AFLAGS_MODULE) a_flags = $(AFLAGS) $(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o) -cmd_as_s_S = $(CPP) $(a_flags) -o $@ $< +quiet_cmd_as_s_S = CPP $(RELDIR)/$@ +cmd_as_s_S = $(CPP) $(a_flags) -o $@ $< %.s: %.S FORCE $(call if_changed,cmd_as_s_S) -cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $< +quiet_cmd_as_o_S = AS $(RELDIR)/$@ +cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $< %.o: %.S FORCE $(call if_changed,cmd_as_o_S) @@ -184,6 +186,7 @@ $(sort $(subdir-obj-y)): sub_dirs ; # Rule to compile a set of .o files into one .o file # ifdef O_TARGET +quiet_cmd_link_o_target = LD $(RELDIR)/$@ # If the list of objects to link is empty, just create an empty O_TARGET cmd_link_o_target = $(if $(strip $(obj-y)),\ $(LD) $(EXTRA_LDFLAGS) -r -o $@ $(filter $(obj-y), $^),\ @@ -197,6 +200,7 @@ endif # O_TARGET # Rule to compile a set of .o files into one .a file # ifdef L_TARGET +quiet_cmd_link_l_target = AR $(RELDIR)/$@ cmd_link_l_target = rm -f $@; $(AR) $(EXTRA_ARFLAGS) rcs $@ $(obj-y) $(L_TARGET): $(obj-y) FORCE @@ -207,7 +211,7 @@ endif # Rule to link composite objects # - +quiet_cmd_link_multi = LD $(RELDIR)/$@ cmd_link_multi = $(LD) $(EXTRA_LDFLAGS) -r -o $@ $(filter $($(basename $@)-objs),$^) # We would rather have a list of rules like @@ -223,10 +227,14 @@ $(multi-used-m) : %.o: $(multi-objs-m) FORCE # # This make dependencies quickly # + +quiet_cmd_fastdep = Making dependencies ($(RELDIR)) +cmd_fastdep = $(TOPDIR)/scripts/mkdep $(CFLAGS) $(EXTRA_CFLAGS) -- $(wildcard *.[chS]) > .depend + fastdep: FORCE - $(TOPDIR)/scripts/mkdep $(CFLAGS) $(EXTRA_CFLAGS) -- $(wildcard *.[chS]) > .depend + $(call cmd,cmd_fastdep) ifdef ALL_SUB_DIRS - $(MAKE) $(patsubst %,_sfdep_%,$(ALL_SUB_DIRS)) _FASTDEP_ALL_SUB_DIRS="$(ALL_SUB_DIRS)" + @$(MAKE) $(patsubst %,_sfdep_%,$(ALL_SUB_DIRS)) _FASTDEP_ALL_SUB_DIRS="$(ALL_SUB_DIRS)" endif ifdef _FASTDEP_ALL_SUB_DIRS @@ -261,16 +269,19 @@ endif .PHONY: modules modules: $(obj-m) FORCE $(patsubst %,_modsubdir_%,$(MOD_SUB_DIRS)) + @echo -n .PHONY: _modinst__ _modinst__: FORCE ifneq "$(strip $(obj-m))" "" - mkdir -p $(MODLIB)/kernel/$(RELDIR) - cp $(obj-m) $(MODLIB)/kernel/$(RELDIR) + @echo Installing modules in $(MODLIB)/kernel/$(RELDIR) + @mkdir -p $(MODLIB)/kernel/$(RELDIR) + @cp $(obj-m) $(MODLIB)/kernel/$(RELDIR) endif .PHONY: modules_install modules_install: _modinst__ $(patsubst %,_modinst_%,$(MOD_SUB_DIRS)) + @echo -n # Add FORCE to the prequisites of a target to force it to be always rebuilt. @@ -395,4 +406,8 @@ endif if_changed = $(if $(strip $? \ $(filter-out $($(1)),$(cmd_$(@F)))\ $(filter-out $(cmd_$(@F)),$($(1)))),\ - @echo '$($(1))' && $($(1)) && echo 'cmd_$@ := $($(1))' > $(@D)/.$(@F).cmd) + @$(if $($(quiet)$(1)),echo ' $($(quiet)$(1))' &&) $($(1)) && echo 'cmd_$@ := $($(1))' > $(@D)/.$(@F).cmd) + +# If quiet is set, only print short version of command + +cmd = @$(if $($(quiet)$(1)),echo ' $($(quiet)$(1))' &&) $($(1)) diff --git a/init/Makefile b/init/Makefile index 5fc90741e578..bf5e11dc2ce9 100644 --- a/init/Makefile +++ b/init/Makefile @@ -22,5 +22,4 @@ $(TOPDIR)/include/linux/compile.h: ../include/linux/compile.h ; # actual file if its content has changed. ../include/linux/compile.h: FORCE - @echo Generating $@ @. ../scripts/mkcompile_h $@ "$(ARCH)" "$(CONFIG_SMP)" "$(CC) $(CFLAGS)" diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h index 7fc14334f04a..e18fc4f263e3 100644 --- a/scripts/mkcompile_h +++ b/scripts/mkcompile_h @@ -48,9 +48,10 @@ if [ -r $TARGET ] && \ grep -v 'UTS_VERSION\|LINUX_COMPILE_TIME' $TARGET > .tmpver.1 && \ grep -v 'UTS_VERSION\|LINUX_COMPILE_TIME' .tmpcompile > .tmpver.2 && \ cmp -s .tmpver.1 .tmpver.2; then - echo $TARGET is unchanged; + echo $TARGET was not updated; rm -f .tmpcompile else + echo $TARGET was updated mv -f .tmpcompile $TARGET fi rm -f .tmpver.1 .tmpver.2 diff --git a/scripts/mkversion_h b/scripts/mkversion_h index c8ceaee2fa8c..dd8c5eb6d7dd 100644 --- a/scripts/mkversion_h +++ b/scripts/mkversion_h @@ -17,8 +17,9 @@ SUBLEVEL=$5 if [ -r $TARGET ] && \ cmp -s $TARGET .tmpversion; then - echo $TARGET is unchanged; + echo $TARGET was not updated; rm -f .tmpversion else + echo $TARGET was updated; mv -f .tmpversion $TARGET fi |
