Commit 75d92366 authored by Simon Marlow's avatar Simon Marlow

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.
parent 6a1dd525
......@@ -153,6 +153,7 @@ endif
# -----------------------------------------------------------------------------
# Utility definitions
include rules/trace.mk
include rules/make-command.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)
......
......@@ -11,6 +11,7 @@
# -----------------------------------------------------------------------------
define build-package-data
$(call trace, build-package-data($1,$2,$3))
# args:
# $1 = dir
# $2 = distdir
......
......@@ -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)
......
......@@ -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)
......
......@@ -19,6 +19,7 @@
# $(eval $(call build-perl,driver/mangler,dist))
define build-perl
$(call trace, build-perl($1,$2))
# $1 = dir
# $2 = distdir
......
......@@ -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)
......
......@@ -14,6 +14,7 @@
# Build docbook docs
define docbook
$(call trace, docbook($1,$2))
# $1 = dir
# $2 = docname
......
......@@ -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
......@@ -12,6 +12,7 @@
define haddock # args: $1 = dir, $2 = distdir
$(call trace, haddock($1,$2))
ifneq "$$($1_$2_DO_HADDOCK)" "NO"
......
......@@ -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 \
......
......@@ -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)
......
......@@ -11,6 +11,7 @@
# -----------------------------------------------------------------------------
define shell-wrapper
$(call trace, shell-wrapper($1,$2))
# $1 = dir
# $2 = distdir
......
......@@ -18,6 +18,7 @@
# Uses the same metadata as build-package.
define tags-package
$(call trace, tags-package($1,$2))
# $1 = dir
# $2 = distdir
......
# -----------------------------------------------------------------------------
#
# (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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment