Define more constant values.
makefiles/consts.mk
-------------------
o Define constant values (make macros) for tab-stop and newline.
o Document intent and usage for a few already-defined constants:
+ HIDE=
+ env-clean=
+ xargs-*=
Change-Id: I7bcc4622f5011f861e45f73ab2663f761fb85e16
diff --git a/makefiles/consts.mk b/makefiles/consts.mk
index f1f717f..21f9fbc 100644
--- a/makefiles/consts.mk
+++ b/makefiles/consts.mk
@@ -30,11 +30,62 @@
export quote-single := $(null)'$(null)#'
export quote-double := $(null)"$(null)#"
-# [DEBUG] make {target} HIDE=
+## -----------------------------
+## Macro definition for tab stop
+## Usage:
+## o $(info white$(\t)space
+## o @echo "white$(tab)space"
+## -----------------------------
+\t := $(NULL) $(NULL)
+tab := $(\t)
+
+## -----------------------------------------------
+## Macro definition for newline
+## Usage:
+## - Format output:
+## $(info two$(crlf)lines)
+## - Generate dynamic makefile rules:
+## $(eval mytarget:$(newline)$(tab)echo FOO)
+## -----------------------------------------------
+define crlf :=
+
+
+endef
+newline := $(crlf)
+
+# ------------------------------------------------------
+# [DEBUG] - Define HIDE=<null> to display shell commands
+# ------------------------------------------------------
+# Target rule definition:
+# show:
+# <tab>$(HIDE)echo "Display rule when HIDE != '@'
+# ------------------------------------------------------
+# Usage: make show HIDE=
+# ------------------------------------------------------
HIDE ?= @
+# -----------------------------------------------------------------------
+# Intent: Define a prefix macro for shell commands that will inhibit
+# loading user defined environment vars (consistent command use w/o
+# potential for per-user tainting of command behavior).
+# -----------------------------------------------------------------------
+# Target usage:
+# mytarget:
+# <tab>$(env-clean) ls
+# -----------------------------------------------------------------------
env-clean ?= /usr/bin/env --ignore-environment
+# -----------------------------------------------------------------------
+# Intent: Define convenience xargs macros to shorten target command lines
+# -----------------------------------------------------------------------
+# Target usage:
+# mytarget:
+# <tab>$(env-clean) ls
+# -----------------------------------------------------------------------
+# Usage:
+# lint-shell:
+# <tab>find . -name '*.sh' -print0 | $(xargs-n1-clean) shellcheck $(args)
+# -----------------------------------------------------------------------
xargs-cmd := xargs -0 -t --no-run-if-empty
xargs-n1 := $(xargs-cmd) -n1
xargs-n1-clean := $(env-clean) $(xargs-n1)