remove suspicious whitespace-only lines
[ghc-hetmet.git] / rts / ghc.mk
index c3d7eb6..e71473d 100644 (file)
@@ -70,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 \
@@ -98,7 +103,7 @@ rts/dist/build/win32/libHS$1.def : rts/win32/libHS$1.def
                | sed "s/@LibVersion@/$$(libraries/$1_dist-install_VERSION)/" \
                | sed "s/@ProjectVersion@/$(ProjectVersion)/" \
                > rts/dist/build/win32/libHS$1.def
-               
+
 rts/dist/build/win32/libHS$1.dll.a : rts/dist/build/win32/libHS$1.def
        "$$(DLLTOOL)"   -d rts/dist/build/win32/libHS$1.def \
                        -l rts/dist/build/win32/libHS$1.dll.a
@@ -111,7 +116,7 @@ rts/dist/build/win32/libHSffi.def : rts/win32/libHSffi.def
        cat rts/win32/libHSffi.def \
                | sed "s/@ProjectVersion@/$(ProjectVersion)/" \
                > rts/dist/build/win32/libHSffi.def
-               
+
 rts/dist/build/win32/libHSffi.dll.a : rts/dist/build/win32/libHSffi.def
        "$(DLLTOOL)"    -d rts/dist/build/win32/libHSffi.def \
                        -l rts/dist/build/win32/libHSffi.dll.a
@@ -123,6 +128,8 @@ endif
 # Building one way
 define build-rts-way # args: $1 = way
 
+ifneq "$$(BINDIST)" "YES"
+
 # The per-way CC_OPTS
 ifneq "$$(findstring debug, $1)" ""
 rts_dist_$1_HC_OPTS =
@@ -155,12 +162,12 @@ rts_dist_$1_CC_OPTS += -DRtsWay=$$(DQ)rts_$1$$(DQ)
 
 # Making a shared library for the RTS.
 ifneq "$$(findstring dyn, $1)" ""
-ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
+ifeq "$$(HOSTPLATFORM)" "i386-unknown-mingw32"
 $$(rts_$1_LIB) : $$(rts_$1_OBJS) $$(ALL_RTS_DEF_LIBS) rts/libs.depend
        "$$(RM)" $$(RM_OPTS) $$@
        "$$(rts_dist_HC)" -shared -dynamic -dynload deploy \
          -no-auto-link-packages `cat rts/libs.depend` $$(rts_$1_OBJS) $$(ALL_RTS_DEF_LIBS) -o $$@
-ifeq "$(darwin_TARGET_OS)" "1"
+ifeq "$$(darwin_TARGET_OS)" "1"
        # Ensure library's install name is correct before anyone links with it.
        install_name_tool -id $(ghclibdir)/$$(rts_$1_LIB_NAME) $$@
 endif
@@ -176,6 +183,8 @@ $$(rts_$1_LIB) : $$(rts_$1_OBJS)
        echo $$(rts_$1_OBJS) | "$$(XARGS)" $$(XARGS_OPTS) "$$(AR)" $$(AR_OPTS) $$(EXTRA_AR_ARGS) $$@
 endif
 
+endif
+
 endef
 
 # And expand the above for each way:
@@ -362,9 +371,22 @@ 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_c_asm) : libffi/dist-install/build/ffi.h
+$(rts_dist_depfile_c_asm) : libffi/dist-install/build/ffi.h $(DTRACEPROBES_H)
 
 #-----------------------------------------------------------------------------
 # libffi stuff
@@ -383,10 +405,26 @@ $(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
 
+ifneq "$(BINDIST)" "YES"
 rts/dist/build/libHSrtsmain.a : rts/dist/build/Main.o
        "$(AR)" $(AR_OPTS) $(EXTRA_AR_ARGS) $@ $<
+endif
 
 # -----------------------------------------------------------------------------
 # The RTS package config
@@ -409,13 +447,7 @@ endif
 # -----------------------------------------------------------------------------
 # installing
 
-install : install_rts
-
-.PHONY: install_rts
-install_rts:
-       $(INSTALL_DIR) "$(DESTDIR)$(ghclibdir)"
-       $(INSTALL_DIR) "$(DESTDIR)$(ghclibdir)/include"
-       "$(CP)" $(ALL_RTS_LIBS) "$(DESTDIR)$(ghclibdir)"
+INSTALL_LIBS += $(ALL_RTS_LIBS)
 
 # -----------------------------------------------------------------------------
 # cleaning