1 # -----------------------------------------------------------------------------
3 # (c) 2009 The University of Glasgow
5 # This file is part of the GHC build system.
7 # To understand how the build system works and how to modify it, see
8 # http://hackage.haskell.org/trac/ghc/wiki/Building/Architecture
9 # http://hackage.haskell.org/trac/ghc/wiki/Building/Modifying
11 # -----------------------------------------------------------------------------
13 # -----------------------------------------------------------------------------
16 # We build the RTS with stage 1
17 rts_dist_HC
= $(GHC_STAGE1
)
19 # merge GhcLibWays and GhcRTSWays but strip out duplicates
20 rts_WAYS
= $(GhcLibWays
) $(filter-out $(GhcLibWays
),$(GhcRTSWays
))
21 rts_dist_WAYS
= $(rts_WAYS
)
23 ALL_RTS_LIBS
= $(foreach way
,$(rts_WAYS
),rts
/dist/build
/libHSrts
$($(way
)_libsuf
))
24 all_rts
: $(ALL_RTS_LIBS
)
26 # -----------------------------------------------------------------------------
27 # Defining the sources
29 ALL_DIRS
= hooks parallel sm eventlog
31 ifeq "$(HostOS_CPP)" "mingw32"
38 EXCLUDED_SRCS
+= rts
/parallel
/SysMan.c
39 EXCLUDED_SRCS
+= $(wildcard rts
/Vis
*.c
)
41 rts_C_SRCS
:= $(filter-out $(EXCLUDED_SRCS
),$(wildcard rts
/*.c
$(foreach dir,$(ALL_DIRS
),rts
/$(dir)/*.c
)))
42 rts_CMM_SRCS
:= $(wildcard rts
/*.cmm
)
44 # Don't compile .S files when bootstrapping a new arch
45 ifneq "$(PORTING_HOST)" "YES"
46 ifneq "$(findstring $(TargetArch_CPP), i386 powerpc powerpc64)" ""
47 rts_S_SRCS
+= rts
/AdjustorAsm.S
51 ifeq "$(GhcUnregisterised)" "YES"
55 rts_AUTO_APPLY_CMM
= rts
/dist/build
/AutoApply.cmm
57 $(rts_AUTO_APPLY_CMM
): $(GENAPPLY_INPLACE
)
58 "$(GENAPPLY_INPLACE)" >$@
60 rts
/dist/build
/sm
/Evac_thr.c
: rts
/sm
/Evac.c |
$$(dir $$@
)/.
62 rts
/dist/build
/sm
/Scav_thr.c
: rts
/sm
/Scav.c |
$$(dir $$@
)/.
65 rts_H_FILES
:= $(wildcard rts
/*.h rts
/*/*.h
)
67 ifeq "$(USE_DTRACE)" "YES"
68 DTRACEPROBES_H
= rts
/dist/build
/RtsProbes.h
69 rts_H_FILES
+= $(DTRACEPROBES_H
)
72 # collect the -l flags that we need to link the rts dyn lib.
73 rts
/libs.depend
: $(GHC_PKG_INPLACE
)
74 "$(GHC_PKG_INPLACE)" field rts extra-libraries \
75 | sed
-e
's/^extra-libraries: //' -e
's/\([a-z0-9]*\)[ ]*/-l\1 /g' > $@
78 # ----------------------------------------------------------------------------
79 # On Windows, as the RTS and base libraries have recursive imports,
80 # we have to break the loop with "import libraries".
81 # These are made from rts/win32/libHS*.def which contain lists of
82 # all the symbols in those libraries used by the RTS.
84 ifeq "$(HostOS_CPP)" "mingw32"
86 ALL_RTS_DEF_LIBNAMES
= base ghc-prim
88 rts
/dist/build
/win32
/libHSbase.dll.a \
89 rts
/dist/build
/win32
/libHSghc-prim.dll.a
91 # -- import libs for the regular Haskell libraries
92 define make-importlib-def
# args $1 = lib name
93 rts
/dist/build
/win32
/libHS
$1.def
: rts
/win32
/libHS
$1.def
94 cat rts
/win32
/libHS
$1.def \
95 | sed
"s/@LibVersion@/$$(libraries/$1_dist-install_VERSION)/" \
96 | sed
"s/@ProjectVersion@/$$(ProjectVersion)/" \
97 > rts
/dist/build
/win32
/libHS
$1.def
99 rts
/dist/build
/win32
/libHS
$1.dll.a
: rts
/dist/build
/win32
/libHS
$1.def
100 "$$(DLLTOOL)" -d rts
/dist/build
/win32
/libHS
$1.def \
101 -l rts
/dist/build
/win32
/libHS
$1.dll.a
103 $(foreach lib
,$(ALL_RTS_DEF_LIBNAMES
),$(eval
$(call make-importlib-def
,$(lib
))))
106 ifneq "$(BINDIST)" "YES"
107 rts_ffi_objs_stamp
= rts
/dist/ffi
/stamp
108 rts_ffi_objs
= rts
/dist/ffi
/*.o
109 $(rts_ffi_objs_stamp
): $(libffi_STATIC_LIB
) $(TOUCH_DEP
) |
$$(dir $$@
)/.
110 cd rts
/dist/ffi
&& $(AR
) x ..
/..
/..
/$(libffi_STATIC_LIB
)
113 # This is a little hacky. We don't know the SO version, so we only
114 # depend on libffi.so, but copy libffi.so*
115 rts
/dist/build
/libffi
$(soext
): libffi
/build
/inst
/lib
/libffi
$(soext
)
116 cp libffi
/build
/inst
/lib
/libffi
$(soext
)* rts
/dist/build
118 rts
/dist/build
/$(LIBFFI_DLL
): libffi
/build
/inst
/bin
/$(LIBFFI_DLL
)
122 #-----------------------------------------------------------------------------
124 define build-rts-way
# args: $1 = way
126 ifneq "$$(BINDIST)" "YES"
128 # The per-way CC_OPTS
129 ifneq "$$(findstring debug, $1)" ""
130 rts_dist_
$1_HC_OPTS =
131 rts_dist_
$1_CC_OPTS = -g
-O0
133 rts_dist_
$1_HC_OPTS = $$(GhcRtsHcOpts
)
134 rts_dist_
$1_CC_OPTS = $$(GhcRtsCcOpts
)
137 ifneq "$$(findstring dyn, $1)" ""
138 ifeq "$$(HostOS_CPP)" "mingw32"
139 rts_dist_
$1_CC_OPTS += -DCOMPILING_WINDOWS_DLL
143 ifneq "$$(findstring thr, $1)" ""
144 rts_
$1_EXTRA_C_SRCS = rts
/dist/build
/sm
/Evac_thr.c rts
/dist/build
/sm
/Scav_thr.c
147 $(call distdir-way-opts
,rts
,dist,$1)
148 $(call c-suffix-rules
,rts
,dist,$1,YES
)
149 $(call cmm-suffix-rules
,rts
,dist,$1)
150 $(call hs-suffix-rules-srcdir
,rts
,dist,$1,.
)
151 # hs-suffix-rules-srcdir is needed when BootingFromHc to get the .hc rules
153 rts_
$1_LIB_NAME = libHSrts
$$($1_libsuf)
154 rts_
$1_LIB = rts
/dist/build
/$$(rts_
$1_LIB_NAME)
156 rts_
$1_C_OBJS = $$(patsubst rts
/%.c
,rts
/dist/build
/%.
$$($1_osuf),$$(rts_C_SRCS
)) $$(patsubst %.c
,%.
$$($1_osuf),$$(rts_
$1_EXTRA_C_SRCS))
157 rts_
$1_S_OBJS = $$(patsubst rts
/%.S
,rts
/dist/build
/%.
$$($1_osuf),$$(rts_S_SRCS
))
158 rts_
$1_CMM_OBJS = $$(patsubst rts
/%.cmm
,rts
/dist/build
/%.
$$($1_osuf),$$(rts_CMM_SRCS
)) $$(patsubst %.cmm
,%.
$$($1_osuf),$$(rts_AUTO_APPLY_CMM
))
160 rts_
$1_OBJS = $$(rts_
$1_C_OBJS) $$(rts_
$1_S_OBJS) $$(rts_
$1_CMM_OBJS)
162 ifeq "$(USE_DTRACE)" "YES"
163 ifeq "$(TargetOS_CPP)" "solaris2"
164 # On Darwin we don't need to generate binary containing probes defined
165 # in DTrace script, but DTrace on Solaris expects generation of binary
166 # from the DTrace probes definitions
167 rts_
$1_DTRACE_OBJS = rts
/dist/build
/RtsProbes.
$$($1_osuf)
169 rts
/dist/build
/RtsProbes.
$$($1_osuf) : $$(rts_
$1_OBJS)
170 $(DTRACE
) -G
-C
$$(addprefix -I
,$$(GHC_INCLUDE_DIRS
)) -DDTRACE
-s rts
/RtsProbes.d
-o \
175 rts_dist_
$1_CC_OPTS += -DRtsWay
=\"rts_
$1\"
177 # Making a shared library for the RTS.
178 ifneq "$$(findstring dyn, $1)" ""
179 ifeq "$$(HostOS_CPP)" "mingw32"
180 $$(rts_
$1_LIB) : $$(rts_
$1_OBJS) $$(ALL_RTS_DEF_LIBS
) rts
/libs.depend rts
/dist/build
/$$(LIBFFI_DLL
)
181 "$$(RM)" $$(RM_OPTS
) $$@
182 "$$(rts_dist_HC)" -package-name rts
-shared
-dynamic
-dynload deploy \
183 -no-auto-link-packages
-Lrts
/dist/build
-l
$(LIBFFI_WINDOWS_LIB
) `cat rts/libs.depend` $$(rts_
$1_OBJS) $$(ALL_RTS_DEF_LIBS
) -o
$$@
185 $$(rts_
$1_LIB) : $$(rts_
$1_OBJS) $$(rts_
$1_DTRACE_OBJS) rts
/libs.depend rts
/dist/build
/libffi
$$(soext
)
186 "$$(RM)" $$(RM_OPTS
) $$@
187 "$$(rts_dist_HC)" -package-name rts
-shared
-dynamic
-dynload deploy \
188 -no-auto-link-packages
-Lrts
/dist/build
-lffi
`cat rts/libs.depend` $$(rts_
$1_OBJS) \
189 $$(rts_
$1_DTRACE_OBJS) -o
$$@
190 ifeq "$$(darwin_HOST_OS)" "1"
191 # Ensure library's install name is correct before anyone links with it.
192 install_name_tool
-id
$$(ghclibdir
)/$$(rts_
$1_LIB_NAME) $$@
196 $$(rts_
$1_LIB) : $$(rts_
$1_OBJS) $$(rts_
$1_DTRACE_OBJS) $$(rts_ffi_objs_stamp
)
197 "$$(RM)" $$(RM_OPTS
) $$@
198 echo
$$(rts_ffi_objs
) $$(rts_
$1_OBJS) $$(rts_
$1_DTRACE_OBJS) |
"$$(XARGS)" $$(XARGS_OPTS
) "$$(AR_STAGE1)" \
199 $$(AR_OPTS_STAGE1
) $$(EXTRA_AR_ARGS_STAGE1
) $$@
206 # And expand the above for each way:
207 $(foreach way
,$(rts_WAYS
),$(eval
$(call build-rts-way
,$(way
))))
209 #-----------------------------------------------------------------------------
210 # Flags for compiling every file
212 # We like plenty of warnings.
213 WARNING_OPTS
+= -Wall
214 ifeq "$(GccLT34)" "YES"
217 WARNING_OPTS
+= -Wextra
219 WARNING_OPTS
+= -Wstrict-prototypes
220 WARNING_OPTS
+= -Wmissing-prototypes
221 WARNING_OPTS
+= -Wmissing-declarations
222 WARNING_OPTS
+= -Winline
223 WARNING_OPTS
+= -Waggregate-return
224 WARNING_OPTS
+= -Wpointer-arith
225 WARNING_OPTS
+= -Wmissing-noreturn
226 WARNING_OPTS
+= -Wnested-externs
227 WARNING_OPTS
+= -Wredundant-decls
229 # These ones are hard to avoid:
230 #WARNING_OPTS += -Wconversion
231 #WARNING_OPTS += -Wbad-function-cast
232 #WARNING_OPTS += -Wshadow
233 #WARNING_OPTS += -Wcast-qual
235 # This one seems buggy on GCC 4.1.2, which is the only GCC version we
236 # have that can bootstrap the SPARC build. We end up with lots of supurious
237 # warnings of the form "cast increases required alignment of target type".
238 # Some legitimate warnings can be fixed by adding an intermediate cast to
239 # (void*), but we get others in rts/sm/GCUtils.c concerning the gct var
240 # that look innocuous to me. We could enable this again once we deprecate
241 # support for registerised builds on this arch. -- BL 2010/02/03
242 # WARNING_OPTS += -Wcast-align
244 STANDARD_OPTS
+= $(addprefix -I
,$(GHC_INCLUDE_DIRS
)) -Irts
-Irts
/dist/build
245 # COMPILING_RTS is only used when building Win32 DLL support.
246 STANDARD_OPTS
+= -DCOMPILING_RTS
248 # HC_OPTS is included in both .c and .cmm compilations, whereas CC_OPTS is
249 # only included in .c compilations. HC_OPTS included the WAY_* opts, which
250 # must be included in both types of compilations.
252 rts_CC_OPTS
+= $(WARNING_OPTS
)
253 rts_CC_OPTS
+= $(STANDARD_OPTS
)
255 rts_HC_OPTS
+= $(STANDARD_OPTS
) -package-name rts
257 ifneq "$(GhcWithSMP)" "YES"
258 rts_CC_OPTS
+= -DNOSMP
259 rts_HC_OPTS
+= -optc-DNOSMP
262 ifeq "$(UseLibFFIForAdjustors)" "YES"
263 rts_CC_OPTS
+= -DUSE_LIBFFI_FOR_ADJUSTORS
266 # Mac OS X: make sure we compile for the right OS version
267 rts_CC_OPTS
+= $(MACOSX_DEPLOYMENT_CC_OPTS
)
268 rts_HC_OPTS
+= $(addprefix -optc
, $(MACOSX_DEPLOYMENT_CC_OPTS
))
269 rts_LD_OPTS
+= $(addprefix -optl
, $(MACOSX_DEPLOYMENT_LD_OPTS
))
271 # We *want* type-checking of hand-written cmm.
272 rts_HC_OPTS
+= -dcmm-lint
274 # -fno-strict-aliasing is required for the runtime, because we often
275 # use a variety of types to represent closure pointers (StgPtr,
276 # StgClosure, StgMVar, etc.), and without -fno-strict-aliasing gcc is
277 # allowed to assume that these pointers do not alias. eg. without
278 # this flag we get problems in sm/Evac.c:copy() with gcc 3.4.3, the
279 # upd_evacee() assigments get moved before the object copy.
280 rts_CC_OPTS
+= -fno-strict-aliasing
282 rts_CC_OPTS
+= -fno-common
284 ifeq "$(BeConservative)" "YES"
285 rts_CC_OPTS
+= -DBE_CONSERVATIVE
288 #-----------------------------------------------------------------------------
289 # Flags for compiling specific files
291 # If RtsMain.c is built with optimisation then the SEH exception stuff on
292 # Windows gets confused.
293 # This has to be in HC rather than CC opts, as otherwise there's a
294 # -optc-O2 that comes after it.
295 rts
/RtsMain_HC_OPTS
+= -optc-O0
297 rts
/RtsMessages_CC_OPTS
+= -DProjectVersion
=\"$(ProjectVersion
)\"
298 rts
/RtsUtils_CC_OPTS
+= -DProjectVersion
=\"$(ProjectVersion
)\"
299 rts
/Trace_CC_OPTS
+= -DProjectVersion
=\"$(ProjectVersion
)\"
301 rts
/RtsUtils_CC_OPTS
+= -DHostPlatform
=\"$(HOSTPLATFORM
)\"
302 rts
/RtsUtils_CC_OPTS
+= -DHostArch
=\"$(HostArch_CPP
)\"
303 rts
/RtsUtils_CC_OPTS
+= -DHostOS
=\"$(HostOS_CPP
)\"
304 rts
/RtsUtils_CC_OPTS
+= -DHostVendor
=\"$(HostVendor_CPP
)\"
306 rts
/RtsUtils_CC_OPTS
+= -DBuildPlatform
=\"$(BUILDPLATFORM
)\"
307 rts
/RtsUtils_CC_OPTS
+= -DBuildArch
=\"$(BuildArch_CPP
)\"
308 rts
/RtsUtils_CC_OPTS
+= -DBuildOS
=\"$(BuildOS_CPP
)\"
309 rts
/RtsUtils_CC_OPTS
+= -DBuildVendor
=\"$(BuildVendor_CPP
)\"
311 rts
/RtsUtils_CC_OPTS
+= -DTargetPlatform
=\"$(TARGETPLATFORM
)\"
312 rts
/RtsUtils_CC_OPTS
+= -DTargetArch
=\"$(TargetArch_CPP
)\"
313 rts
/RtsUtils_CC_OPTS
+= -DTargetOS
=\"$(TargetOS_CPP
)\"
314 rts
/RtsUtils_CC_OPTS
+= -DTargetVendor
=\"$(TargetVendor_CPP
)\"
316 rts
/RtsUtils_CC_OPTS
+= -DGhcUnregisterised
=\"$(GhcUnregisterised
)\"
317 rts
/RtsUtils_CC_OPTS
+= -DGhcEnableTablesNextToCode
=\"$(GhcEnableTablesNextToCode
)\"
319 ifeq "$(GhcUnregisterised)" "YES"
320 rts
/PrimOps_HC_OPTS
+= -DGhcUnregisterised
=1
321 rts
/Schedule_CC_OPTS
+= -DGhcUnregisterised
=1
324 # Compile various performance-critical pieces *without* -fPIC -dynamic
325 # even when building a shared library. If we don't do this, then the
326 # GC runs about 50% slower on x86 due to the overheads of PIC. The
327 # cost of doing this is a little runtime linking and less sharing, but
330 # On x86_64 this doesn't work, because all objects in a shared library
331 # must be compiled with -fPIC (since the 32-bit relocations generated
332 # by the default small memory can't be resolved at runtime). So we
333 # only do this on i386.
335 # This apparently doesn't work on OS X (Darwin) nor on Solaris.
336 # On Darwin we get errors of the form
338 # ld: absolute addressing (perhaps -mdynamic-no-pic) used in _stg_ap_0_fast from rts/dist/build/Apply.dyn_o not allowed in slidable image
340 # and lots of these warnings:
342 # ld: warning codegen in _stg_ap_pppv_fast (offset 0x0000005E) prevents image from loading in dyld shared cache
344 # On Solaris we get errors like:
346 # Text relocation remains referenced
347 # against symbol offset in file
348 # .rodata (section) 0x11 rts/dist/build/Apply.dyn_o
350 # ld: fatal: relocations remain against allocatable but non-writable sections
351 # collect2: ld returned 1 exit status
353 ifeq "$(TargetArch_CPP)" "i386"
354 i386_SPEED_HACK
:= "YES"
355 ifeq "$(TargetOS_CPP)" "darwin"
356 i386_SPEED_HACK
:= "NO"
358 ifeq "$(TargetOS_CPP)" "solaris2"
359 i386_SPEED_HACK
:= "NO"
363 ifeq "$(TargetArch_CPP)" "i386"
364 ifeq "$(i386_SPEED_HACK)" "YES"
365 rts
/sm
/Evac_HC_OPTS
+= -fno-PIC
366 rts
/sm
/Evac_thr_HC_OPTS
+= -fno-PIC
367 rts
/sm
/Scav_HC_OPTS
+= -fno-PIC
368 rts
/sm
/Scav_thr_HC_OPTS
+= -fno-PIC
369 rts
/sm
/Compact_HC_OPTS
+= -fno-PIC
370 rts
/sm
/GC_HC_OPTS
+= -fno-PIC
372 # -static is also necessary for these bits, otherwise the NCG
373 # -generates dynamic references:
374 rts
/Updates_HC_OPTS
+= -fno-PIC
-static
375 rts
/StgMiscClosures_HC_OPTS
+= -fno-PIC
-static
376 rts
/PrimOps_HC_OPTS
+= -fno-PIC
-static
377 rts
/Apply_HC_OPTS
+= -fno-PIC
-static
378 rts
/dist/build
/AutoApply_HC_OPTS
+= -fno-PIC
-static
382 # ffi.h triggers prototype warnings, so disable them here:
383 rts
/Interpreter_CC_OPTS
+= -Wno-strict-prototypes
384 rts
/Adjustor_CC_OPTS
+= -Wno-strict-prototypes
385 rts
/sm
/Storage_CC_OPTS
+= -Wno-strict-prototypes
387 # inlining warnings happen in Compact
388 rts
/sm
/Compact_CC_OPTS
+= -Wno-inline
390 # emits warnings about call-clobbered registers on x86_64
391 rts
/StgCRun_CC_OPTS
+= -w
393 rts
/RetainerProfile_CC_OPTS
+= -w
394 rts
/RetainerSet_CC_OPTS
+= -Wno-format
396 rts
/win32
/ConsoleHandler_CC_OPTS
+= -w
397 rts
/win32
/ThrIOManager_CC_OPTS
+= -w
398 # The above warning supression flags are a temporary kludge.
399 # While working on this module you are encouraged to remove it and fix
400 # any warnings in the module. See
401 # http://hackage.haskell.org/trac/ghc/wiki/WorkingConventions#Warnings
404 # Without this, thread_obj will not be inlined (at least on x86 with GCC 4.1.0)
405 rts
/sm
/Compact_CC_OPTS
+= -finline-limit
=2500
407 # -O3 helps unroll some loops (especially in copy() with a constant argument).
408 rts
/sm
/Evac_CC_OPTS
+= -funroll-loops
409 rts
/dist/build
/sm
/Evac_thr_HC_OPTS
+= -optc-funroll-loops
411 # These files are just copies of sm/Evac.c and sm/Scav.c respectively,
412 # but compiled with -DPARALLEL_GC.
413 rts
/dist/build
/sm
/Evac_thr_CC_OPTS
+= -DPARALLEL_GC
-Irts
/sm
414 rts
/dist/build
/sm
/Scav_thr_CC_OPTS
+= -DPARALLEL_GC
-Irts
/sm
416 #-----------------------------------------------------------------------------
417 # Add PAPI library if needed
419 ifeq "$(GhcRtsWithPapi)" "YES"
421 rts_CC_OPTS
+= -DUSE_PAPI
423 rts_PACKAGE_CPP_OPTS
+= -DUSE_PAPI
424 rts_PACKAGE_CPP_OPTS
+= -DPAPI_INCLUDE_DIR
=$(PapiIncludeDir
)
425 rts_PACKAGE_CPP_OPTS
+= -DPAPI_LIB_DIR
=$(PapiLibDir
)
427 ifneq "$(PapiIncludeDir)" ""
428 rts_HC_OPTS
+= -I
$(PapiIncludeDir
)
429 rts_CC_OPTS
+= -I
$(PapiIncludeDir
)
430 rts_HSC2HS_OPTS
+= -I
$(PapiIncludeDir
)
432 ifneq "$(PapiLibDirs)" ""
433 rts_LD_OPTS
+= -L
$(PapiLibDirs
)
436 else # GhcRtsWithPapi==YES
438 rts_PACKAGE_CPP_OPTS
+= -DPAPI_INCLUDE_DIR
=""
439 rts_PACKAGE_CPP_OPTS
+= -DPAPI_LIB_DIR
=""
443 # -----------------------------------------------------------------------------
446 rts_WAYS_DASHED
= $(subst $(space
),,$(patsubst %,-%,$(strip $(rts_WAYS
))))
447 rts_dist_depfile_base
= rts
/dist/build
/.depend
$(rts_WAYS_DASHED
)
449 rts_dist_C_SRCS
= $(rts_C_SRCS
) $(rts_thr_EXTRA_C_SRCS
)
450 rts_dist_S_SRCS
= $(rts_S_SRCS
)
451 rts_dist_C_FILES
= $(rts_C_SRCS
) $(rts_thr_EXTRA_C_SRCS
) $(rts_S_SRCS
)
453 # Hack: we define every way-related option here, so that we get (hopefully)
454 # a superset of the dependencies. To do this properly, we should generate
455 # a different set of dependencies for each way. Further hack: PROFILING an
457 # TICKY_TICKY can't be used together, so we omit TICKY_TICKY for now.
458 rts_dist_MKDEPENDC_OPTS
+= -DPROFILING
-DTHREADED_RTS
-DDEBUG
460 ifeq "$(USE_DTRACE)" "YES"
462 rts_dist_MKDEPENDC_OPTS
+= -Irts
/dist/build
466 $(eval
$(call dependencies
,rts
,dist,1))
468 $(rts_dist_depfile_c_asm
) : $(libffi_HEADERS
) $(DTRACEPROBES_H
)
470 # -----------------------------------------------------------------------------
471 # compile dtrace probes if dtrace is supported
473 ifeq "$(USE_DTRACE)" "YES"
475 rts_CC_OPTS
+= -DDTRACE
476 rts_HC_OPTS
+= -DDTRACE
478 # Apple's dtrace (the only one supported by ghc at the moment) uses
479 # gcc as its preprocessor. If gcc isn't at /usr/bin/gcc, or we need
480 # to force it to use a different gcc, we need to give the path in
481 # the option cpppath.
483 ifeq "$(TargetOS_CPP)" "darwin"
484 # Darwin has a flag to tell dtrace which cpp to use.
485 # Unfortunately, this isn't supported on Solaris (See Solaris Dynamic Tracing
486 # Guide, Chapter 16, for the configuration variables available on Solaris)
487 DTRACE_FLAGS
= -x cpppath
=$(WhatGccIsCalled
)
490 DTRACEPROBES_SRC
= rts
/RtsProbes.d
491 $(DTRACEPROBES_H
): $(DTRACEPROBES_SRC
) includes
/ghcplatform.h |
$$(dir $$@
)/.
492 "$(DTRACE)" $(filter -I
%,$(rts_CC_OPTS
)) -C
$(DTRACE_FLAGS
) -h
-o
$@
-s
$<
495 # -----------------------------------------------------------------------------
496 # The RTS package config
498 # If -DDEBUG is in effect, adjust package conf accordingly..
499 ifneq "$(strip $(filter -optc-DDEBUG,$(GhcRtsHcOpts)))" ""
500 rts_PACKAGE_CPP_OPTS
+= -DDEBUG
503 ifeq "$(HaveLibMingwEx)" "YES"
504 rts_PACKAGE_CPP_OPTS
+= -DHAVE_LIBMINGWEX
507 $(eval
$(call manual-package-config
,rts
))
509 ifneq "$(BootingFromHc)" "YES"
510 rts
/package.conf.inplace
: $(includes_H_CONFIG
) $(includes_H_PLATFORM
)
513 # -----------------------------------------------------------------------------
516 INSTALL_LIBS
+= $(ALL_RTS_LIBS
)
517 INSTALL_LIBS
+= $(wildcard rts
/dist/build
/libffi
$(soext
)*)
518 INSTALL_LIBS
+= $(wildcard rts
/dist/build
/$(LIBFFI_DLL
))
520 install: install_libffi_headers
522 .PHONY
: install_libffi_headers
523 install_libffi_headers
:
524 $(call INSTALL_DIR
,"$(DESTDIR)$(ghcheaderdir)")
525 $(call INSTALL_HEADER
,$(INSTALL_OPTS
),$(libffi_HEADERS
),"$(DESTDIR)$(ghcheaderdir)/")
527 # -----------------------------------------------------------------------------
530 $(eval
$(call clean-target
,rts
,dist,rts
/dist))
532 BINDIST_EXTRAS
+= rts
/package.conf.in