summaryrefslogtreecommitdiff
path: root/rules/build-prog.mk
diff options
context:
space:
mode:
Diffstat (limited to 'rules/build-prog.mk')
-rw-r--r--rules/build-prog.mk40
1 files changed, 34 insertions, 6 deletions
diff --git a/rules/build-prog.mk b/rules/build-prog.mk
index 462dcf7fcb..6e6d1c11f1 100644
--- a/rules/build-prog.mk
+++ b/rules/build-prog.mk
@@ -54,6 +54,26 @@ ifeq "$$($1_USES_CABAL)" "YES"
$1_$2_USES_CABAL = YES
endif
+ifeq "$$(Windows)" "YES"
+$1_$2_WANT_INPLACE_WRAPPER = NO
+else ifneq "$$($1_$2_INSTALL_INPLACE)" "YES"
+$1_$2_WANT_INPLACE_WRAPPER = NO
+else ifeq "$$($1_$2_SHELL_WRAPPER)" "YES"
+$1_$2_WANT_INPLACE_WRAPPER = YES
+else
+$1_$2_WANT_INPLACE_WRAPPER = NO
+endif
+
+ifeq "$$(Windows)" "YES"
+$1_$2_WANT_INSTALLED_WRAPPER = NO
+else ifneq "$$($1_$2_INSTALL)" "YES"
+$1_$2_WANT_INSTALLED_WRAPPER = NO
+else ifeq "$$($1_$2_SHELL_WRAPPER)" "YES"
+$1_$2_WANT_INSTALLED_WRAPPER = YES
+else
+$1_$2_WANT_INSTALLED_WRAPPER = NO
+endif
+
$(call package-config,$1,$2,$3)
$1_$2_depfile_base = $1/$2/build/.depend
@@ -66,7 +86,7 @@ $1_$2_INPLACE =
endif
else
# Where do we install the inplace version?
-ifeq "$$($1_$2_SHELL_WRAPPER) $$(Windows)" "YES NO"
+ifeq "$$($1_$2_WANT_INPLACE_WRAPPER)" "YES"
$1_$2_INPLACE = $$(INPLACE_LIB)/bin/$$($1_$2_PROG)
else
ifeq "$$($1_$2_TOPDIR)" "YES"
@@ -93,7 +113,7 @@ $(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))" ""
-ifneq "$$($1_$2_INSTALL_INPLACE)" "NO"
+ifeq "$$($1_$2_INSTALL_INPLACE)" "YES"
$$($1_$2_INPLACE) : $1/$2/build/tmp/$$($1_$2_PROG) | $$$$(dir $$$$@)/.
"$$(CP)" -p $$< $$@
endif
@@ -142,17 +162,25 @@ ifeq "$$($1_$2_v_HS_OBJS)" ""
$1_$2_GHC_LD_OPTS = -no-auto-link-packages -no-hs-main
endif
+ifneq "$3" "0"
+ifeq "$$(DYNAMIC_BY_DEFAULT)" "YES"
+$1_$2_GHC_LD_OPTS = \
+ -fno-use-rpaths \
+ $$(addprefix -optl-Wl$$(comma)-rpath -optl-Wl$$(comma),$$($1_$2_RPATHS))
+endif
+endif
+
ifneq "$$(BINDIST)" "YES"
# The quadrupled $'s here are because the _v_LIB variables aren't
# necessarily set when this part of the makefile is read
$1/$2/build/tmp/$$($1_$2_PROG) : \
$$(foreach dep,$$($1_$2_DEP_NAMES),\
$$(if $$(filter ghc,$$(dep)),\
- $(if $(filter 0,$3),$$(compiler_stage1_v_LIB),\
- $(if $(filter 1,$3),$$(compiler_stage2_v_LIB),\
- $(if $(filter 2,$3),$$(compiler_stage2_v_LIB),\
+ $(if $(filter 0,$3),$$(compiler_stage1_PROGRAM_DEP_LIB),\
+ $(if $(filter 1,$3),$$(compiler_stage2_PROGRAM_DEP_LIB),\
+ $(if $(filter 2,$3),$$(compiler_stage2_PROGRAM_DEP_LIB),\
$$(error Bad build stage)))),\
- $$$$(libraries/$$(dep)_dist-$(if $(filter 0,$3),boot,install)_v_LIB)))
+ $$$$(libraries/$$(dep)_dist-$(if $(filter 0,$3),boot,install)_PROGRAM_DEP_LIB)))
ifeq "$$($1_$2_LINK_WITH_GCC)" "NO"
$1/$2/build/tmp/$$($1_$2_PROG) : $$($1_$2_v_HS_OBJS) $$($1_$2_v_C_OBJS) $$($1_$2_v_S_OBJS) $$($1_$2_OTHER_OBJS) | $$$$(dir $$$$@)/.