From 675f65b75b27c899573b57f390fbeea42bc4ae89 Mon Sep 17 00:00:00 2001 From: Iustin Pop Date: Fri, 14 Dec 2012 20:39:18 +0100 Subject: [PATCH] Fix profiling targets As noted by Guido, there are problems when using the hs-prof and hs-prof-quick targets in the default configuration (compiling all programs). The errors manifest in the form of wrong symbols during compilation. I knew that the hs-prof targets, which compiled multiple objects with the '.o' suffix, could be problematic; but the objects that are actually needed in the Template Haskell phase are very standard and don't differ between the binaries (Constants, BasicTypes, JSON, THH). What I didn't realise (although it's obvious) is that also the hs_prof_quick targets (the final binaries) are also compiled with a single suffix ('.prof_o'), which means that the object files are actually compiled for the last binary. This means that targets later in the HS_ALL_PROGS list would work correct, but early targets, especially htools/htools, would fail. So the obvious, and the single simple solution is to make these two rules only work on a single binary at a time. This should be fine, since one is looking at a specific problem usually, and it has the advantage that the hs-prof step is much faster (since it wasn't buildable in parallel anyway). Thanks to Guido for finding and making the initial diagnose on this! Signed-off-by: Iustin Pop Reviewed-by: Guido Trotter --- Makefile.am | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index 49dd1e0..ba74e2f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -692,13 +692,21 @@ htest/offline-tests.sh: htest/hpc-htools htest/hpc-mon-collector # run before) .PHONY: hs-prof hs-prof-quick hs-prof: + @if [ -z "$(TARGET)" ]; then \ + echo "You need to define TARGET when running this rule" 1>&2; \ + exit 1; \ + fi $(MAKE) $(AM_MAKEFLAGS) clean - $(MAKE) $(AM_MAKEFLAGS) $(HS_ALL_PROGS) HEXTRA="-osuf o" + $(MAKE) $(AM_MAKEFLAGS) $(TARGET) HEXTRA="-osuf o" rm -f $(HS_ALL_PROGS) $(MAKE) $(AM_MAKEFLAGS) hs-prof-quick hs-prof-quick: - $(MAKE) $(AM_MAKEFLAGS) $(HS_ALL_PROGS) HEXTRA="-osuf prof_o -prof -auto-all" + @if [ -z "$(TARGET)" ]; then \ + echo "You need to define TARGET when running this rule" 1>&2; \ + exit 1; \ + fi + $(MAKE) $(AM_MAKEFLAGS) $(TARGET) HEXTRA="-osuf prof_o -prof -auto-all" dist_sbin_SCRIPTS = \ tools/ganeti-listrunner -- 1.7.10.4