X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2FMakefile;h=2a20279382a0358c042e5b1c34d496afb4e32d3d;hb=6c3eae5d5e88117cf80b4b35c9bae4ba3ebbe94c;hp=c310ee07249e5963952b9413a1badaf09e0e46b9;hpb=a61629589f42ec2c08ad177ff24eaf53682dfb63;p=ghc-hetmet.git diff --git a/rts/Makefile b/rts/Makefile index c310ee0..2a20279 100644 --- a/rts/Makefile +++ b/rts/Makefile @@ -25,16 +25,28 @@ PACKAGE = rts HC=$(GHC_INPLACE) + +# Setting _way here is a nasty hack to make sure we get libHSrts*.a etc +# rather than just libHSrts.a when we are making and installing +# bindists. +ifeq "$(DOING_BIN_DIST)" "YES" +_way = * +endif + # ----------------------------------------------------------------------------- # RTS ways -WAYS=$(GhcLibWays) $(GhcRTSWays) +WAYS=$(strip $(GhcLibWays) $(GhcRTSWays)) ifneq "$(findstring debug, $(way))" "" GhcRtsHcOpts= GhcRtsCcOpts=-g -O0 endif +ifeq "$(BeConservative)" "YES" +GhcRtsCcOpts += -DBE_CONSERVATIVE +endif + # ----------------------------------------------------------------------------- # There's nothing for Haddock here... @@ -81,6 +93,15 @@ endif EXCLUDED_SRCS += parallel/SysMan.c +EXCLUDED_SRCS += dyn-wrapper.c + +# compile generatic patchable dyn-wrapper + +DYNWRAPPER_SRC = dyn-wrapper.c +DYNWRAPPER_PROG = dyn-wrapper$(exeext) +$(DYNWRAPPER_PROG): $(DYNWRAPPER_SRC) + $(HC) -cpp -optc-include -optcdyn-wrapper-patchable-behaviour.h $(INPLACE_EXTRA_FLAGS) $< -o $@ + # The build system doesn't give us these CMM_SRCS = $(filter-out AutoApply%.cmm, $(wildcard *.cmm)) $(EXTRA_CMM_SRCS) CMM_OBJS = $(patsubst %.cmm,%.$(way_)o, $(CMM_SRCS)) @@ -129,37 +150,40 @@ SRC_CC_OPTS += $(WARNING_OPTS) SRC_CC_OPTS += $(STANDARD_OPTS) SRC_CC_OPTS += $(GhcRtsCcOpts) -SRC_HC_OPTS += $(GhcRtsHcOpts) -package-name rts +SRC_HC_OPTS += $(GhcRtsHcOpts) $(STANDARD_OPTS) -package-name rts ifneq "$(GhcWithSMP)" "YES" SRC_CC_OPTS += -DNOSMP SRC_HC_OPTS += -optc-DNOSMP endif +ifeq "$(UseLibFFI)" "YES" +SRC_CC_OPTS += -DUSE_LIBFFI +PACKAGE_CPP_OPTS += -DUSE_LIBFFI +endif + ifneq "$(DYNAMIC_RTS)" "YES" SRC_HC_OPTS += -static else LIB_LD_OPTS += -ignore-package base -ignore-package rts ifeq "$(DYNAMIC_RTS) $(HOSTPLATFORM)" "YES i386-unknown-mingw32" -BASE_VERSION=$(strip $(shell grep version: $(TOP)/libraries/base/base.cabal | cut -f2 -d:)) -BASE_NAME=HSbase-$(BASE_VERSION)-ghc$(ProjectVersion)$(soext) +LIB_DEPS=buildbase +.PHONY: buildbase + BASE_DIST_LIB=$(TOP)/libraries/base/dist/build -BASE_IMPORT_LIBRARY=$(BASE_DIST_LIB)/lib$(BASE_NAME).a -LIB_DEPS=$(BASE_IMPORT_LIBRARY) -LIB_LD_OPTS += -L$(BASE_DIST_LIB) -l$(BASE_NAME) -# We extract a good bit of information out of the rts package.conf by going via ghc-pkg -LIB_LD_OPTS += $(foreach lib,$(shell $(GHC_PKG_INPLACE) field rts extra-libraries | sed -e s/extra-libraries://),"-l$(lib)") -LIB_LD_OPTS += $(foreach libdir,$(shell $(GHC_PKG_INPLACE) field rts library-dirs | sed -e s/library-dirs://),"-L$(libdir)") + +# The following must be a one liner otherwise its evaluation won't be delayed until base/rts packages are properly registered +LIB_LD_OPTS = -L$(shell $(GHC_PKG_INPLACE) field base library-dirs | sed -e 's/library-dirs: //') -l$(shell $(GHC_PKG_INPLACE) field base hs-libraries | sed -e 's/hs-libraries: //')-ghc$(ProjectVersion)$(soext) $(foreach lib,$(shell $(GHC_PKG_INPLACE) field rts extra-libraries | sed -e s/extra-libraries://),"-l$(lib)") $(foreach libdir,$(shell $(GHC_PKG_INPLACE) field rts library-dirs | sed -e s/library-dirs://),"-L$(libdir)") endif endif -ifeq "$(Windows)" "YES" -# On Windows GHC does its own commandline parsing, so we need extra -# doublequote protection. Sigh. -DQ = \\\" -else +# Mac OS X: make sure we compile for the right OS version +SRC_CC_OPTS += $(MACOSX_DEPLOYMENT_CC_OPTS) +SRC_HC_OPTS += $(addprefix -optc, $(MACOSX_DEPLOYMENT_CC_OPTS)) +LIB_LD_OPTS += $(addprefix -optl, $(MACOSX_DEPLOYMENT_LD_OPTS)) + +# XXX DQ is now the same on all platforms, so get rid of it DQ = \" -endif # If Main.c is built with optimisation then the SEH exception stuff on # Windows gets confused. @@ -396,10 +420,11 @@ endif include $(TOP)/mk/target.mk ifeq "$(DYNAMIC_RTS) $(HOSTPLATFORM)" "YES i386-unknown-mingw32" -$(BASE_IMPORT_LIBRARY): $(LIBRARY).a - $(MAKE) -C ../libraries/ make.library.base -# just for the timestamps - touch $(BASE_IMPORT_LIBRARY) +# $(LIBRARY).a is not the static library libHSrts.a but +# libHSrts.dll.a, the import library for dynamic linking required for +# linking the dynamic version of base +buildbase: $(LIBRARY).a + $(MAKE) way="" -C ../libraries/ make.library.base endif #-----------------------------------------------------------------------------