Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
Simon Marlow simonmar authored
1  ghc.mk
@@ -153,6 +153,7 @@ endif
153 153 # -----------------------------------------------------------------------------
154 154 # Utility definitions
155 155
  156 +include rules/trace.mk
156 157 include rules/make-command.mk
157 158
158 159 # -----------------------------------------------------------------------------
1  rules/build-dependencies.mk
@@ -11,6 +11,7 @@
11 11 # -----------------------------------------------------------------------------
12 12
13 13 define build-dependencies
  14 +$(call trace, build-dependencies($1,$2,$3))
14 15 # $1 = dir
15 16 # $2 = distdir
16 17 # $3 = GHC stage to use (0 == bootstrapping compiler)
1  rules/build-package-data.mk
@@ -11,6 +11,7 @@
11 11 # -----------------------------------------------------------------------------
12 12
13 13 define build-package-data
  14 +$(call trace, build-package-data($1,$2,$3))
14 15 # args:
15 16 # $1 = dir
16 17 # $2 = distdir
1  rules/build-package-way.mk
@@ -12,6 +12,7 @@
12 12
13 13
14 14 define build-package-way # $1 = dir, $2 = distdir, $3 = way, $4 = stage
  15 +$(call trace, build-package-way($1,$2,$3))
15 16
16 17 $(call distdir-way-opts,$1,$2,$3,$4)
17 18 $(call hs-suffix-rules,$1,$2,$3)
1  rules/build-package.mk
@@ -29,6 +29,7 @@
29 29 # libraries/base_dist_LD_OPTS = -package ghc-prim-0.1.0.0
30 30
31 31 define build-package
  32 +$(call trace, build-package($1,$2,$3))
32 33 # $1 = dir
33 34 # $2 = distdir
34 35 # $3 = GHC stage to use (0 == bootstrapping compiler)
1  rules/build-perl.mk
@@ -19,6 +19,7 @@
19 19 # $(eval $(call build-perl,driver/mangler,dist))
20 20
21 21 define build-perl
  22 +$(call trace, build-perl($1,$2))
22 23 # $1 = dir
23 24 # $2 = distdir
24 25
1  rules/build-prog.mk
@@ -20,6 +20,7 @@
20 20 # $(eval $(call build-prog,utils/genapply,dist-install,1))
21 21
22 22 define build-prog
  23 +$(call trace, build-prog($1,$2,$3))
23 24 # $1 = dir
24 25 # $2 = distdir
25 26 # $3 = GHC stage to use (0 == bootstrapping compiler)
1  rules/docbook.mk
@@ -14,6 +14,7 @@
14 14 # Build docbook docs
15 15
16 16 define docbook
  17 +$(call trace, docbook($1,$2))
17 18 # $1 = dir
18 19 # $2 = docname
19 20
4 rules/extra-packages.mk
@@ -36,11 +36,13 @@ $$(foreach p,$$(patsubst libraries/%,%,$$(wildcard $$(shell grep '^[^ ]\+ \+\(dp
36 36 endef
37 37
38 38 define extra-package # $1 = package root, $2 = package
  39 +$(call trace, extra-package($1,$2))
  40 +
39 41 EXTRA_PACKAGES += $2
40 42 ifeq "$(wildcard libraries/$1/ghc-stage2-package)" ""
41 43 $$(eval $$(call addPackage,$2))
42 44 else
43 45 $$(eval $$(call addPackage2,$2))
44 46 endif
45   -endef
46 47
  48 +endef
1  rules/haddock.mk
@@ -12,6 +12,7 @@
12 12
13 13
14 14 define haddock # args: $1 = dir, $2 = distdir
  15 +$(call trace, haddock($1,$2))
15 16
16 17 ifneq "$$($1_$2_DO_HADDOCK)" "NO"
17 18
1  rules/manual-package-config.mk
@@ -12,6 +12,7 @@
12 12
13 13
14 14 define manual-package-config # args: $1 = dir
  15 +$(call trace, manual-package-config($1))
15 16
16 17 $1/package.conf.inplace : $1/package.conf.in $(GHC_PKG_INPLACE)
17 18 $$(CPP) $$(RAWCPP_FLAGS) -P \
1  rules/package-config.mk
@@ -12,6 +12,7 @@
12 12
13 13
14 14 define package-config # args: $1 = dir, $2 = distdir, $3 = GHC stage
  15 +$(call trace, package-config($1,$2,$3))
15 16
16 17 $1_$2_HC = $$(GHC_STAGE$3)
17 18
1  rules/shell-wrapper.mk
@@ -11,6 +11,7 @@
11 11 # -----------------------------------------------------------------------------
12 12
13 13 define shell-wrapper
  14 +$(call trace, shell-wrapper($1,$2))
14 15 # $1 = dir
15 16 # $2 = distdir
16 17
1  rules/tags-package.mk
@@ -18,6 +18,7 @@
18 18 # Uses the same metadata as build-package.
19 19
20 20 define tags-package
  21 +$(call trace, tags-package($1,$2))
21 22 # $1 = dir
22 23 # $2 = distdir
23 24
21 rules/trace.mk
... ... @@ -0,0 +1,21 @@
  1 +# -----------------------------------------------------------------------------
  2 +#
  3 +# (c) 2010 The University of Glasgow
  4 +#
  5 +# This file is part of the GHC build system.
  6 +#
  7 +# To understand how the build system works and how to modify it, see
  8 +# http://hackage.haskell.org/trac/ghc/wiki/Building/Architecture
  9 +# http://hackage.haskell.org/trac/ghc/wiki/Building/Modifying
  10 +#
  11 +# -----------------------------------------------------------------------------
  12 +
  13 +# A helpful little debug macro. Call it from a macro like this:
  14 +#
  15 +# $(call trace, this-macro($1,$2,$3))
  16 +#
  17 +# And invoke the build system with TRACE=1 to turn on tracing.
  18 +
  19 +define trace
  20 +$$(if $(TRACE),$$(warning $1),)
  21 +endef

0 comments on commit 75d9236

Please sign in to comment.
Something went wrong with that request. Please try again.