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