From c7ec30256e47ed749d2a280805afe605c0e56453 Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Sat, 14 Jan 2012 01:07:21 +0100 Subject: [PATCH] Add a Makefile target for profiling targets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This simplifies the building of profiling-enabled htools binaries; there are two targets, one used for the initial two-stage build, and one that can be used for incremental builds. The patch adds a new internal variable for the htools/test binary, which should also simplify custom builds for the non-profiling targets. Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: RenΓ© Nussbaumer <rn@google.com> --- Makefile.am | 20 ++++++++++++++++++-- doc/devnotes.rst | 3 ++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index 759f71719..5dfa489f5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -354,6 +354,8 @@ HS_PROG_SRCS = $(patsubst %,%.hs,$(HS_ALL_PROGS)) HFLAGS = -O -Wall -fwarn-monomorphism-restriction -fwarn-tabs -ihtools # extra flags that can be overriden on the command line HEXTRA = +# internal extra flags (used for htools/test mainly) +HEXTRA_INT = # exclude options for coverage reports HPCEXCL = --exclude Main \ --exclude Ganeti.Constants \ @@ -512,13 +514,27 @@ $(HS_ALL_PROGS): %: %.hs $(HS_LIB_SRCS) $(HS_BUILT_SRCS) Makefile $(HFLAGS) \ $(HTOOLS_NOCURL) $(HTOOLS_PARALLEL3) \ -osuf $$BINARY.o -hisuf $$BINARY.hi \ - $(HEXTRA) $@ + $(HEXTRA) $(HEXTRA_INT) $@ # for the htools/test binary, we need to enable profiling/coverage -htools/test: HEXTRA=-fhpc -Wwarn -fno-warn-missing-signatures \ +htools/test: HEXTRA_INT=-fhpc -Wwarn -fno-warn-missing-signatures \ -fno-warn-monomorphism-restriction -fno-warn-orphans \ -fno-warn-missing-methods -fno-warn-unused-imports +# rules for building profiling-enabled versions of the haskell +# programs: hs-prof does the full two-step build, whereas +# hs-prof-quick does only the final rebuild (hs-prof must have been +# run before) +.PHONY: hs-prof hs-prof-quick +hs-prof: + $(MAKE) clean + $(MAKE) $(HS_ALL_PROGS) HEXTRA="-osuf .o" + rm -f $(HS_ALL_PROGS) + $(MAKE) hs-prof-quick + +hs-prof-quick: + $(MAKE) $(HS_ALL_PROGS) HEXTRA="-osuf .prof_o -prof -auto-all" + dist_sbin_SCRIPTS = \ tools/ganeti-listrunner diff --git a/doc/devnotes.rst b/doc/devnotes.rst index 2d2a2cf18..2fcc7d860 100644 --- a/doc/devnotes.rst +++ b/doc/devnotes.rst @@ -81,7 +81,8 @@ what the splices are converted to. This can be done via:: make HEXTRA="-ddump-splices" Due to the way TemplateHaskell works, it's not straightforward to -build profiling code. The recommended way is:: +build profiling code. The recommended way is to run ``make hs-prof``, +or alternatively the manual sequence is:: make clean make htools/htools HEXTRA="-osuf .o" -- GitLab