[PATCH] kbuild: Add new define do_cmd

Sam Ravnborg (sam@ravnborg.org)
Sun, 28 Jul 2002 15:02:00 +0200


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
+
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/