Just make C dependencies once, rather than each way
[ghc-hetmet.git] / rts / ghc.mk
index f973b67..aee3369 100644 (file)
@@ -18,6 +18,7 @@ rts_dist_HC = $(GHC_STAGE1)
 
 # merge GhcLibWays and GhcRTSWays but strip out duplicates
 rts_WAYS = $(GhcLibWays) $(filter-out $(GhcLibWays),$(GhcRTSWays))
+rts_dist_WAYS = $(rts_WAYS)
 
 ALL_RTS_LIBS = rts/dist/build/libHSrtsmain.a \
               $(foreach way,$(rts_WAYS),rts/dist/build/libHSrts$($(way)_libsuf))
@@ -69,6 +70,11 @@ rts/dist/build/sm/Scav_thr.c : rts/sm/Scav.c | $$(dir $$@)/.
 
 rts_H_FILES = $(wildcard includes/*.h) $(wildcard rts/*.h)
 
+ifeq "$(HaveDtrace)" "YES"
+DTRACEPROBES_H = rts/dist/build/RtsProbes.h
+rts_H_FILES += $(DTRACEPROBES_H)
+endif
+
 # collect the -l flags that we need to link the rts dyn lib.
 rts/libs.depend : $(GHC_PKG_INPLACE)
        "$(GHC_PKG_INPLACE)" field rts extra-libraries \
@@ -321,8 +327,8 @@ rts/dist/build/sm/Evac_thr_HC_OPTS += -optc-funroll-loops
 
 # These files are just copies of sm/Evac.c and sm/Scav.c respectively,
 # but compiled with -DPARALLEL_GC.
-rts/dist/build/sm/Evac_thr_HC_OPTS += -optc-DPARALLEL_GC -Irts/sm
-rts/dist/build/sm/Scav_thr_HC_OPTS += -optc-DPARALLEL_GC -Irts/sm
+rts/dist/build/sm/Evac_thr_CC_OPTS += -DPARALLEL_GC -Irts/sm
+rts/dist/build/sm/Scav_thr_CC_OPTS += -DPARALLEL_GC -Irts/sm
 
 #-----------------------------------------------------------------------------
 # Add PAPI library if needed
@@ -354,23 +360,29 @@ endif
 # -----------------------------------------------------------------------------
 # dependencies
 
-# Hack: we define every way-related option here, so that we get (hopefully)
-# a superset of the dependencies.  To do this properly, we should generate
-# a different set of dependencies for each way.  Further hack: PROFILING and
-# TICKY_TICKY can't be used together, so we omit TICKY_TICKY for now.
-rts_MKDEPENDC_OPTS += -DPROFILING -DTHREADED_RTS -DDEBUG
-rts_MKDEPENDC_OPTS += -Irts/sm
-
 rts_WAYS_DASHED = $(subst $(space),,$(patsubst %,-%,$(strip $(rts_WAYS))))
-rts_dist_depfile = rts/dist/build/.depend$(rts_WAYS_DASHED)
+rts_dist_depfile_base = rts/dist/build/.depend$(rts_WAYS_DASHED)
 
 rts_dist_C_SRCS  = $(rts_C_SRCS) $(rts_thr_EXTRA_C_SRCS)
 rts_dist_S_SRCS =  $(rts_S_SRCS)
 rts_dist_C_FILES = $(rts_C_SRCS) $(rts_thr_EXTRA_C_SRCS) $(rts_S_SRCS)
 
+# Hack: we define every way-related option here, so that we get (hopefully)
+# a superset of the dependencies.  To do this properly, we should generate
+# a different set of dependencies for each way.  Further hack: PROFILING an
+
+# TICKY_TICKY can't be used together, so we omit TICKY_TICKY for now.
+rts_dist_MKDEPENDC_OPTS += -DPROFILING -DTHREADED_RTS -DDEBUG
+
+ifeq "$(HaveDtrace)" "YES"
+
+rts_dist_MKDEPENDC_OPTS += -Irts/dist/build
+
+endif
+
 $(eval $(call build-dependencies,rts,dist))
 
-$(rts_dist_depfile) : libffi/dist-install/build/ffi.h
+$(rts_dist_depfile_c_asm) : libffi/dist-install/build/ffi.h $(DTRACEPROBES_H)
 
 #-----------------------------------------------------------------------------
 # libffi stuff
@@ -389,6 +401,20 @@ $(DYNWRAPPER_PROG): $(DYNWRAPPER_SRC)
        "$(HC)" -cpp -optc-include -optcdyn-wrapper-patchable-behaviour.h $(INPLACE_EXTRA_FLAGS) $< -o $@
 
 # -----------------------------------------------------------------------------
+# compile dtrace probes if dtrace is supported
+
+ifeq "$(HaveDtrace)" "YES"
+
+rts_CC_OPTS            += -DDTRACE
+rts_HC_OPTS            += -DDTRACE
+
+DTRACEPROBES_SRC = rts/RtsProbes.d
+$(DTRACEPROBES_H): $(DTRACEPROBES_SRC) | $(dir $@)/.
+       "$(DTRACE)" $(filter -I%,$(rts_CC_OPTS)) -C -h -o $@ -s $<
+
+endif
+
+# -----------------------------------------------------------------------------
 # build the static lib containing the C main symbol
 
 rts/dist/build/libHSrtsmain.a : rts/dist/build/Main.o