Generate stack usage information only when enabled

This will only generate the .su files when CONFIG_STACK_USAGE
is specified, otherwise the tree will be full of .su files.

Change-Id: I3ffc7a7f5ab09aaae49ff65e8ad5de0832370777
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
diff --git a/Makefile b/Makefile
index 21d303e..42b090d 100644
--- a/Makefile
+++ b/Makefile
@@ -675,7 +675,9 @@
 
 # generate an extra file that specifies the maximum amount of stack used,
 # on a per-function basis.
+ifdef CONFIG_STACK_USAGE
 KBUILD_CFLAGS	+= $(call cc-option,-fstack-usage)
+endif
 
 
 # disallow errors like 'EXPORT_GPL(foo);' with missing header
diff --git a/misc/Kconfig b/misc/Kconfig
index 49510e6..01eb707 100644
--- a/misc/Kconfig
+++ b/misc/Kconfig
@@ -141,6 +141,13 @@
 	only disables optimization, more debugging variants can be selected
 	from here to allow more debugging.
 
+config STACK_USAGE
+	bool "Generate stack usage information"
+	default n
+	help
+	Generate  an extra file that specifies the maximum amount of stack used,
+	on a per-function basis.
+
 config PRINTK
 	bool
 	prompt "Send printk() to console"