From: Ian Lynagh Date: Sun, 16 Jan 2011 15:56:27 +0000 (+0000) Subject: Handle dependencies of programs on libraries correctly X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=5bde27949bdda22c9d5dac254a3c783eb0f6839f Handle dependencies of programs on libraries correctly --- diff --git a/ghc/ghc.mk b/ghc/ghc.mk index 831e37e..a9b6005 100644 --- a/ghc/ghc.mk +++ b/ghc/ghc.mk @@ -109,11 +109,6 @@ $(eval $(call build-prog,ghc,stage3,2)) ifneq "$(BINDIST)" "YES" -# ToDo: should we add these in the build-prog macro? -ghc/stage1/build/tmp/$(ghc_stage1_PROG) : $(compiler_stage1_v_LIB) -ghc/stage2/build/tmp/$(ghc_stage2_PROG) : $(compiler_stage2_v_LIB) -ghc/stage3/build/tmp/$(ghc_stage3_PROG) : $(compiler_stage3_v_LIB) - ifeq "$(GhcProfiled)" "YES" ghc/stage2/build/tmp/$(ghc_stage2_PROG) : $(compiler_stage2_p_LIB) ghc/stage2/build/tmp/$(ghc_stage2_PROG) : $(foreach lib,$(PACKAGES),$(libraries/$(lib)_dist-install_p_LIB)) diff --git a/rules/build-package-way.mk b/rules/build-package-way.mk index ed81d6d..b4cd3bc 100644 --- a/rules/build-package-way.mk +++ b/rules/build-package-way.mk @@ -51,6 +51,17 @@ endif $1_$2_$3_NON_HS_OBJS = $$($1_$2_$3_CMM_OBJS) $$($1_$2_$3_C_OBJS) $$($1_$2_$3_S_OBJS) $$($1_$2_EXTRA_OBJS) $1_$2_$3_ALL_OBJS = $$($1_$2_$3_HS_OBJS) $$($1_$2_$3_NON_HS_OBJS) +# The quadrupled $'s here are because the _v_LIB variables aren't +# necessarily set when this part of the makefile is read. +# These deps aren't technically necessary in themselves, but they +# turn the dependencies of programs on libraries into transitive +# dependencies. +ifeq "$4" "0" +$$($1_$2_$3_LIB) : $$(foreach dep,$$($1_$2_DEP_NAMES),$$$$(libraries/$$(dep)_dist-boot_v_LIB)) +else +$$($1_$2_$3_LIB) : $$(foreach dep,$$($1_$2_DEP_NAMES),$$$$(libraries/$$(dep)_dist-install_v_LIB)) +endif + ifeq "$3" "dyn" # Link a dynamic library diff --git a/rules/build-prog.mk b/rules/build-prog.mk index e303a44..99b24de 100644 --- a/rules/build-prog.mk +++ b/rules/build-prog.mk @@ -192,6 +192,14 @@ ifeq "$$($1_$2_v_HS_OBJS)" "" $1_$2_GHC_LD_OPTS = -no-auto-link-packages -no-hs-main endif +# The quadrupled $'s here are because the _v_LIB variables aren't +# necessarily set when this part of the makefile is read +ifeq "$3" "0" +$1/$2/build/tmp/$$($1_$2_PROG) : $$(foreach dep,$$($1_$2_DEP_NAMES),$$$$(libraries/$$(dep)_dist-boot_v_LIB)) +else +$1/$2/build/tmp/$$($1_$2_PROG) : $$(foreach dep,$$($1_$2_DEP_NAMES),$$$$(libraries/$$(dep)_dist-install_v_LIB)) +endif + 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 $$$$@)/. "$$($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))