diff options
author | Ian Lynagh <ian@well-typed.com> | 2012-10-04 16:00:17 +0100 |
---|---|---|
committer | Ian Lynagh <ian@well-typed.com> | 2012-10-04 16:00:17 +0100 |
commit | 16a8414061a1fef7d90e162e5253d3005cb11806 (patch) | |
tree | 31f6012c521e47b1c5b6f32ac04ba54a2adc5099 /rules/build-prog.mk | |
parent | 911bc5ce96f54a3be63e6e7dcfa9bc6ccb8495e0 (diff) | |
download | haskell-16a8414061a1fef7d90e162e5253d3005cb11806.tar.gz |
Actually build things the dynamic way
Things went back to being statically linked again once I added an
explicit -static flag to the vanilla way.
Diffstat (limited to 'rules/build-prog.mk')
-rw-r--r-- | rules/build-prog.mk | 41 |
1 files changed, 25 insertions, 16 deletions
diff --git a/rules/build-prog.mk b/rules/build-prog.mk index 6e6d1c11f1..239f55cdd4 100644 --- a/rules/build-prog.mk +++ b/rules/build-prog.mk @@ -121,41 +121,50 @@ endif $(call shell-wrapper,$1,$2) -$1_$2_WAYS = v +ifeq "$$($1_$2_PROGRAM_WAY)" "" +ifeq "$3" "0" +$1_$2_PROGRAM_WAY = v +else ifeq "$$(DYNAMIC_BY_DEFAULT)" "YES" +$1_$2_PROGRAM_WAY = dyn +else +$1_$2_PROGRAM_WAY = v +endif +endif + +$1_$2_WAYS = $$($1_$2_PROGRAM_WAY) $(call hs-sources,$1,$2) $(call c-sources,$1,$2) # --- IMPLICIT RULES -# Just the 'v' way for programs -$(call distdir-way-opts,$1,$2,v,$3) +$(call distdir-way-opts,$1,$2,$$($1_$2_PROGRAM_WAY),$3) ifeq "$3" "0" # For stage 0, we use GHC to compile C sources so that we don't have to # worry about where the RTS header files are -$(call c-suffix-rules,$1,$2,v,YES) +$(call c-suffix-rules,$1,$2,$$($1_$2_PROGRAM_WAY),YES) else ifeq "$$($1_$2_UseGhcForCC)" "YES" -$(call c-suffix-rules,$1,$2,v,YES) +$(call c-suffix-rules,$1,$2,$$($1_$2_PROGRAM_WAY),YES) else -$(call c-suffix-rules,$1,$2,v,NO) +$(call c-suffix-rules,$1,$2,$$($1_$2_PROGRAM_WAY),NO) endif endif -$(call hs-suffix-rules,$1,$2,v) +$(call hs-suffix-rules,$1,$2,$$($1_$2_PROGRAM_WAY)) $$(foreach dir,$$($1_$2_HS_SRC_DIRS),\ - $$(eval $$(call hs-suffix-rules-srcdir,$1,$2,v,$$(dir)))) + $$(eval $$(call hs-suffix-rules-srcdir,$1,$2,$$($1_$2_PROGRAM_WAY),$$(dir)))) -$(call c-objs,$1,$2,v) -$(call hs-objs,$1,$2,v) +$(call c-objs,$1,$2,$$($1_$2_PROGRAM_WAY)) +$(call hs-objs,$1,$2,$$($1_$2_PROGRAM_WAY)) $1_$2_LINK_WITH_GCC = NO ifeq "$$(BootingFromHc)" "YES" $1_$2_LINK_WITH_GCC = YES endif -ifeq "$$($1_$2_v_HS_OBJS)" "" +ifeq "$$($1_$2_$$($1_$2_PROGRAM_WAY)_HS_OBJS)" "" # We don't want to link the GHC RTS into C-only programs. There's no # point, and it confuses the test that all GHC-compiled programs # were compiled with the right GHC. @@ -171,7 +180,7 @@ endif endif ifneq "$$(BINDIST)" "YES" -# The quadrupled $'s here are because the _v_LIB variables aren't +# The quadrupled $'s here are because the _<way>_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),\ @@ -183,11 +192,11 @@ $1/$2/build/tmp/$$($1_$2_PROG) : \ $$$$(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 $$$$@)/. - $$(call cmd,$1_$2_HC) -o $$@ $$($1_$2_v_ALL_HC_OPTS) $$(LD_OPTS) $$($1_$2_GHC_LD_OPTS) $$($1_$2_v_HS_OBJS) $$($1_$2_v_C_OBJS) $$($1_$2_v_S_OBJS) $$($1_$2_OTHER_OBJS) $$(addprefix -l,$$($1_$2_EXTRA_LIBRARIES)) +$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_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)) else -$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 $$$$@)/. - $$(call cmd,$1_$2_CC) -o $$@ $$($1_$2_v_ALL_CC_OPTS) $$(LD_OPTS) $$($1_$2_v_HS_OBJS) $$($1_$2_v_C_OBJS) $$($1_$2_v_S_OBJS) $$($1_$2_OTHER_OBJS) $$($1_$2_v_EXTRA_CC_OPTS) $$(addprefix -l,$$($1_$2_EXTRA_LIBRARIES)) +$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 # Note [lib-depends] if this program is built with stage1 or greater, we |