ghc_HC_OPTS += -debug
endif
+ifeq "$(GhcDynamic)" "YES"
+ghc_stage2_HC_OPTS += -dynamic
+ghc_stage3_HC_OPTS += -dynamic
+endif
+
ifeq "$(GhcThreaded)" "YES"
# Use threaded RTS with GHCi, so threads don't get blocked at the prompt.
ghc_stage2_HC_OPTS += -threaded
echo 'executablename="$$exedir/ghc"' >> "$(WRAPPER)"
endef
-# stage 1 is enabled unless $(stage) is set to something other than 1
-ifeq "$(filter-out 1,$(stage))" ""
-$(eval $(call build-prog,ghc,stage1,0))
+# if stage is set to something other than "1" or "", disable stage 1
+ifneq "$(filter-out 1,$(stage))" ""
+ghc_stage1_NOT_NEEDED = YES
endif
-
-# stage 2 is enabled unless $(stage) is set to something other than 2
-ifeq "$(filter-out 2,$(stage))" ""
-$(eval $(call build-prog,ghc,stage2,1))
+# if stage is set to something other than "2" or "", disable stage 2
+ifneq "$(filter-out 2,$(stage))" ""
+ghc_stage2_NOT_NEEDED = YES
endif
-
# stage 3 has to be requested explicitly with stage=3
-ifeq "$(stage)" "3"
-$(eval $(call build-prog,ghc,stage3,2))
+ifneq "$(stage)" "3"
+ghc_stage3_NOT_NEEDED = YES
endif
+$(eval $(call build-prog,ghc,stage1,0))
+$(eval $(call build-prog,ghc,stage2,1))
+$(eval $(call build-prog,ghc,stage3,2))
ifneq "$(BINDIST)" "YES"
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))
+endif
+
# Modules here import HsVersions.h, so we need ghc_boot_platform.h
$(ghc_stage1_depfile_haskell) : compiler/stage1/$(PLATFORM_H)
$(ghc_stage2_depfile_haskell) : compiler/stage2/$(PLATFORM_H)