Add an echo target to the build system
authorIan Lynagh <ian@well-typed.com>
Fri, 24 May 2013 16:31:35 +0000 (17:31 +0100)
committerIan Lynagh <ian@well-typed.com>
Sat, 25 May 2013 18:17:29 +0000 (19:17 +0100)
Makefile
ghc.mk

index 912af1f..a2cea2c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -45,7 +45,7 @@ endif
 include mk/custom-settings.mk
 
 # No need to update makefiles for these targets:
-REALGOALS=$(filter-out binary-dist binary-dist-prep bootstrapping-files framework-pkg clean clean_% distclean maintainer-clean show help test fulltest,$(MAKECMDGOALS))
+REALGOALS=$(filter-out binary-dist binary-dist-prep bootstrapping-files framework-pkg clean clean_% distclean maintainer-clean show echo help test fulltest,$(MAKECMDGOALS))
 
 # configure touches certain files even if they haven't changed.  This
 # can mean a lot of unnecessary recompilation after a re-configure, so
@@ -93,7 +93,7 @@ clean distclean maintainer-clean:
 $(filter clean_%, $(MAKECMDGOALS)) : clean_% :
        $(MAKE) -r --no-print-directory -f ghc.mk $@ CLEANING=YES
 
-bootstrapping-files show:
+bootstrapping-files show echo:
        $(MAKE) -r --no-print-directory -f ghc.mk $@
 
 ifeq "$(darwin_TARGET_OS)" "1"
diff --git a/ghc.mk b/ghc.mk
index 7b66cfd..ad0a381 100644 (file)
--- a/ghc.mk
+++ b/ghc.mk
@@ -110,6 +110,14 @@ comma=,
 show:
        @echo '$(VALUE)="$($(VALUE))"'
 
+# echo is used by the nightly builders to query the build system for
+# information.
+# Using printf means that we don't get a trailing newline. We escape
+# backslashes and double quotes in the string to protect them from the
+# shell, and percent signs to protect them from printf.
+echo:
+       @printf "$(subst %,%%,$(subst ",\",$(subst \,\\\\,$($(VALUE)))))"
+
 # -----------------------------------------------------------------------------
 # Include subsidiary build-system bits