From 39f28cc45c13888c4294db0ff75dd374b583cf88 Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Sat, 16 Mar 2013 00:07:50 +0100 Subject: Partial support for dynamic ghc on Windows --- rules/build-prog.mk | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/rules/build-prog.mk b/rules/build-prog.mk index 81f2ef2ad9..28273c70ca 100644 --- a/rules/build-prog.mk +++ b/rules/build-prog.mk @@ -197,7 +197,7 @@ endif ifneq "$$(BINDIST)" "YES" # The quadrupled $'s here are because the __LIB variables aren't # necessarily set when this part of the makefile is read -$1/$2/build/tmp/$$($1_$2_PROG) : \ +$1/$2/build/tmp/$$($1_$2_PROG) $1/$2/build/tmp/$$($1_$2_PROG).dll : \ $$(foreach dep,$$($1_$2_DEPS),\ $$(if $$(filter ghc%,$$(dep)),\ $(if $(filter 0,$3),$$(compiler_stage1_PROGRAM_DEP_LIB),\ @@ -206,6 +206,13 @@ $1/$2/build/tmp/$$($1_$2_PROG) : \ $$(error Bad build stage)))),\ $$$$($$(dep)_dist-$(if $(filter 0,$3),boot,install)_PROGRAM_DEP_LIB))) +ifeq "$$(Windows_Host) $$($1_$2_PROGRAM_WAY)" "YES dyn" +$1/$2/build/tmp/$$($1_$2_PROG) : $1/$2/build/tmp/$$($1_$2_PROG).c $1/$2/build/tmp/$$($1_$2_PROG).dll | $$$$(dir $$$$@)/. + $$(call cmd,$1_$2_HC) -no-hs-main -optc-g -optc-O0 $$< -o $$@ + +$1/$2/build/tmp/$$($1_$2_PROG).dll : $$($1_$2_$$($1_$2_PROGRAM_WAY)_HS_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_C_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_S_OBJS) $$($1_$2_OTHER_OBJS) | $$$$(dir $$$$@)/. + $$(call build-dll,$1,$2,$$($1_$2_PROGRAM_WAY),,$$($1_$2_$$($1_$2_PROGRAM_WAY)_HS_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_C_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_S_OBJS) $$($1_$2_OTHER_OBJS),$$@) +else ifeq "$$($1_$2_LINK_WITH_GCC)" "NO" $1/$2/build/tmp/$$($1_$2_PROG) : $$($1_$2_$$($1_$2_PROGRAM_WAY)_HS_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_C_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_S_OBJS) $$($1_$2_OTHER_OBJS) | $$$$(dir $$$$@)/. $$(call cmd,$1_$2_HC) -o $$@ $$($1_$2_$$($1_$2_PROGRAM_WAY)_ALL_HC_OPTS) $$(LD_OPTS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_GHC_LD_OPTS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_HS_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_C_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_S_OBJS) $$($1_$2_OTHER_OBJS) $$(addprefix -l,$$($1_$2_EXTRA_LIBRARIES)) @@ -224,6 +231,7 @@ else $1/$2/build/tmp/$$($1_$2_PROG) : $$($1_$2_$$($1_$2_PROGRAM_WAY)_HS_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_C_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_S_OBJS) $$($1_$2_OTHER_OBJS) | $$$$(dir $$$$@)/. $$(call cmd,$1_$2_CC) -o $$@ $$($1_$2_$$($1_$2_PROGRAM_WAY)_ALL_CC_OPTS) $$(LD_OPTS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_HS_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_C_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_S_OBJS) $$($1_$2_OTHER_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_EXTRA_CC_OPTS) $$(addprefix -l,$$($1_$2_EXTRA_LIBRARIES)) endif +endif # Note [lib-depends] if this program is built with stage1 or greater, we # need to depend on the libraries too. NB. since $(ALL_STAGE1_LIBS) and -- cgit v1.2.1