Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add a simple trace facility to the build system

saying

  make TRACE=1

prints most of the macro calls and their arguments.  It's easy to
trace new macros; see rules/trace.mk.
  • Loading branch information...
commit 75d9236613acdcfa54deb81b12bd4546c31e7c9f 1 parent 6a1dd52
@simonmar simonmar authored
View
1  ghc.mk
@@ -153,6 +153,7 @@ endif
# -----------------------------------------------------------------------------
# Utility definitions
+include rules/trace.mk
include rules/make-command.mk
# -----------------------------------------------------------------------------
View
1  rules/build-dependencies.mk
@@ -11,6 +11,7 @@
# -----------------------------------------------------------------------------
define build-dependencies
+$(call trace, build-dependencies($1,$2,$3))
# $1 = dir
# $2 = distdir
# $3 = GHC stage to use (0 == bootstrapping compiler)
View
1  rules/build-package-data.mk
@@ -11,6 +11,7 @@
# -----------------------------------------------------------------------------
define build-package-data
+$(call trace, build-package-data($1,$2,$3))
# args:
# $1 = dir
# $2 = distdir
View
1  rules/build-package-way.mk
@@ -12,6 +12,7 @@
define build-package-way # $1 = dir, $2 = distdir, $3 = way, $4 = stage
+$(call trace, build-package-way($1,$2,$3))
$(call distdir-way-opts,$1,$2,$3,$4)
$(call hs-suffix-rules,$1,$2,$3)
View
1  rules/build-package.mk
@@ -29,6 +29,7 @@
# libraries/base_dist_LD_OPTS = -package ghc-prim-0.1.0.0
define build-package
+$(call trace, build-package($1,$2,$3))
# $1 = dir
# $2 = distdir
# $3 = GHC stage to use (0 == bootstrapping compiler)
View
1  rules/build-perl.mk
@@ -19,6 +19,7 @@
# $(eval $(call build-perl,driver/mangler,dist))
define build-perl
+$(call trace, build-perl($1,$2))
# $1 = dir
# $2 = distdir
View
1  rules/build-prog.mk
@@ -20,6 +20,7 @@
# $(eval $(call build-prog,utils/genapply,dist-install,1))
define build-prog
+$(call trace, build-prog($1,$2,$3))
# $1 = dir
# $2 = distdir
# $3 = GHC stage to use (0 == bootstrapping compiler)
View
1  rules/docbook.mk
@@ -14,6 +14,7 @@
# Build docbook docs
define docbook
+$(call trace, docbook($1,$2))
# $1 = dir
# $2 = docname
View
4 rules/extra-packages.mk
@@ -36,11 +36,13 @@ $$(foreach p,$$(patsubst libraries/%,%,$$(wildcard $$(shell grep '^[^ ]\+ \+\(dp
endef
define extra-package # $1 = package root, $2 = package
+$(call trace, extra-package($1,$2))
+
EXTRA_PACKAGES += $2
ifeq "$(wildcard libraries/$1/ghc-stage2-package)" ""
$$(eval $$(call addPackage,$2))
else
$$(eval $$(call addPackage2,$2))
endif
-endef
+endef
View
1  rules/haddock.mk
@@ -12,6 +12,7 @@
define haddock # args: $1 = dir, $2 = distdir
+$(call trace, haddock($1,$2))
ifneq "$$($1_$2_DO_HADDOCK)" "NO"
View
1  rules/manual-package-config.mk
@@ -12,6 +12,7 @@
define manual-package-config # args: $1 = dir
+$(call trace, manual-package-config($1))
$1/package.conf.inplace : $1/package.conf.in $(GHC_PKG_INPLACE)
$$(CPP) $$(RAWCPP_FLAGS) -P \
View
1  rules/package-config.mk
@@ -12,6 +12,7 @@
define package-config # args: $1 = dir, $2 = distdir, $3 = GHC stage
+$(call trace, package-config($1,$2,$3))
$1_$2_HC = $$(GHC_STAGE$3)
View
1  rules/shell-wrapper.mk
@@ -11,6 +11,7 @@
# -----------------------------------------------------------------------------
define shell-wrapper
+$(call trace, shell-wrapper($1,$2))
# $1 = dir
# $2 = distdir
View
1  rules/tags-package.mk
@@ -18,6 +18,7 @@
# Uses the same metadata as build-package.
define tags-package
+$(call trace, tags-package($1,$2))
# $1 = dir
# $2 = distdir
View
21 rules/trace.mk
@@ -0,0 +1,21 @@
+# -----------------------------------------------------------------------------
+#
+# (c) 2010 The University of Glasgow
+#
+# This file is part of the GHC build system.
+#
+# To understand how the build system works and how to modify it, see
+# http://hackage.haskell.org/trac/ghc/wiki/Building/Architecture
+# http://hackage.haskell.org/trac/ghc/wiki/Building/Modifying
+#
+# -----------------------------------------------------------------------------
+
+# A helpful little debug macro. Call it from a macro like this:
+#
+# $(call trace, this-macro($1,$2,$3))
+#
+# And invoke the build system with TRACE=1 to turn on tracing.
+
+define trace
+$$(if $(TRACE),$$(warning $1),)
+endef
Please sign in to comment.
Something went wrong with that request. Please try again.