summaryrefslogtreecommitdiff
path: root/rules
diff options
context:
space:
mode:
authorIan Lynagh <ian@well-typed.com>2013-05-16 12:58:42 +0100
committerIan Lynagh <ian@well-typed.com>2013-05-16 21:15:09 +0100
commitc6a05a72d237cba0f17ea202f7c38ca0ac54aeb7 (patch)
treefac6610e2df0a9a3e5815920217b74bbcec13700 /rules
parent9fc2778cf20990524b13705a519b0c337ad197fe (diff)
downloadhaskell-c6a05a72d237cba0f17ea202f7c38ca0ac54aeb7.tar.gz
Make dynamic GHC no Windows installable too
We need different paths in the wrapper, as teh installed tree is a different shape to the build tree.
Diffstat (limited to 'rules')
-rw-r--r--rules/build-prog.mk43
1 files changed, 32 insertions, 11 deletions
diff --git a/rules/build-prog.mk b/rules/build-prog.mk
index d362d4299f..32cac3f6f2 100644
--- a/rules/build-prog.mk
+++ b/rules/build-prog.mk
@@ -132,14 +132,6 @@ endif
$(call all-target,$1,all_$1_$2)
$(call all-target,$1_$2,$1/$2/build/tmp/$$($1_$2_PROG))
-# INPLACE_BIN might be empty if we're distcleaning
-ifeq "$(findstring clean,$(MAKECMDGOALS))" ""
-ifeq "$$($1_$2_INSTALL_INPLACE)" "YES"
-$$($1_$2_INPLACE) : $1/$2/build/tmp/$$($1_$2_PROG) | $$$$(dir $$$$@)/.
- "$$(CP)" -p $$< $$@
-endif
-endif
-
$(call shell-wrapper,$1,$2)
ifeq "$$($1_$2_PROGRAM_WAY)" ""
@@ -205,9 +197,11 @@ $1/$2/build/tmp/$$($1_$2_PROG) $1/$2/build/tmp/$$($1_$2_PROG).dll : \
$$$$($$(dep)_dist-$(if $(filter 0,$3),boot,install)_PROGRAM_DEP_LIB)))
$1_$2_PROG_NEEDS_C_WRAPPER = NO
+$1_$2_PROG_INPLACE = $$($1_$2_PROG)
ifeq "$$(Windows_Host) $$($1_$2_PROGRAM_WAY)" "YES dyn"
ifneq "$$($1_$2_HS_SRCS)" ""
$1_$2_PROG_NEEDS_C_WRAPPER = YES
+$1_$2_PROG_INPLACE = inplace-$$($1_$2_PROG)
endif
endif
@@ -233,15 +227,31 @@ $1/$2/build/tmp/$$($1_$2_PROG)-inplace-wrapper.c: driver/utils/dynwrapper.c | $$
echo '#include <Windows.h>' >> $$@
echo '#include "Rts.h"' >> $$@
echo 'LPTSTR path_dirs[] = {' >> $$@
- $$(foreach d,$$($1_$2_DEP_LIB_REL_DIRS),$$(call make-command,echo ' TEXT("$$d")$$(comma)' >> $$@))
- echo ' TEXT("$1/$2/build/tmp/"),' >> $$@
+ $$(foreach d,$$($1_$2_DEP_LIB_REL_DIRS),$$(call make-command,echo ' TEXT("/../../$$d")$$(comma)' >> $$@))
+ echo ' TEXT("/../../$1/$2/build/tmp/"),' >> $$@
echo ' NULL};' >> $$@
echo 'LPTSTR progDll = TEXT("../../$1/$2/build/tmp/$$($1_$2_PROG).dll");' >> $$@
echo 'LPTSTR rtsDll = TEXT("$$($$(WINDOWS_DYN_PROG_RTS))");' >> $$@
echo 'int rtsOpts = $$($1_$2_RTS_OPTS);' >> $$@
cat driver/utils/dynwrapper.c >> $$@
-$1/$2/build/tmp/$$($1_$2_PROG) : $1/$2/build/tmp/$$($1_$2_PROG)-inplace-wrapper.c $1/$2/build/tmp/$$($1_$2_PROG).dll | $$$$(dir $$$$@)/.
+$1/$2/build/tmp/$$($1_$2_PROG)-wrapper.c: driver/utils/dynwrapper.c | $$$$(dir $$$$@)/.
+ $$(call removeFiles,$$@)
+ echo '#include <Windows.h>' >> $$@
+ echo '#include "Rts.h"' >> $$@
+ echo 'LPTSTR path_dirs[] = {' >> $$@
+ $$(foreach p,$$($1_$2_TRANSITIVE_DEPS),$$(call make-command,echo ' TEXT("/../lib/$$p")$$(comma)' >> $$@))
+ echo ' TEXT("/../lib/"),' >> $$@
+ echo ' NULL};' >> $$@
+ echo 'LPTSTR progDll = TEXT("../lib/$$($1_$2_PROG).dll");' >> $$@
+ echo 'LPTSTR rtsDll = TEXT("$$($$(WINDOWS_DYN_PROG_RTS))");' >> $$@
+ echo 'int rtsOpts = $$($1_$2_RTS_OPTS);' >> $$@
+ cat driver/utils/dynwrapper.c >> $$@
+
+$1/$2/build/tmp/$$($1_$2_PROG_INPLACE) : $1/$2/build/tmp/$$($1_$2_PROG)-inplace-wrapper.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) : $1/$2/build/tmp/$$($1_$2_PROG)-wrapper.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 $$$$@)/.
@@ -290,7 +300,18 @@ $(call all-target,$1_$2,$$($1_$2_INPLACE))
endif
$(call clean-target,$1,$2_inplace,$$($1_$2_INPLACE))
+# INPLACE_BIN might be empty if we're distcleaning
+ifeq "$(findstring clean,$(MAKECMDGOALS))" ""
+ifeq "$$($1_$2_INSTALL_INPLACE)" "YES"
+$$($1_$2_INPLACE) : $1/$2/build/tmp/$$($1_$2_PROG_INPLACE) | $$$$(dir $$$$@)/.
+ "$$(CP)" -p $$< $$@
+endif
+endif
+
ifeq "$$($1_$2_INSTALL)" "YES"
+ifeq "$$($1_$2_PROG_NEEDS_C_WRAPPER)" "YES"
+INSTALL_LIBS += $1/$2/build/tmp/$$($1_$2_PROG).dll
+endif
ifeq "$$($1_$2_WANT_INSTALLED_WRAPPER)" "YES"
INSTALL_LIBEXECS += $1/$2/build/tmp/$$($1_$2_PROG)
else ifeq "$$($1_$2_TOPDIR)" "YES"