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
= rts
/dist/build
/libHSrtsmain.a \
24 $(foreach way
,$(rts_WAYS
),rts
/dist/build
/libHSrts
$($(way
)_libsuf
))
25 all_rts
: $(ALL_RTS_LIBS
)
27 # -----------------------------------------------------------------------------
28 # Defining the sources
30 ALL_DIRS
= hooks parallel sm eventlog
32 ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
39 EXCLUDED_SRCS
+= rts
/Main.c
40 EXCLUDED_SRCS
+= rts
/parallel
/SysMan.c
41 EXCLUDED_SRCS
+= $(wildcard rts
/Vis
*.c
)
43 rts_C_SRCS
:= $(filter-out $(EXCLUDED_SRCS
),$(wildcard rts
/*.c
$(foreach dir,$(ALL_DIRS
),rts
/$(dir)/*.c
)))
44 rts_CMM_SRCS
:= $(wildcard rts
/*.cmm
)
46 # Don't compile .S files when bootstrapping a new arch
47 ifneq "$(PORTING_HOST)" "YES"
48 ifneq "$(findstring $(TargetArch_CPP), i386 powerpc powerpc64)" ""
49 rts_S_SRCS
+= rts
/AdjustorAsm.S
53 ifeq "$(GhcUnregisterised)" "YES"
57 rts_AUTO_APPLY_CMM
= rts
/dist/build
/AutoApply.cmm
59 $(rts_AUTO_APPLY_CMM
): $(GENAPPLY_INPLACE
)
60 "$(GENAPPLY_INPLACE)" >$@
62 rts
/dist/build
/sm
/Evac_thr.c
: rts
/sm
/Evac.c |
$$(dir $$@
)/.
64 rts
/dist/build
/sm
/Scav_thr.c
: rts
/sm
/Scav.c |
$$(dir $$@
)/.
67 rts_H_FILES
:= $(wildcard rts
/*.h
)
69 ifeq "$(USE_DTRACE)" "YES"
70 DTRACEPROBES_H
= rts
/dist/build
/RtsProbes.h
71 rts_H_FILES
+= $(DTRACEPROBES_H
)
74 # collect the -l flags that we need to link the rts dyn lib.
75 rts
/libs.depend
: $(GHC_PKG_INPLACE
)
76 "$(GHC_PKG_INPLACE)" field rts extra-libraries \
77 | sed
-e
's/^extra-libraries: //' -e
's/\([a-z0-9]*\)[ ]*/-l\1 /g' > $@
80 # ----------------------------------------------------------------------------
81 # On Windows, as the RTS and base libraries have recursive imports,
82 # we have to break the loop with "import libraries".
83 # These are made from rts/win32/libHS*.def which contain lists of
84 # all the symbols in those libraries used by the RTS.
86 ifneq "$$(findstring dyn, $1)" ""
87 ifeq "$(HOSTPLATFORM)" "i386-unknown-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 \
93 rts
/dist/build
/win32
/libHSffi.dll.a
95 # -- import libs for the regular Haskell libraries
96 define make-importlib-def
# args $1 = lib name
97 rts
/dist/build
/win32
/libHS
$1.def
: rts
/win32
/libHS
$1.def
98 cat rts
/win32
/libHS
$1.def \
99 | sed
"s/@LibVersion@/$$(libraries/$1_dist-install_VERSION)/" \
100 | sed
"s/@ProjectVersion@/$(ProjectVersion)/" \
101 > rts
/dist/build
/win32
/libHS
$1.def
103 rts
/dist/build
/win32
/libHS
$1.dll.a
: rts
/dist/build
/win32
/libHS
$1.def
104 "$$(DLLTOOL)" -d rts
/dist/build
/win32
/libHS
$1.def \
105 -l rts
/dist/build
/win32
/libHS
$1.dll.a
107 $(foreach lib
,$(ALL_RTS_DEF_LIBNAMES
),$(eval
$(call make-importlib-def
,$(lib
))))
110 # -- import libs for libffi
111 rts
/dist/build
/win32
/libHSffi.def
: rts
/win32
/libHSffi.def
112 cat rts
/win32
/libHSffi.def \
113 | sed
"s/@ProjectVersion@/$(ProjectVersion)/" \
114 > rts
/dist/build
/win32
/libHSffi.def
116 rts
/dist/build
/win32
/libHSffi.dll.a
: rts
/dist/build
/win32
/libHSffi.def
117 "$(DLLTOOL)" -d rts
/dist/build
/win32
/libHSffi.def \
118 -l rts
/dist/build
/win32
/libHSffi.dll.a
123 #-----------------------------------------------------------------------------
125 define build-rts-way
# args: $1 = way
127 ifneq "$$(BINDIST)" "YES"
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
134 rts_dist_
$1_HC_OPTS = $$(GhcRtsHcOpts
)
135 rts_dist_
$1_CC_OPTS = $$(GhcRtsCcOpts
)
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
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
148 rts_
$1_LIB_NAME = libHSrts
$$($1_libsuf)
149 rts_
$1_LIB = rts
/dist/build
/$$(rts_
$1_LIB_NAME)
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
))
155 rts_
$1_OBJS = $$(rts_
$1_C_OBJS) $$(rts_
$1_S_OBJS) $$(rts_
$1_CMM_OBJS)
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)
164 rts
/dist/build
/RtsProbes.
$$($1_osuf) : $$(rts_
$1_OBJS)
165 $(DTRACE
) -G
-C
-Iincludes
-DDTRACE
-s rts
/RtsProbes.d
-o \
170 rts_dist_
$1_CC_OPTS += -DRtsWay
=\"rts_
$1\"
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_ffi_objs_stamp
)
176 "$$(RM)" $$(RM_OPTS
) $$@
177 "$$(rts_dist_HC)" -package-name rts
-shared
-dynamic
-dynload deploy \
178 -no-auto-link-packages
`cat rts/libs.depend` $$(rts_ffi_objs
) $$(rts_
$1_OBJS) $$(ALL_RTS_DEF_LIBS
) -o
$$@
180 $$(rts_
$1_LIB) : $$(rts_
$1_OBJS) $$(rts_
$1_DTRACE_OBJS) rts
/libs.depend
$$(rts_ffi_objs_stamp
)
181 "$$(RM)" $$(RM_OPTS
) $$@
182 "$$(rts_dist_HC)" -package-name rts
-shared
-dynamic
-dynload deploy \
183 -no-auto-link-packages
`cat rts/libs.depend` $$(rts_ffi_objs
) $$(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) $$@
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
) $$@
201 rts_ffi_objs_stamp
= rts
/dist/ffi
/stamp
202 rts_ffi_objs
= rts
/dist/ffi
/*.o
203 $(rts_ffi_objs_stamp
): $(libffi_STATIC_LIB
) |
$$(dir $$@
)/.
204 cd rts
/dist/ffi
&& $(AR
) x ..
/..
/..
/$(libffi_STATIC_LIB
)
207 # And expand the above for each way:
208 $(foreach way
,$(rts_WAYS
),$(eval
$(call build-rts-way
,$(way
))))
210 #-----------------------------------------------------------------------------
211 # Flags for compiling every file
213 # We like plenty of warnings.
214 WARNING_OPTS
+= -Wall
215 ifeq "$(GccLT34)" "YES"
218 WARNING_OPTS
+= -Wextra
220 WARNING_OPTS
+= -Wstrict-prototypes
221 WARNING_OPTS
+= -Wmissing-prototypes
222 WARNING_OPTS
+= -Wmissing-declarations
223 WARNING_OPTS
+= -Winline
224 WARNING_OPTS
+= -Waggregate-return
225 WARNING_OPTS
+= -Wpointer-arith
226 WARNING_OPTS
+= -Wmissing-noreturn
227 WARNING_OPTS
+= -Wnested-externs
228 WARNING_OPTS
+= -Wredundant-decls
230 # These ones are hard to avoid:
231 #WARNING_OPTS += -Wconversion
232 #WARNING_OPTS += -Wbad-function-cast
233 #WARNING_OPTS += -Wshadow
234 #WARNING_OPTS += -Wcast-qual
236 # This one seems buggy on GCC 4.1.2, which is the only GCC version we
237 # have that can bootstrap the SPARC build. We end up with lots of supurious
238 # warnings of the form "cast increases required alignment of target type".
239 # Some legitimate warnings can be fixed by adding an intermediate cast to
240 # (void*), but we get others in rts/sm/GCUtils.c concerning the gct var
241 # that look innocuous to me. We could enable this again once we deprecate
242 # support for registerised builds on this arch. -- BL 2010/02/03
243 # WARNING_OPTS += -Wcast-align
245 STANDARD_OPTS
+= -Iincludes
-Irts
246 # COMPILING_RTS is only used when building Win32 DLL support.
247 STANDARD_OPTS
+= -DCOMPILING_RTS
249 # HC_OPTS is included in both .c and .cmm compilations, whereas CC_OPTS is
250 # only included in .c compilations. HC_OPTS included the WAY_* opts, which
251 # must be included in both types of compilations.
253 rts_CC_OPTS
+= $(WARNING_OPTS
)
254 rts_CC_OPTS
+= $(STANDARD_OPTS
)
256 rts_HC_OPTS
+= $(STANDARD_OPTS
) -package-name rts
258 ifneq "$(GhcWithSMP)" "YES"
259 rts_CC_OPTS
+= -DNOSMP
260 rts_HC_OPTS
+= -optc-DNOSMP
263 ifeq "$(UseLibFFIForAdjustors)" "YES"
264 rts_CC_OPTS
+= -DUSE_LIBFFI_FOR_ADJUSTORS
267 # Mac OS X: make sure we compile for the right OS version
268 rts_CC_OPTS
+= $(MACOSX_DEPLOYMENT_CC_OPTS
)
269 rts_HC_OPTS
+= $(addprefix -optc
, $(MACOSX_DEPLOYMENT_CC_OPTS
))
270 rts_LD_OPTS
+= $(addprefix -optl
, $(MACOSX_DEPLOYMENT_LD_OPTS
))
272 # We *want* type-checking of hand-written cmm.
273 rts_HC_OPTS
+= -dcmm-lint
275 # -fno-strict-aliasing is required for the runtime, because we often
276 # use a variety of types to represent closure pointers (StgPtr,
277 # StgClosure, StgMVar, etc.), and without -fno-strict-aliasing gcc is
278 # allowed to assume that these pointers do not alias. eg. without
279 # this flag we get problems in sm/Evac.c:copy() with gcc 3.4.3, the
280 # upd_evacee() assigments get moved before the object copy.
281 rts_CC_OPTS
+= -fno-strict-aliasing
283 rts_CC_OPTS
+= -fno-common
285 ifeq "$(BeConservative)" "YES"
286 rts_CC_OPTS
+= -DBE_CONSERVATIVE
289 #-----------------------------------------------------------------------------
290 # Flags for compiling specific files
292 # If RtsMain.c is built with optimisation then the SEH exception stuff on
293 # Windows gets confused.
294 # This has to be in HC rather than CC opts, as otherwise there's a
295 # -optc-O2 that comes after it.
296 rts
/RtsMain_HC_OPTS
+= -optc-O0
298 rts
/RtsMessages_CC_OPTS
+= -DProjectVersion
=\"$(ProjectVersion
)\"
299 rts
/RtsUtils_CC_OPTS
+= -DProjectVersion
=\"$(ProjectVersion
)\"
300 rts
/Trace_CC_OPTS
+= -DProjectVersion
=\"$(ProjectVersion
)\"
302 rts
/RtsUtils_CC_OPTS
+= -DHostPlatform
=\"$(HOSTPLATFORM
)\"
303 rts
/RtsUtils_CC_OPTS
+= -DHostArch
=\"$(HostArch_CPP
)\"
304 rts
/RtsUtils_CC_OPTS
+= -DHostOS
=\"$(HostOS_CPP
)\"
305 rts
/RtsUtils_CC_OPTS
+= -DHostVendor
=\"$(HostVendor_CPP
)\"
307 rts
/RtsUtils_CC_OPTS
+= -DBuildPlatform
=\"$(BUILDPLATFORM
)\"
308 rts
/RtsUtils_CC_OPTS
+= -DBuildArch
=\"$(BuildArch_CPP
)\"
309 rts
/RtsUtils_CC_OPTS
+= -DBuildOS
=\"$(BuildOS_CPP
)\"
310 rts
/RtsUtils_CC_OPTS
+= -DBuildVendor
=\"$(BuildVendor_CPP
)\"
312 rts
/RtsUtils_CC_OPTS
+= -DTargetPlatform
=\"$(TARGETPLATFORM
)\"
313 rts
/RtsUtils_CC_OPTS
+= -DTargetArch
=\"$(TargetArch_CPP
)\"
314 rts
/RtsUtils_CC_OPTS
+= -DTargetOS
=\"$(TargetOS_CPP
)\"
315 rts
/RtsUtils_CC_OPTS
+= -DTargetVendor
=\"$(TargetVendor_CPP
)\"
317 rts
/RtsUtils_CC_OPTS
+= -DGhcUnregisterised
=\"$(GhcUnregisterised
)\"
318 rts
/RtsUtils_CC_OPTS
+= -DGhcEnableTablesNextToCode
=\"$(GhcEnableTablesNextToCode
)\"
320 # Compile various performance-critical pieces *without* -fPIC -dynamic
321 # even when building a shared library. If we don't do this, then the
322 # GC runs about 50% slower on x86 due to the overheads of PIC. The
323 # cost of doing this is a little runtime linking and less sharing, but
326 # On x86_64 this doesn't work, because all objects in a shared library
327 # must be compiled with -fPIC (since the 32-bit relocations generated
328 # by the default small memory can't be resolved at runtime). So we
329 # only do this on i386.
331 # This apparently doesn't work on OS X (Darwin) nor on Solaris.
332 # On Darwin we get errors of the form
334 # 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
336 # and lots of these warnings:
338 # ld: warning codegen in _stg_ap_pppv_fast (offset 0x0000005E) prevents image from loading in dyld shared cache
340 # On Solaris we get errors like:
342 # Text relocation remains referenced
343 # against symbol offset in file
344 # .rodata (section) 0x11 rts/dist/build/Apply.dyn_o
346 # ld: fatal: relocations remain against allocatable but non-writable sections
347 # collect2: ld returned 1 exit status
349 ifeq "$(TargetArch_CPP)" "i386"
350 i386_SPEED_HACK
:= "YES"
351 ifeq "$(TargetOS_CPP)" "darwin"
352 i386_SPEED_HACK
:= "NO"
354 ifeq "$(TargetOS_CPP)" "solaris2"
355 i386_SPEED_HACK
:= "NO"
359 ifeq "$(TargetArch_CPP)" "i386"
360 ifeq "$(i386_SPEED_HACK)" "YES"
361 rts
/sm
/Evac_HC_OPTS
+= -fno-PIC
362 rts
/sm
/Evac_thr_HC_OPTS
+= -fno-PIC
363 rts
/sm
/Scav_HC_OPTS
+= -fno-PIC
364 rts
/sm
/Scav_thr_HC_OPTS
+= -fno-PIC
365 rts
/sm
/Compact_HC_OPTS
+= -fno-PIC
366 rts
/sm
/GC_HC_OPTS
+= -fno-PIC
368 # -static is also necessary for these bits, otherwise the NCG
369 # -generates dynamic references:
370 rts
/Updates_HC_OPTS
+= -fno-PIC
-static
371 rts
/StgMiscClosures_HC_OPTS
+= -fno-PIC
-static
372 rts
/PrimOps_HC_OPTS
+= -fno-PIC
-static
373 rts
/Apply_HC_OPTS
+= -fno-PIC
-static
374 rts
/dist/build
/AutoApply_HC_OPTS
+= -fno-PIC
-static
378 # ffi.h triggers prototype warnings, so disable them here:
379 rts
/Interpreter_CC_OPTS
+= -Wno-strict-prototypes
380 rts
/Adjustor_CC_OPTS
+= -Wno-strict-prototypes
381 rts
/sm
/Storage_CC_OPTS
+= -Wno-strict-prototypes
383 # inlining warnings happen in Compact
384 rts
/sm
/Compact_CC_OPTS
+= -Wno-inline
386 # emits warnings about call-clobbered registers on x86_64
387 rts
/StgCRun_CC_OPTS
+= -w
389 rts
/RetainerProfile_CC_OPTS
+= -w
390 rts
/RetainerSet_CC_OPTS
+= -Wno-format
392 rts
/win32
/ConsoleHandler_CC_OPTS
+= -w
393 rts
/win32
/ThrIOManager_CC_OPTS
+= -w
394 # The above warning supression flags are a temporary kludge.
395 # While working on this module you are encouraged to remove it and fix
396 # any warnings in the module. See
397 # http://hackage.haskell.org/trac/ghc/wiki/WorkingConventions#Warnings
400 # Without this, thread_obj will not be inlined (at least on x86 with GCC 4.1.0)
401 rts
/sm
/Compact_CC_OPTS
+= -finline-limit
=2500
403 # -O3 helps unroll some loops (especially in copy() with a constant argument).
404 rts
/sm
/Evac_CC_OPTS
+= -funroll-loops
405 rts
/dist/build
/sm
/Evac_thr_HC_OPTS
+= -optc-funroll-loops
407 # These files are just copies of sm/Evac.c and sm/Scav.c respectively,
408 # but compiled with -DPARALLEL_GC.
409 rts
/dist/build
/sm
/Evac_thr_CC_OPTS
+= -DPARALLEL_GC
-Irts
/sm
410 rts
/dist/build
/sm
/Scav_thr_CC_OPTS
+= -DPARALLEL_GC
-Irts
/sm
412 #-----------------------------------------------------------------------------
413 # Add PAPI library if needed
415 ifeq "$(GhcRtsWithPapi)" "YES"
417 rts_CC_OPTS
+= -DUSE_PAPI
419 rts_PACKAGE_CPP_OPTS
+= -DUSE_PAPI
420 rts_PACKAGE_CPP_OPTS
+= -DPAPI_INCLUDE_DIR
=$(PapiIncludeDir
)
421 rts_PACKAGE_CPP_OPTS
+= -DPAPI_LIB_DIR
=$(PapiLibDir
)
423 ifneq "$(PapiIncludeDir)" ""
424 rts_HC_OPTS
+= -I
$(PapiIncludeDir
)
425 rts_CC_OPTS
+= -I
$(PapiIncludeDir
)
426 rts_HSC2HS_OPTS
+= -I
$(PapiIncludeDir
)
428 ifneq "$(PapiLibDirs)" ""
429 rts_LD_OPTS
+= -L
$(PapiLibDirs
)
432 else # GhcRtsWithPapi==YES
434 rts_PACKAGE_CPP_OPTS
+= -DPAPI_INCLUDE_DIR
=""
435 rts_PACKAGE_CPP_OPTS
+= -DPAPI_LIB_DIR
=""
439 # -----------------------------------------------------------------------------
442 rts_WAYS_DASHED
= $(subst $(space
),,$(patsubst %,-%,$(strip $(rts_WAYS
))))
443 rts_dist_depfile_base
= rts
/dist/build
/.depend
$(rts_WAYS_DASHED
)
445 rts_dist_C_SRCS
= $(rts_C_SRCS
) $(rts_thr_EXTRA_C_SRCS
)
446 rts_dist_S_SRCS
= $(rts_S_SRCS
)
447 rts_dist_C_FILES
= $(rts_C_SRCS
) $(rts_thr_EXTRA_C_SRCS
) $(rts_S_SRCS
)
449 # Hack: we define every way-related option here, so that we get (hopefully)
450 # a superset of the dependencies. To do this properly, we should generate
451 # a different set of dependencies for each way. Further hack: PROFILING an
453 # TICKY_TICKY can't be used together, so we omit TICKY_TICKY for now.
454 rts_dist_MKDEPENDC_OPTS
+= -DPROFILING
-DTHREADED_RTS
-DDEBUG
456 ifeq "$(USE_DTRACE)" "YES"
458 rts_dist_MKDEPENDC_OPTS
+= -Irts
/dist/build
462 $(eval
$(call dependencies
,rts
,dist,1))
464 $(rts_dist_depfile_c_asm
) : $(ffi_HEADER
) $(DTRACEPROBES_H
)
466 # -----------------------------------------------------------------------------
467 # compile dtrace probes if dtrace is supported
469 ifeq "$(USE_DTRACE)" "YES"
471 rts_CC_OPTS
+= -DDTRACE
472 rts_HC_OPTS
+= -DDTRACE
474 # Apple's dtrace (the only one supported by ghc at the moment) uses
475 # gcc as its preprocessor. If gcc isn't at /usr/bin/gcc, or we need
476 # to force it to use a different gcc, we need to give the path in
477 # the option cpppath.
479 ifeq "$(TargetOS_CPP)" "darwin"
480 # Darwin has a flag to tell dtrace which cpp to use.
481 # Unfortunately, this isn't supported on Solaris (See Solaris Dynamic Tracing
482 # Guide, Chapter 16, for the configuration variables available on Solaris)
483 DTRACE_FLAGS
= -x cpppath
=$(WhatGccIsCalled
)
486 DTRACEPROBES_SRC
= rts
/RtsProbes.d
487 $(DTRACEPROBES_H
): $(DTRACEPROBES_SRC
) includes
/ghcplatform.h |
$$(dir $$@
)/.
488 "$(DTRACE)" $(filter -I
%,$(rts_CC_OPTS
)) -C
$(DTRACE_FLAGS
) -h
-o
$@
-s
$<
491 # -----------------------------------------------------------------------------
492 # build the static lib containing the C main symbol
494 ifneq "$(BINDIST)" "YES"
495 rts
/dist/build
/libHSrtsmain.a
: rts
/dist/build
/Main.o
496 "$(RM)" $(RM_OPTS
) $@
497 "$(AR_STAGE1)" $(AR_OPTS_STAGE1
) $(EXTRA_AR_ARGS_STAGE1
) $@
$<
500 # -----------------------------------------------------------------------------
501 # The RTS package config
503 # If -DDEBUG is in effect, adjust package conf accordingly..
504 ifneq "$(strip $(filter -optc-DDEBUG,$(GhcRtsHcOpts)))" ""
505 rts_PACKAGE_CPP_OPTS
+= -DDEBUG
508 ifeq "$(HaveLibMingwEx)" "YES"
509 rts_PACKAGE_CPP_OPTS
+= -DHAVE_LIBMINGWEX
512 $(eval
$(call manual-package-config
,rts
))
514 ifneq "$(BootingFromHc)" "YES"
515 rts
/package.conf.inplace
: $(includes_H_CONFIG
) $(includes_H_PLATFORM
)
518 # -----------------------------------------------------------------------------
521 INSTALL_LIBS
+= $(ALL_RTS_LIBS
)
523 # -----------------------------------------------------------------------------
526 $(eval
$(call clean-target
,rts
,dist,rts
/dist))
528 BINDIST_EXTRAS
+= rts
/package.conf.in