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 rts_INSTALL_INFO
= rts
22 # merge GhcLibWays and GhcRTSWays but strip out duplicates
23 rts_WAYS
= $(GhcLibWays
) $(filter-out $(GhcLibWays
),$(GhcRTSWays
))
24 rts_dist_WAYS
= $(rts_WAYS
)
26 ALL_RTS_LIBS
= $(foreach way
,$(rts_WAYS
),rts
/dist/build
/libHSrts
$($(way
)_libsuf
))
27 all_rts
: $(ALL_RTS_LIBS
)
29 # -----------------------------------------------------------------------------
30 # Defining the sources
32 ALL_DIRS
= hooks parallel sm eventlog
34 ifeq "$(HostOS_CPP)" "mingw32"
41 EXCLUDED_SRCS
+= rts
/parallel
/SysMan.c
42 EXCLUDED_SRCS
+= $(wildcard rts
/Vis
*.c
)
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
)
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
54 ifeq "$(GhcUnregisterised)" "YES"
58 rts_AUTO_APPLY_CMM
= rts
/dist/build
/AutoApply.cmm
60 $(rts_AUTO_APPLY_CMM
): $(GENAPPLY_INPLACE
)
61 "$(GENAPPLY_INPLACE)" >$@
63 rts
/dist/build
/sm
/Evac_thr.c
: rts
/sm
/Evac.c |
$$(dir $$@
)/.
65 rts
/dist/build
/sm
/Scav_thr.c
: rts
/sm
/Scav.c |
$$(dir $$@
)/.
68 rts_H_FILES
:= $(wildcard rts
/*.h rts
/*/*.h
)
70 ifeq "$(USE_DTRACE)" "YES"
71 DTRACEPROBES_H
= rts
/dist/build
/RtsProbes.h
72 rts_H_FILES
+= $(DTRACEPROBES_H
)
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' > $@
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.
87 ifeq "$(HostOS_CPP)" "mingw32"
89 ALL_RTS_DEF_LIBNAMES
= base ghc-prim
91 rts
/dist/build
/win32
/libHSbase.dll.a \
92 rts
/dist/build
/win32
/libHSghc-prim.dll.a
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
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
106 $(foreach lib
,$(ALL_RTS_DEF_LIBNAMES
),$(eval
$(call make-importlib-def
,$(lib
))))
109 ifneq "$(BINDIST)" "YES"
110 ifneq "$(UseSystemLibFFI)" "YES"
111 rts_ffi_objs_stamp
= rts
/dist/ffi
/stamp
112 rts_ffi_objs
= rts
/dist/ffi
/*.o
114 $(rts_ffi_objs_stamp
): $(libffi_STATIC_LIB
) $(TOUCH_DEP
) |
$$(dir $$@
)/.
115 cd rts
/dist/ffi
&& $(AR
) x ..
/..
/..
/$(libffi_STATIC_LIB
)
118 # This is a little hacky. We don't know the SO version, so we only
119 # depend on libffi.so, but copy libffi.so*
120 rts
/dist/build
/libffi
$(soext
): libffi
/build
/inst
/lib
/libffi
$(soext
)
121 cp libffi
/build
/inst
/lib
/libffi
$(soext
)* rts
/dist/build
123 rts
/dist/build
/$(LIBFFI_DLL
): libffi
/build
/inst
/bin
/$(LIBFFI_DLL
)
128 #-----------------------------------------------------------------------------
130 define build-rts-way
# args: $1 = way
132 ifneq "$$(BINDIST)" "YES"
134 # The per-way CC_OPTS
135 ifneq "$$(findstring debug, $1)" ""
136 rts_dist_
$1_HC_OPTS = -O0
137 rts_dist_
$1_CC_OPTS = -g
-O0
139 rts_dist_
$1_HC_OPTS = $$(GhcRtsHcOpts
)
140 rts_dist_
$1_CC_OPTS = $$(GhcRtsCcOpts
)
143 ifneq "$$(findstring dyn, $1)" ""
144 ifeq "$$(HostOS_CPP)" "mingw32"
145 rts_dist_
$1_CC_OPTS += -DCOMPILING_WINDOWS_DLL
149 ifneq "$$(findstring thr, $1)" ""
150 rts_
$1_EXTRA_C_SRCS = rts
/dist/build
/sm
/Evac_thr.c rts
/dist/build
/sm
/Scav_thr.c
153 $(call distdir-way-opts
,rts
,dist,$1)
154 $(call c-suffix-rules
,rts
,dist,$1,YES
)
155 $(call cmm-suffix-rules
,rts
,dist,$1)
156 $(call hs-suffix-rules-srcdir
,rts
,dist,$1,.
)
157 # hs-suffix-rules-srcdir is needed when BootingFromHc to get the .hc rules
159 rts_
$1_LIB_NAME = libHSrts
$$($1_libsuf)
160 rts_
$1_LIB = rts
/dist/build
/$$(rts_
$1_LIB_NAME)
162 rts_
$1_C_OBJS = $$(patsubst rts
/%.c
,rts
/dist/build
/%.
$$($1_osuf),$$(rts_C_SRCS
)) $$(patsubst %.c
,%.
$$($1_osuf),$$(rts_
$1_EXTRA_C_SRCS))
163 rts_
$1_S_OBJS = $$(patsubst rts
/%.S
,rts
/dist/build
/%.
$$($1_osuf),$$(rts_S_SRCS
))
164 rts_
$1_CMM_OBJS = $$(patsubst rts
/%.cmm
,rts
/dist/build
/%.
$$($1_osuf),$$(rts_CMM_SRCS
)) $$(patsubst %.cmm
,%.
$$($1_osuf),$$(rts_AUTO_APPLY_CMM
))
166 rts_
$1_OBJS = $$(rts_
$1_C_OBJS) $$(rts_
$1_S_OBJS) $$(rts_
$1_CMM_OBJS)
168 ifeq "$(USE_DTRACE)" "YES"
169 ifeq "$(TargetOS_CPP)" "solaris2"
170 # On Darwin we don't need to generate binary containing probes defined
171 # in DTrace script, but DTrace on Solaris expects generation of binary
172 # from the DTrace probes definitions
173 rts_
$1_DTRACE_OBJS = rts
/dist/build
/RtsProbes.
$$($1_osuf)
175 rts
/dist/build
/RtsProbes.
$$($1_osuf) : $$(rts_
$1_OBJS)
176 $(DTRACE
) -G
-C
$$(addprefix -I
,$$(GHC_INCLUDE_DIRS
)) -DDTRACE
-s rts
/RtsProbes.d
-o \
181 rts_dist_
$1_CC_OPTS += -DRtsWay
=\"rts_
$1\"
183 ifneq "$(UseSystemLibFFI)" "YES"
184 rts_dist_FFI_SO
= rts
/dist/build
/libffi
$(soext
)
189 # Making a shared library for the RTS.
190 ifneq "$$(findstring dyn, $1)" ""
191 ifeq "$$(HostOS_CPP)" "mingw32"
192 $$(rts_
$1_LIB) : $$(rts_
$1_OBJS) $$(ALL_RTS_DEF_LIBS
) rts
/libs.depend rts
/dist/build
/$$(LIBFFI_DLL
)
193 "$$(RM)" $$(RM_OPTS
) $$@
194 "$$(rts_dist_HC)" -package-name rts
-shared
-dynamic
-dynload deploy \
195 -no-auto-link-packages
-Lrts
/dist/build
-l
$(LIBFFI_WINDOWS_LIB
) `cat rts/libs.depend` $$(rts_
$1_OBJS) $$(ALL_RTS_DEF_LIBS
) -o
$$@
197 ifneq "$(UseSystemLibFFI)" "YES"
198 LIBFFI_LIBS
= -Lrts
/dist/build
-lffi
200 # flags will be taken care of in rts/libs.depend
203 $$(rts_
$1_LIB) : $$(rts_
$1_OBJS) $$(rts_
$1_DTRACE_OBJS) rts
/libs.depend
$$(rts_dist_FFI_SO
)
204 "$$(RM)" $$(RM_OPTS
) $$@
205 "$$(rts_dist_HC)" -package-name rts
-shared
-dynamic
-dynload deploy \
206 -no-auto-link-packages
$$(LIBFFI_LIBS
) `cat rts/libs.depend` $$(rts_
$1_OBJS) \
207 $$(rts_
$1_DTRACE_OBJS) -o
$$@
210 $$(rts_
$1_LIB) : $$(rts_
$1_OBJS) $$(rts_
$1_DTRACE_OBJS) $$(rts_ffi_objs_stamp
)
211 "$$(RM)" $$(RM_OPTS
) $$@
212 echo
$$(rts_ffi_objs
) $$(rts_
$1_OBJS) $$(rts_
$1_DTRACE_OBJS) |
"$$(XARGS)" $$(XARGS_OPTS
) "$$(AR_STAGE1)" \
213 $$(AR_OPTS_STAGE1
) $$(EXTRA_AR_ARGS_STAGE1
) $$@
220 # And expand the above for each way:
221 $(foreach way
,$(rts_WAYS
),$(eval
$(call build-rts-way
,$(way
))))
223 #-----------------------------------------------------------------------------
224 # Flags for compiling every file
226 # We like plenty of warnings.
227 WARNING_OPTS
+= -Wall
228 ifeq "$(GccLT34)" "YES"
231 WARNING_OPTS
+= -Wextra
233 WARNING_OPTS
+= -Wstrict-prototypes
234 WARNING_OPTS
+= -Wmissing-prototypes
235 WARNING_OPTS
+= -Wmissing-declarations
236 WARNING_OPTS
+= -Winline
237 WARNING_OPTS
+= -Waggregate-return
238 WARNING_OPTS
+= -Wpointer-arith
239 WARNING_OPTS
+= -Wmissing-noreturn
240 WARNING_OPTS
+= -Wnested-externs
241 WARNING_OPTS
+= -Wredundant-decls
243 # These ones are hard to avoid:
244 #WARNING_OPTS += -Wconversion
245 #WARNING_OPTS += -Wbad-function-cast
246 #WARNING_OPTS += -Wshadow
247 #WARNING_OPTS += -Wcast-qual
249 # This one seems buggy on GCC 4.1.2, which is the only GCC version we
250 # have that can bootstrap the SPARC build. We end up with lots of supurious
251 # warnings of the form "cast increases required alignment of target type".
252 # Some legitimate warnings can be fixed by adding an intermediate cast to
253 # (void*), but we get others in rts/sm/GCUtils.c concerning the gct var
254 # that look innocuous to me. We could enable this again once we deprecate
255 # support for registerised builds on this arch. -- BL 2010/02/03
256 # WARNING_OPTS += -Wcast-align
258 STANDARD_OPTS
+= $(addprefix -I
,$(GHC_INCLUDE_DIRS
)) -Irts
-Irts
/dist/build
259 # COMPILING_RTS is only used when building Win32 DLL support.
260 STANDARD_OPTS
+= -DCOMPILING_RTS
262 # HC_OPTS is included in both .c and .cmm compilations, whereas CC_OPTS is
263 # only included in .c compilations. HC_OPTS included the WAY_* opts, which
264 # must be included in both types of compilations.
266 rts_CC_OPTS
+= $(WARNING_OPTS
)
267 rts_CC_OPTS
+= $(STANDARD_OPTS
)
269 rts_HC_OPTS
+= $(STANDARD_OPTS
) -package-name rts
271 ifneq "$(GhcWithSMP)" "YES"
272 rts_CC_OPTS
+= -DNOSMP
273 rts_HC_OPTS
+= -optc-DNOSMP
276 ifeq "$(UseLibFFIForAdjustors)" "YES"
277 rts_CC_OPTS
+= -DUSE_LIBFFI_FOR_ADJUSTORS
280 # Mac OS X: make sure we compile for the right OS version
281 rts_CC_OPTS
+= $(MACOSX_DEPLOYMENT_CC_OPTS
)
282 rts_HC_OPTS
+= $(addprefix -optc
, $(MACOSX_DEPLOYMENT_CC_OPTS
))
283 rts_LD_OPTS
+= $(addprefix -optl
, $(MACOSX_DEPLOYMENT_LD_OPTS
))
285 # We *want* type-checking of hand-written cmm.
286 rts_HC_OPTS
+= -dcmm-lint
288 # -fno-strict-aliasing is required for the runtime, because we often
289 # use a variety of types to represent closure pointers (StgPtr,
290 # StgClosure, StgMVar, etc.), and without -fno-strict-aliasing gcc is
291 # allowed to assume that these pointers do not alias. eg. without
292 # this flag we get problems in sm/Evac.c:copy() with gcc 3.4.3, the
293 # upd_evacee() assigments get moved before the object copy.
294 rts_CC_OPTS
+= -fno-strict-aliasing
296 rts_CC_OPTS
+= -fno-common
298 ifeq "$(BeConservative)" "YES"
299 rts_CC_OPTS
+= -DBE_CONSERVATIVE
302 #-----------------------------------------------------------------------------
303 # Flags for compiling specific files
305 # If RtsMain.c is built with optimisation then the SEH exception stuff on
306 # Windows gets confused.
307 # This has to be in HC rather than CC opts, as otherwise there's a
308 # -optc-O2 that comes after it.
309 rts
/RtsMain_HC_OPTS
+= -optc-O0
311 rts
/RtsMessages_CC_OPTS
+= -DProjectVersion
=\"$(ProjectVersion
)\"
312 rts
/RtsUtils_CC_OPTS
+= -DProjectVersion
=\"$(ProjectVersion
)\"
313 rts
/Trace_CC_OPTS
+= -DProjectVersion
=\"$(ProjectVersion
)\"
315 rts
/RtsUtils_CC_OPTS
+= -DHostPlatform
=\"$(HOSTPLATFORM
)\"
316 rts
/RtsUtils_CC_OPTS
+= -DHostArch
=\"$(HostArch_CPP
)\"
317 rts
/RtsUtils_CC_OPTS
+= -DHostOS
=\"$(HostOS_CPP
)\"
318 rts
/RtsUtils_CC_OPTS
+= -DHostVendor
=\"$(HostVendor_CPP
)\"
320 rts
/RtsUtils_CC_OPTS
+= -DBuildPlatform
=\"$(BUILDPLATFORM
)\"
321 rts
/RtsUtils_CC_OPTS
+= -DBuildArch
=\"$(BuildArch_CPP
)\"
322 rts
/RtsUtils_CC_OPTS
+= -DBuildOS
=\"$(BuildOS_CPP
)\"
323 rts
/RtsUtils_CC_OPTS
+= -DBuildVendor
=\"$(BuildVendor_CPP
)\"
325 rts
/RtsUtils_CC_OPTS
+= -DTargetPlatform
=\"$(TARGETPLATFORM
)\"
326 rts
/RtsUtils_CC_OPTS
+= -DTargetArch
=\"$(TargetArch_CPP
)\"
327 rts
/RtsUtils_CC_OPTS
+= -DTargetOS
=\"$(TargetOS_CPP
)\"
328 rts
/RtsUtils_CC_OPTS
+= -DTargetVendor
=\"$(TargetVendor_CPP
)\"
330 rts
/RtsUtils_CC_OPTS
+= -DGhcUnregisterised
=\"$(GhcUnregisterised
)\"
331 rts
/RtsUtils_CC_OPTS
+= -DGhcEnableTablesNextToCode
=\"$(GhcEnableTablesNextToCode
)\"
333 ifeq "$(DYNAMIC_BY_DEFAULT)" "YES"
334 rts
/Linker_CC_OPTS
+= -DDYNAMIC_BY_DEFAULT
337 # Compile various performance-critical pieces *without* -fPIC -dynamic
338 # even when building a shared library. If we don't do this, then the
339 # GC runs about 50% slower on x86 due to the overheads of PIC. The
340 # cost of doing this is a little runtime linking and less sharing, but
343 # On x86_64 this doesn't work, because all objects in a shared library
344 # must be compiled with -fPIC (since the 32-bit relocations generated
345 # by the default small memory can't be resolved at runtime). So we
346 # only do this on i386.
348 # This apparently doesn't work on OS X (Darwin) nor on Solaris.
349 # On Darwin we get errors of the form
351 # 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
353 # and lots of these warnings:
355 # ld: warning codegen in _stg_ap_pppv_fast (offset 0x0000005E) prevents image from loading in dyld shared cache
357 # On Solaris we get errors like:
359 # Text relocation remains referenced
360 # against symbol offset in file
361 # .rodata (section) 0x11 rts/dist/build/Apply.dyn_o
363 # ld: fatal: relocations remain against allocatable but non-writable sections
364 # collect2: ld returned 1 exit status
366 ifeq "$(TargetArch_CPP)" "i386"
367 i386_SPEED_HACK
:= "YES"
368 ifeq "$(TargetOS_CPP)" "darwin"
369 i386_SPEED_HACK
:= "NO"
371 ifeq "$(TargetOS_CPP)" "solaris2"
372 i386_SPEED_HACK
:= "NO"
376 ifeq "$(TargetArch_CPP)" "i386"
377 ifeq "$(i386_SPEED_HACK)" "YES"
378 rts
/sm
/Evac_HC_OPTS
+= -fno-PIC
379 rts
/sm
/Evac_thr_HC_OPTS
+= -fno-PIC
380 rts
/sm
/Scav_HC_OPTS
+= -fno-PIC
381 rts
/sm
/Scav_thr_HC_OPTS
+= -fno-PIC
382 rts
/sm
/Compact_HC_OPTS
+= -fno-PIC
383 rts
/sm
/GC_HC_OPTS
+= -fno-PIC
385 # -static is also necessary for these bits, otherwise the NCG
386 # -generates dynamic references:
387 rts
/Updates_HC_OPTS
+= -fno-PIC
-static
388 rts
/StgMiscClosures_HC_OPTS
+= -fno-PIC
-static
389 rts
/PrimOps_HC_OPTS
+= -fno-PIC
-static
390 rts
/Apply_HC_OPTS
+= -fno-PIC
-static
391 rts
/dist/build
/AutoApply_HC_OPTS
+= -fno-PIC
-static
395 # add CFLAGS for libffi
396 # ffi.h triggers prototype warnings, so disable them here:
397 ifeq "$(UseSystemLibFFI)" "YES"
398 LIBFFI_CFLAGS
= $(addprefix -I
,$(FFIIncludeDir
))
402 rts
/Interpreter_CC_OPTS
+= -Wno-strict-prototypes
$(LIBFFI_CFLAGS
)
403 rts
/Adjustor_CC_OPTS
+= -Wno-strict-prototypes
$(LIBFFI_CFLAGS
)
404 rts
/sm
/Storage_CC_OPTS
+= -Wno-strict-prototypes
$(LIBFFI_CFLAGS
)
406 # inlining warnings happen in Compact
407 rts
/sm
/Compact_CC_OPTS
+= -Wno-inline
409 # emits warnings about call-clobbered registers on x86_64
410 rts
/StgCRun_CC_OPTS
+= -w
412 rts
/RetainerProfile_CC_OPTS
+= -w
413 rts
/RetainerSet_CC_OPTS
+= -Wno-format
415 rts
/win32
/ConsoleHandler_CC_OPTS
+= -w
416 rts
/win32
/ThrIOManager_CC_OPTS
+= -w
417 # The above warning supression flags are a temporary kludge.
418 # While working on this module you are encouraged to remove it and fix
419 # any warnings in the module. See
420 # http://hackage.haskell.org/trac/ghc/wiki/WorkingConventions#Warnings
423 # Without this, thread_obj will not be inlined (at least on x86 with GCC 4.1.0)
424 rts
/sm
/Compact_CC_OPTS
+= -finline-limit
=2500
426 # -O3 helps unroll some loops (especially in copy() with a constant argument).
427 rts
/sm
/Evac_CC_OPTS
+= -funroll-loops
428 rts
/dist/build
/sm
/Evac_thr_HC_OPTS
+= -optc-funroll-loops
430 # These files are just copies of sm/Evac.c and sm/Scav.c respectively,
431 # but compiled with -DPARALLEL_GC.
432 rts
/dist/build
/sm
/Evac_thr_CC_OPTS
+= -DPARALLEL_GC
-Irts
/sm
433 rts
/dist/build
/sm
/Scav_thr_CC_OPTS
+= -DPARALLEL_GC
-Irts
/sm
435 #-----------------------------------------------------------------------------
436 # Add PAPI library if needed
438 ifeq "$(GhcRtsWithPapi)" "YES"
440 rts_CC_OPTS
+= -DUSE_PAPI
442 rts_PACKAGE_CPP_OPTS
+= -DUSE_PAPI
443 rts_PACKAGE_CPP_OPTS
+= -DPAPI_INCLUDE_DIR
=$(PapiIncludeDir
)
444 rts_PACKAGE_CPP_OPTS
+= -DPAPI_LIB_DIR
=$(PapiLibDir
)
446 ifneq "$(PapiIncludeDir)" ""
447 rts_HC_OPTS
+= -I
$(PapiIncludeDir
)
448 rts_CC_OPTS
+= -I
$(PapiIncludeDir
)
449 rts_HSC2HS_OPTS
+= -I
$(PapiIncludeDir
)
451 ifneq "$(PapiLibDirs)" ""
452 rts_LD_OPTS
+= -L
$(PapiLibDirs
)
455 else # GhcRtsWithPapi==YES
457 rts_PACKAGE_CPP_OPTS
+= -DPAPI_INCLUDE_DIR
=""
458 rts_PACKAGE_CPP_OPTS
+= -DPAPI_LIB_DIR
=""
462 #-----------------------------------------------------------------------------
463 # Use system provided libffi
465 ifeq "$(UseSystemLibFFI)" "YES"
467 rts_PACKAGE_CPP_OPTS
+= -DFFI_INCLUDE_DIR
=$(FFIIncludeDir
)
468 rts_PACKAGE_CPP_OPTS
+= -DFFI_LIB_DIR
=$(FFILibDir
)
470 else # UseSystemLibFFI==YES
472 rts_PACKAGE_CPP_OPTS
+= -DFFI_INCLUDE_DIR
=""
473 rts_PACKAGE_CPP_OPTS
+= -DFFI_LIB_DIR
=""
477 # -----------------------------------------------------------------------------
480 rts_WAYS_DASHED
= $(subst $(space
),,$(patsubst %,-%,$(strip $(rts_WAYS
))))
481 rts_dist_depfile_base
= rts
/dist/build
/.depend
$(rts_WAYS_DASHED
)
483 rts_dist_C_SRCS
= $(rts_C_SRCS
) $(rts_thr_EXTRA_C_SRCS
)
484 rts_dist_S_SRCS
= $(rts_S_SRCS
)
485 rts_dist_C_FILES
= $(rts_C_SRCS
) $(rts_thr_EXTRA_C_SRCS
) $(rts_S_SRCS
)
487 # Hack: we define every way-related option here, so that we get (hopefully)
488 # a superset of the dependencies. To do this properly, we should generate
489 # a different set of dependencies for each way. Further hack: PROFILING an
491 # TICKY_TICKY can't be used together, so we omit TICKY_TICKY for now.
492 rts_dist_MKDEPENDC_OPTS
+= -DPROFILING
-DTHREADED_RTS
-DDEBUG
494 ifeq "$(USE_DTRACE)" "YES"
496 rts_dist_MKDEPENDC_OPTS
+= -Irts
/dist/build
500 $(eval
$(call dependencies
,rts
,dist,1))
502 $(rts_dist_depfile_c_asm
) : $(DTRACEPROBES_H
)
503 ifneq "$(UseSystemLibFFI)" "YES"
504 $(rts_dist_depfile_c_asm
) : $(libffi_HEADERS
)
507 # -----------------------------------------------------------------------------
508 # compile dtrace probes if dtrace is supported
510 ifeq "$(USE_DTRACE)" "YES"
512 rts_CC_OPTS
+= -DDTRACE
513 rts_HC_OPTS
+= -DDTRACE
515 # Apple's dtrace (the only one supported by ghc at the moment) uses
516 # gcc as its preprocessor. If gcc isn't at /usr/bin/gcc, or we need
517 # to force it to use a different gcc, we need to give the path in
518 # the option cpppath.
520 ifeq "$(TargetOS_CPP)" "darwin"
521 # Darwin has a flag to tell dtrace which cpp to use.
522 # Unfortunately, this isn't supported on Solaris (See Solaris Dynamic Tracing
523 # Guide, Chapter 16, for the configuration variables available on Solaris)
524 DTRACE_FLAGS
= -x cpppath
=$(WhatGccIsCalled
)
527 DTRACEPROBES_SRC
= rts
/RtsProbes.d
528 $(DTRACEPROBES_H
): $(DTRACEPROBES_SRC
) includes
/ghcplatform.h |
$$(dir $$@
)/.
529 "$(DTRACE)" $(filter -I
%,$(rts_CC_OPTS
)) -C
$(DTRACE_FLAGS
) -h
-o
$@
-s
$<
532 # -----------------------------------------------------------------------------
533 # The RTS package config
535 # If -DDEBUG is in effect, adjust package conf accordingly..
536 ifneq "$(strip $(filter -optc-DDEBUG,$(GhcRtsHcOpts)))" ""
537 rts_PACKAGE_CPP_OPTS
+= -DDEBUG
540 ifeq "$(HaveLibMingwEx)" "YES"
541 rts_PACKAGE_CPP_OPTS
+= -DHAVE_LIBMINGWEX
544 $(eval
$(call manual-package-config
,rts
))
546 ifneq "$(BootingFromHc)" "YES"
547 rts
/package.conf.inplace
: $(includes_H_CONFIG
) $(includes_H_PLATFORM
)
550 # -----------------------------------------------------------------------------
553 RTS_INSTALL_LIBS
+= $(ALL_RTS_LIBS
)
554 RTS_INSTALL_LIBS
+= $(wildcard rts
/dist/build
/libffi
$(soext
)*)
555 RTS_INSTALL_LIBS
+= $(wildcard rts
/dist/build
/$(LIBFFI_DLL
))
557 ifneq "$(UseSystemLibFFI)" "YES"
558 install: install_libffi_headers
561 .PHONY
: install_libffi_headers
562 install_libffi_headers
:
563 $(call INSTALL_DIR
,"$(DESTDIR)$(ghcheaderdir)")
564 $(call INSTALL_HEADER
,$(INSTALL_OPTS
),$(libffi_HEADERS
),"$(DESTDIR)$(ghcheaderdir)/")
566 # -----------------------------------------------------------------------------
569 $(eval
$(call clean-target
,rts
,dist,rts
/dist))
571 BINDIST_EXTRAS
+= rts
/package.conf.in