Add stage-specific versions of more ar-related makefile vars
[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 = rts/dist/build/libHSrtsmain.a \
24 $(foreach way,$(rts_WAYS),rts/dist/build/libHSrts$($(way)_libsuf))
25 all_rts : $(ALL_RTS_LIBS)
26
27 # -----------------------------------------------------------------------------
28 # Defining the sources
29
30 ALL_DIRS = hooks parallel sm eventlog
31
32 ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
33 ALL_DIRS += win32
34 else
35 ALL_DIRS += posix
36 endif
37
38 EXCLUDED_SRCS :=
39 EXCLUDED_SRCS += rts/Main.c
40 EXCLUDED_SRCS += rts/parallel/SysMan.c
41 EXCLUDED_SRCS += $(wildcard rts/Vis*.c)
42
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)
45
46 # Don't compile .S files when bootstrapping a new arch
47 ifneq "$(PORTING_HOST)" "YES"
48 ifneq "$(findstring $(TargetArch_CPP), powerpc powerpc64)" ""
49 rts_S_SRCS += rts/AdjustorAsm.S
50 else
51 ifneq "$(findstring $(TargetOS_CPP), darwin)" ""
52 rts_S_SRCS += rts/AdjustorAsm.S
53 endif
54 endif
55 endif
56
57 ifeq "$(GhcUnregisterised)" "YES"
58 GENAPPLY_OPTS = -u
59 endif
60
61 rts_AUTO_APPLY_CMM = rts/dist/build/AutoApply.cmm
62
63 $(rts_AUTO_APPLY_CMM): $(GENAPPLY_INPLACE)
64 "$(GENAPPLY_INPLACE)" >$@
65
66 rts/dist/build/sm/Evac_thr.c : rts/sm/Evac.c | $$(dir $$@)/.
67 cp $< $@
68 rts/dist/build/sm/Scav_thr.c : rts/sm/Scav.c | $$(dir $$@)/.
69 cp $< $@
70
71 rts_H_FILES := $(wildcard rts/*.h)
72
73 ifeq "$(USE_DTRACE)" "YES"
74 DTRACEPROBES_H = rts/dist/build/RtsProbes.h
75 rts_H_FILES += $(DTRACEPROBES_H)
76 endif
77
78 # collect the -l flags that we need to link the rts dyn lib.
79 rts/libs.depend : $(GHC_PKG_INPLACE)
80 "$(GHC_PKG_INPLACE)" field rts extra-libraries \
81 | sed -e 's/^extra-libraries: //' -e 's/\([a-z0-9]*\)[ ]*/-l\1 /g' > $@
82
83
84 # ----------------------------------------------------------------------------
85 # On Windows, as the RTS and base libraries have recursive imports,
86 # we have to break the loop with "import libraries".
87 # These are made from rts/win32/libHS*.def which contain lists of
88 # all the symbols in those libraries used by the RTS.
89 #
90 ifneq "$$(findstring dyn, $1)" ""
91 ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
92
93 ALL_RTS_DEF_LIBNAMES = base ghc-prim
94 ALL_RTS_DEF_LIBS = \
95 rts/dist/build/win32/libHSbase.dll.a \
96 rts/dist/build/win32/libHSghc-prim.dll.a \
97 rts/dist/build/win32/libHSffi.dll.a
98
99 # -- import libs for the regular Haskell libraries
100 define make-importlib-def # args $1 = lib name
101 rts/dist/build/win32/libHS$1.def : rts/win32/libHS$1.def
102 cat rts/win32/libHS$1.def \
103 | sed "s/@LibVersion@/$$(libraries/$1_dist-install_VERSION)/" \
104 | sed "s/@ProjectVersion@/$(ProjectVersion)/" \
105 > rts/dist/build/win32/libHS$1.def
106
107 rts/dist/build/win32/libHS$1.dll.a : rts/dist/build/win32/libHS$1.def
108 "$$(DLLTOOL)" -d rts/dist/build/win32/libHS$1.def \
109 -l rts/dist/build/win32/libHS$1.dll.a
110 endef
111 $(foreach lib,$(ALL_RTS_DEF_LIBNAMES),$(eval $(call make-importlib-def,$(lib))))
112
113
114 # -- import libs for libffi
115 rts/dist/build/win32/libHSffi.def : rts/win32/libHSffi.def
116 cat rts/win32/libHSffi.def \
117 | sed "s/@ProjectVersion@/$(ProjectVersion)/" \
118 > rts/dist/build/win32/libHSffi.def
119
120 rts/dist/build/win32/libHSffi.dll.a : rts/dist/build/win32/libHSffi.def
121 "$(DLLTOOL)" -d rts/dist/build/win32/libHSffi.def \
122 -l rts/dist/build/win32/libHSffi.dll.a
123 endif
124 endif
125
126
127 #-----------------------------------------------------------------------------
128 # Building one way
129 define build-rts-way # args: $1 = way
130
131 ifneq "$$(BINDIST)" "YES"
132
133 # The per-way CC_OPTS
134 ifneq "$$(findstring debug, $1)" ""
135 rts_dist_$1_HC_OPTS =
136 rts_dist_$1_CC_OPTS = -g -O0
137 else
138 rts_dist_$1_HC_OPTS = $$(GhcRtsHcOpts)
139 rts_dist_$1_CC_OPTS = $$(GhcRtsCcOpts)
140 endif
141
142 ifneq "$$(findstring thr, $1)" ""
143 rts_$1_EXTRA_C_SRCS = rts/dist/build/sm/Evac_thr.c rts/dist/build/sm/Scav_thr.c
144 endif
145
146 $(call distdir-way-opts,rts,dist,$1)
147 $(call c-suffix-rules,rts,dist,$1,YES)
148 $(call cmm-suffix-rules,rts,dist,$1)
149 $(call hs-suffix-rules-srcdir,rts,dist,$1,.)
150 # hs-suffix-rules-srcdir is needed when BootingFromHc to get the .hc rules
151
152 rts_$1_LIB_NAME = libHSrts$$($1_libsuf)
153 rts_$1_LIB = rts/dist/build/$$(rts_$1_LIB_NAME)
154
155 rts_$1_C_OBJS = $$(patsubst rts/%.c,rts/dist/build/%.$$($1_osuf),$$(rts_C_SRCS)) $$(patsubst %.c,%.$$($1_osuf),$$(rts_$1_EXTRA_C_SRCS))
156 rts_$1_S_OBJS = $$(patsubst rts/%.S,rts/dist/build/%.$$($1_osuf),$$(rts_S_SRCS))
157 rts_$1_CMM_OBJS = $$(patsubst rts/%.cmm,rts/dist/build/%.$$($1_osuf),$$(rts_CMM_SRCS)) $$(patsubst %.cmm,%.$$($1_osuf),$$(rts_AUTO_APPLY_CMM))
158
159 rts_$1_OBJS = $$(rts_$1_C_OBJS) $$(rts_$1_S_OBJS) $$(rts_$1_CMM_OBJS)
160
161 ifeq "$(USE_DTRACE)" "YES"
162 ifeq "$(TargetOS_CPP)" "solaris2"
163 # On Darwin we don't need to generate binary containing probes defined
164 # in DTrace script, but DTrace on Solaris expects generation of binary
165 # from the DTrace probes definitions
166 rts_$1_DTRACE_OBJS = rts/dist/build/RtsProbes.$$($1_osuf)
167
168 rts/dist/build/RtsProbes.$$($1_osuf) : $$(rts_$1_OBJS)
169 $(DTRACE) -G -C -Iincludes -DDTRACE -s rts/RtsProbes.d -o \
170 $$@ $$(rts_$1_OBJS)
171 endif
172 endif
173
174 rts_dist_$1_CC_OPTS += -DRtsWay=\"rts_$1\"
175
176 # Making a shared library for the RTS.
177 ifneq "$$(findstring dyn, $1)" ""
178 ifeq "$$(HOSTPLATFORM)" "i386-unknown-mingw32"
179 $$(rts_$1_LIB) : $$(rts_$1_OBJS) $$(ALL_RTS_DEF_LIBS) rts/libs.depend
180 "$$(RM)" $$(RM_OPTS) $$@
181 "$$(rts_dist_HC)" -package-name rts -shared -dynamic -dynload deploy \
182 -no-auto-link-packages `cat rts/libs.depend` $$(rts_$1_OBJS) $$(ALL_RTS_DEF_LIBS) -o $$@
183 else
184 $$(rts_$1_LIB) : $$(rts_$1_OBJS) $$(rts_$1_DTRACE_OBJS) rts/libs.depend
185 "$$(RM)" $$(RM_OPTS) $$@
186 "$$(rts_dist_HC)" -package-name rts -shared -dynamic -dynload deploy \
187 -no-auto-link-packages `cat rts/libs.depend` $$(rts_$1_OBJS) \
188 $$(rts_$1_DTRACE_OBJS) -o $$@
189 ifeq "$$(darwin_HOST_OS)" "1"
190 # Ensure library's install name is correct before anyone links with it.
191 install_name_tool -id $(ghclibdir)/$$(rts_$1_LIB_NAME) $$@
192 endif
193 endif
194 else
195 $$(rts_$1_LIB) : $$(rts_$1_OBJS) $$(rts_$1_DTRACE_OBJS)
196 "$$(RM)" $$(RM_OPTS) $$@
197 echo $$(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 += -Iincludes -Irts
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 #
299 rts/RtsUtils_CC_OPTS += -DHostPlatform=\"$(HOSTPLATFORM)\"
300 rts/RtsUtils_CC_OPTS += -DHostArch=\"$(HostArch_CPP)\"
301 rts/RtsUtils_CC_OPTS += -DHostOS=\"$(HostOS_CPP)\"
302 rts/RtsUtils_CC_OPTS += -DHostVendor=\"$(HostVendor_CPP)\"
303 #
304 rts/RtsUtils_CC_OPTS += -DBuildPlatform=\"$(BUILDPLATFORM)\"
305 rts/RtsUtils_CC_OPTS += -DBuildArch=\"$(BuildArch_CPP)\"
306 rts/RtsUtils_CC_OPTS += -DBuildOS=\"$(BuildOS_CPP)\"
307 rts/RtsUtils_CC_OPTS += -DBuildVendor=\"$(BuildVendor_CPP)\"
308 #
309 rts/RtsUtils_CC_OPTS += -DTargetPlatform=\"$(TARGETPLATFORM)\"
310 rts/RtsUtils_CC_OPTS += -DTargetArch=\"$(TargetArch_CPP)\"
311 rts/RtsUtils_CC_OPTS += -DTargetOS=\"$(TargetOS_CPP)\"
312 rts/RtsUtils_CC_OPTS += -DTargetVendor=\"$(TargetVendor_CPP)\"
313 #
314 rts/RtsUtils_CC_OPTS += -DGhcUnregisterised=\"$(GhcUnregisterised)\"
315 rts/RtsUtils_CC_OPTS += -DGhcEnableTablesNextToCode=\"$(GhcEnableTablesNextToCode)\"
316
317 # Compile various performance-critical pieces *without* -fPIC -dynamic
318 # even when building a shared library. If we don't do this, then the
319 # GC runs about 50% slower on x86 due to the overheads of PIC. The
320 # cost of doing this is a little runtime linking and less sharing, but
321 # not much.
322 #
323 # On x86_64 this doesn't work, because all objects in a shared library
324 # must be compiled with -fPIC (since the 32-bit relocations generated
325 # by the default small memory can't be resolved at runtime). So we
326 # only do this on i386.
327 #
328 # This apparently doesn't work on OS X (Darwin) nor on Solaris.
329 # On Darwin we get errors of the form
330 #
331 # 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
332 #
333 # and lots of these warnings:
334 #
335 # ld: warning codegen in _stg_ap_pppv_fast (offset 0x0000005E) prevents image from loading in dyld shared cache
336 #
337 # On Solaris we get errors like:
338 #
339 # Text relocation remains referenced
340 # against symbol offset in file
341 # .rodata (section) 0x11 rts/dist/build/Apply.dyn_o
342 # ...
343 # ld: fatal: relocations remain against allocatable but non-writable sections
344 # collect2: ld returned 1 exit status
345
346 ifeq "$(TargetArch_CPP)" "i386"
347 i386_SPEED_HACK := "YES"
348 ifeq "$(TargetOS_CPP)" "darwin"
349 i386_SPEED_HACK := "NO"
350 endif
351 ifeq "$(TargetOS_CPP)" "solaris2"
352 i386_SPEED_HACK := "NO"
353 endif
354 endif
355
356 ifeq "$(TargetArch_CPP)" "i386"
357 ifeq "$(i386_SPEED_HACK)" "YES"
358 rts/sm/Evac_HC_OPTS += -fno-PIC
359 rts/sm/Evac_thr_HC_OPTS += -fno-PIC
360 rts/sm/Scav_HC_OPTS += -fno-PIC
361 rts/sm/Scav_thr_HC_OPTS += -fno-PIC
362 rts/sm/Compact_HC_OPTS += -fno-PIC
363 rts/sm/GC_HC_OPTS += -fno-PIC
364
365 # -static is also necessary for these bits, otherwise the NCG
366 # -generates dynamic references:
367 rts/Updates_HC_OPTS += -fno-PIC -static
368 rts/StgMiscClosures_HC_OPTS += -fno-PIC -static
369 rts/PrimOps_HC_OPTS += -fno-PIC -static
370 rts/Apply_HC_OPTS += -fno-PIC -static
371 rts/dist/build/AutoApply_HC_OPTS += -fno-PIC -static
372 endif
373 endif
374
375 # ffi.h triggers prototype warnings, so disable them here:
376 rts/Interpreter_CC_OPTS += -Wno-strict-prototypes
377 rts/Adjustor_CC_OPTS += -Wno-strict-prototypes
378 rts/sm/Storage_CC_OPTS += -Wno-strict-prototypes
379
380 # inlining warnings happen in Compact
381 rts/sm/Compact_CC_OPTS += -Wno-inline
382
383 # emits warnings about call-clobbered registers on x86_64
384 rts/StgCRun_CC_OPTS += -w
385
386 rts/RetainerProfile_CC_OPTS += -w
387 rts/RetainerSet_CC_OPTS += -Wno-format
388 # On Windows:
389 rts/win32/ConsoleHandler_CC_OPTS += -w
390 rts/win32/ThrIOManager_CC_OPTS += -w
391 # The above warning supression flags are a temporary kludge.
392 # While working on this module you are encouraged to remove it and fix
393 # any warnings in the module. See
394 # http://hackage.haskell.org/trac/ghc/wiki/WorkingConventions#Warnings
395 # for details
396
397 # Without this, thread_obj will not be inlined (at least on x86 with GCC 4.1.0)
398 rts/sm/Compact_CC_OPTS += -finline-limit=2500
399
400 # -O3 helps unroll some loops (especially in copy() with a constant argument).
401 rts/sm/Evac_CC_OPTS += -funroll-loops
402 rts/dist/build/sm/Evac_thr_HC_OPTS += -optc-funroll-loops
403
404 # These files are just copies of sm/Evac.c and sm/Scav.c respectively,
405 # but compiled with -DPARALLEL_GC.
406 rts/dist/build/sm/Evac_thr_CC_OPTS += -DPARALLEL_GC -Irts/sm
407 rts/dist/build/sm/Scav_thr_CC_OPTS += -DPARALLEL_GC -Irts/sm
408
409 #-----------------------------------------------------------------------------
410 # Add PAPI library if needed
411
412 ifeq "$(GhcRtsWithPapi)" "YES"
413
414 rts_CC_OPTS += -DUSE_PAPI
415
416 rts_PACKAGE_CPP_OPTS += -DUSE_PAPI
417 rts_PACKAGE_CPP_OPTS += -DPAPI_INCLUDE_DIR=$(PapiIncludeDir)
418 rts_PACKAGE_CPP_OPTS += -DPAPI_LIB_DIR=$(PapiLibDir)
419
420 ifneq "$(PapiIncludeDir)" ""
421 rts_HC_OPTS += -I$(PapiIncludeDir)
422 rts_CC_OPTS += -I$(PapiIncludeDir)
423 rts_HSC2HS_OPTS += -I$(PapiIncludeDir)
424 endif
425 ifneq "$(PapiLibDirs)" ""
426 rts_LD_OPTS += -L$(PapiLibDirs)
427 endif
428
429 else # GhcRtsWithPapi==YES
430
431 rts_PACKAGE_CPP_OPTS += -DPAPI_INCLUDE_DIR=""
432 rts_PACKAGE_CPP_OPTS += -DPAPI_LIB_DIR=""
433
434 endif
435
436 # -----------------------------------------------------------------------------
437 # dependencies
438
439 rts_WAYS_DASHED = $(subst $(space),,$(patsubst %,-%,$(strip $(rts_WAYS))))
440 rts_dist_depfile_base = rts/dist/build/.depend$(rts_WAYS_DASHED)
441
442 rts_dist_C_SRCS = $(rts_C_SRCS) $(rts_thr_EXTRA_C_SRCS)
443 rts_dist_S_SRCS = $(rts_S_SRCS)
444 rts_dist_C_FILES = $(rts_C_SRCS) $(rts_thr_EXTRA_C_SRCS) $(rts_S_SRCS)
445
446 # Hack: we define every way-related option here, so that we get (hopefully)
447 # a superset of the dependencies. To do this properly, we should generate
448 # a different set of dependencies for each way. Further hack: PROFILING an
449
450 # TICKY_TICKY can't be used together, so we omit TICKY_TICKY for now.
451 rts_dist_MKDEPENDC_OPTS += -DPROFILING -DTHREADED_RTS -DDEBUG
452
453 ifeq "$(USE_DTRACE)" "YES"
454
455 rts_dist_MKDEPENDC_OPTS += -Irts/dist/build
456
457 endif
458
459 $(eval $(call dependencies,rts,dist,1))
460
461 $(rts_dist_depfile_c_asm) : libffi/dist-install/build/ffi.h $(DTRACEPROBES_H)
462
463 #-----------------------------------------------------------------------------
464 # libffi stuff
465
466 rts_CC_OPTS += -Ilibffi/build/include
467 rts_HC_OPTS += -Ilibffi/build/include
468 rts_HSC2HS_OPTS += -Ilibffi/build/include
469 rts_LD_OPTS += -Llibffi/build/include
470
471 # -----------------------------------------------------------------------------
472 # compile dtrace probes if dtrace is supported
473
474 ifeq "$(USE_DTRACE)" "YES"
475
476 rts_CC_OPTS += -DDTRACE
477 rts_HC_OPTS += -DDTRACE
478
479 # Apple's dtrace (the only one supported by ghc at the moment) uses
480 # gcc as its preprocessor. If gcc isn't at /usr/bin/gcc, or we need
481 # to force it to use a different gcc, we need to give the path in
482 # the option cpppath.
483
484 ifeq "$(TargetOS_CPP)" "darwin"
485 # Darwin has a flag to tell dtrace which cpp to use.
486 # Unfortunately, this isn't supported on Solaris (See Solaris Dynamic Tracing
487 # Guide, Chapter 16, for the configuration variables available on Solaris)
488 DTRACE_FLAGS = -x cpppath=$(WhatGccIsCalled)
489 endif
490
491 DTRACEPROBES_SRC = rts/RtsProbes.d
492 $(DTRACEPROBES_H): $(DTRACEPROBES_SRC) includes/ghcplatform.h | $$(dir $$@)/.
493 "$(DTRACE)" $(filter -I%,$(rts_CC_OPTS)) -C $(DTRACE_FLAGS) -h -o $@ -s $<
494 endif
495
496 # -----------------------------------------------------------------------------
497 # build the static lib containing the C main symbol
498
499 ifneq "$(BINDIST)" "YES"
500 rts/dist/build/libHSrtsmain.a : rts/dist/build/Main.o
501 "$(RM)" $(RM_OPTS) $@
502 "$(AR_STAGE1)" $(AR_OPTS_STAGE1) $(EXTRA_AR_ARGS_STAGE1) $@ $<
503 endif
504
505 # -----------------------------------------------------------------------------
506 # The RTS package config
507
508 # If -DDEBUG is in effect, adjust package conf accordingly..
509 ifneq "$(strip $(filter -optc-DDEBUG,$(GhcRtsHcOpts)))" ""
510 rts_PACKAGE_CPP_OPTS += -DDEBUG
511 endif
512
513 ifeq "$(HaveLibMingwEx)" "YES"
514 rts_PACKAGE_CPP_OPTS += -DHAVE_LIBMINGWEX
515 endif
516
517 $(eval $(call manual-package-config,rts))
518
519 ifneq "$(BootingFromHc)" "YES"
520 rts/package.conf.inplace : $(includes_H_CONFIG) $(includes_H_PLATFORM)
521 endif
522
523 # -----------------------------------------------------------------------------
524 # installing
525
526 INSTALL_LIBS += $(ALL_RTS_LIBS)
527
528 # -----------------------------------------------------------------------------
529 # cleaning
530
531 $(eval $(call clean-target,rts,dist,rts/dist))
532
533 BINDIST_EXTRAS += rts/package.conf.in
534