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