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 \
$(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
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"