# -----------------------------------------------------------------------------
# Utility definitions
+include rules/prof.mk
include rules/trace.mk
include rules/make-command.mk
define build-dependencies
$(call trace, build-dependencies($1,$2,$3))
+$(call profStart, build-dependencies($1,$2,$3))
# $1 = dir
# $2 = distdir
# $3 = GHC stage to use (0 == bootstrapping compiler)
# Note sed magic above: mkdependC can't do -odir stuff, so we have to
# munge the dependencies it generates to refer to the correct targets.
+$(call profEnd, build-dependencies($1,$2,$3))
endef
# This comment is outside the "define addCFileDeps" as that definition
define build-package-data
$(call trace, build-package-data($1,$2,$3))
+$(call profStart, build-package-data($1,$2,$3))
# args:
# $1 = dir
# $2 = distdir
PACKAGE_DATA_MKS += $1/$2/package-data.mk
+$(call profEnd, build-package-data($1,$2,$3))
endef
define build-package-way # $1 = dir, $2 = distdir, $3 = way, $4 = stage
$(call trace, build-package-way($1,$2,$3))
+$(call profStart, build-package-way($1,$2,$3))
$(call distdir-way-opts,$1,$2,$3,$4)
$(call hs-suffix-rules,$1,$2,$3)
endif
endif
+$(call profEnd, build-package-way($1,$2,$3))
endef
define build-package
$(call trace, build-package($1,$2,$3))
+$(call profStart, build-package($1,$2,$3))
# $1 = dir
# $2 = distdir
# $3 = GHC stage to use (0 == bootstrapping compiler)
ifneq "$$($1_$2_NOT_NEEDED)" "YES"
$$(eval $$(call build-package-helper,$1,$2,$3))
endif
+$(call profEnd, build-package($1,$2,$3))
endef
define build-perl
$(call trace, build-perl($1,$2))
+$(call profStart, build-perl($1,$2))
# $1 = dir
# $2 = distdir
endif
endif
+$(call profEnd, build-perl($1,$2))
endef
define build-prog
$(call trace, build-prog($1,$2,$3))
+$(call profStart, build-prog($1,$2,$3))
# $1 = dir
# $2 = distdir
# $3 = GHC stage to use (0 == bootstrapping compiler)
ifneq "$$($1_$2_NOT_NEEDED)" "YES"
$$(eval $$(call build-prog-helper,$1,$2,$3))
endif
+$(call profEnd, build-prog($1,$2,$3))
endef
define docbook
$(call trace, docbook($1,$2))
+$(call profStart, docbook($1,$2))
# $1 = dir
# $2 = docname
[ -f $$@ ]
endif
+$(call profEnd, docbook($1,$2))
endef
define haddock # args: $1 = dir, $2 = distdir
$(call trace, haddock($1,$2))
+$(call profStart, haddock($1,$2))
ifneq "$$($1_$2_DO_HADDOCK)" "NO"
endif
+$(call profEnd, haddock($1,$2))
endef
define include-dependencies
$(call trace, include-dependencies($1,$2,$3))
+$(call profStart, include-dependencies($1,$2,$3))
# $1 = dir
# $2 = distdir
# $3 = GHC stage to use (0 == bootstrapping compiler)
endif
endif
+$(call profEnd, include-dependencies($1,$2,$3))
endef
define manual-package-config # args: $1 = dir
$(call trace, manual-package-config($1))
+$(call profStart, manual-package-config($1))
$1/package.conf.inplace : $1/package.conf.in $(GHC_PKG_INPLACE)
$$(CPP) $$(RAWCPP_FLAGS) -P \
clean_$1_package.conf :
"$$(RM)" $$(RM_OPTS) $1/package.conf.install $1/package.conf.inplace
+$(call profEnd, manual-package-config($1))
endef
define package-config # args: $1 = dir, $2 = distdir, $3 = GHC stage
$(call trace, package-config($1,$2,$3))
+$(call profStart, package-config($1,$2,$3))
$1_$2_HC = $$(GHC_STAGE$3)
# Useful later
$1_$2_SLASH_MODS = $$(subst .,/,$$($1_$2_MODULES))
+$(call profEnd, package-config($1,$2,$3))
endef
--- /dev/null
+# -----------------------------------------------------------------------------
+#
+# (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
+#
+# -----------------------------------------------------------------------------
+
+define profStart
+$$(if $(PROF),$$(info $$(shell date +%s.%N): Start $1))
+endef
+
+define profEnd
+$$(if $(PROF),$$(info $$(shell date +%s.%N): End $1))
+endef
+
define shell-wrapper
$(call trace, shell-wrapper($1,$2))
+$(call profStart, shell-wrapper($1,$2))
# $1 = dir
# $2 = distdir
endif # $1_$2_SHELL_WRAPPER
+$(call profEnd, shell-wrapper($1,$2))
endef
define tags-package
$(call trace, tags-package($1,$2))
+$(call profStart, tags-package($1,$2))
# $1 = dir
# $2 = distdir
TAGS_$1:
inplace/bin/ghctags --topdir $$(TOP)/inplace/lib -e --use-cabal-config $1/$2 -- $$($1_$2_TAGS_HC_OPTS) $$($1_$2_v_ALL_HC_OPTS) -- $$($1_$2_HS_SRCS)
+$(call profEnd, tags-package($1,$2))
endef