mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] kbuild: Add new define do_cmd
@ 2002-07-28 13:02 Sam Ravnborg
  0 siblings, 0 replies; only message in thread
From: Sam Ravnborg @ 2002-07-28 13:02 UTC (permalink / raw)
  To: Kai Germaschewski, torvlads; +Cc: linux-kernel

While cleaning up the docbook makefile I missed a possibility
to adhere to KBUILD_VERBOSE. To do this I have now implemented
do_cmd in rules.make, for more general usage.

	Sam

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.477   -> 1.478  
#	          Rules.make	1.67    -> 1.68   
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/07/28	sam@mars.ravnborg.org	1.478
# [PATCH] kbuild: Add new define do_cmd
# do_cmd is a nice shorthand when creating rules that in one line
# shall adhere to KBUILD_VERBOSE and make -s.
# So far the only user is the docbook makefile
# --------------------------------------------
#
diff -Nru a/Rules.make b/Rules.make
--- a/Rules.make	Sun Jul 28 12:48:13 2002
+++ b/Rules.make	Sun Jul 28 12:48:13 2002
@@ -553,3 +553,22 @@
 # If quiet is set, only print short version of command
 
 cmd = @$(if $($(quiet)cmd_$(1)),echo '  $($(quiet)cmd_$(1))' &&) $(cmd_$(1))
+
+# do_cmd is a shorthand used to support both compressed, verbose
+# and silent output in a single line.
+# Compared to cmd described avobe, do_cmd does no rely on any variables 
+# previously assigned a value.
+#
+# Usage $(call do_cmd,CMD   $@,cmd_to_execute bla bla)
+# Example:
+# $(call do_cmd,CP $@,cp -b $< $@)
+# make -s => nothing will be printed
+# make KBUILD_VERBOSE=1 => cp -b path/to/src.file path/to/dest.file
+# make KBUILD_VERBOSE=0 =>   CP path/to/dest.file
+define do_cmd
+        @$(if $(filter quiet_,$(quiet)), echo '  $(1)' &&,
+           $(if $(filter silent_,$(quiet)),,
+             echo "$(2)" &&)) \
+        $(2)
+endef
+

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-07-28 12:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-28 13:02 [PATCH] kbuild: Add new define do_cmd Sam Ravnborg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®