Commit c7ec3025 authored by Iustin Pop's avatar Iustin Pop

Add a Makefile target for profiling targets

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: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
parent 893e8f49
......@@ -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
......
......@@ -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"
......
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