3 # ghc_PACKAGE = ghc-bin
5 ghc_stage1_HC_OPTS = $(GhcStage1HcOpts)
6 ghc_stage2_HC_OPTS = $(GhcStage2HcOpts)
7 ghc_stage3_HC_OPTS = $(GhcStage3HcOpts)
9 ifeq "$(GhcWithInterpreter)" "YES"
10 ghc_stage2_HC_OPTS += -DGHCI
11 ghc_stage3_HC_OPTS += -DGHCI
14 ifeq "$(GhcDebugged)" "YES"
18 ifeq "$(GhcThreaded)" "YES"
19 # Use threaded RTS with GHCi, so threads don't get blocked at the prompt.
20 ghc_HC_OPTS += -threaded
23 ifeq "$(BuildSharedLibs)" "YES"
24 ghc_HC_OPTS += -dynamic
28 # ifeq "$(GhcProfiled)" "YES"
30 ghc_stage1_MODULES = Main
32 ghc_stage2_MODULES = $(ghc_stage1_MODULES)
33 ghc_stage3_MODULES = $(ghc_stage1_MODULES)
35 ghc_stage1_PROG = ghc-stage1$(exeext)
36 ghc_stage2_PROG = ghc-stage2$(exeext)
37 ghc_stage3_PROG = ghc-stage3$(exeext)
39 # ToDo: perhaps use ghc-cabal to configure ghc-bin
40 ghc_stage1_USE_BOOT_LIBS = YES
41 ghc_stage1_HC_OPTS += -package $(compiler_PACKAGE)-$(compiler_stage1_VERSION)
42 ghc_stage2_HC_OPTS += -package $(compiler_PACKAGE)-$(compiler_stage2_VERSION)
43 ghc_stage3_HC_OPTS += -package $(compiler_PACKAGE)-$(compiler_stage3_VERSION)
45 ghc_stage1_HC_OPTS += -XCPP -XPatternGuards
46 ghc_stage2_HC_OPTS += -XCPP -XPatternGuards
47 ghc_stage3_HC_OPTS += -XCPP -XPatternGuards
49 # In stage1 we might not benefit from cross-package dependencies and
50 # recompilation checking. We must force recompilation here, otherwise
51 # Main.o won't necessarily be rebuilt when the ghc package has changed:
52 ghc_stage1_HC_OPTS += -fforce-recomp
54 # Further dependencies we need only in stage 1, due to no
55 # cross-package dependencies or recompilation checking.
56 ghc/stage1/build/Main.o : $(compiler_stage1_v_LIB)
58 ghc_stage1_SHELL_WRAPPER = YES
59 ghc_stage2_SHELL_WRAPPER = YES
60 ghc_stage3_SHELL_WRAPPER = YES
61 ghc_stage1_SHELL_WRAPPER_NAME = ghc/ghc.wrapper
62 ghc_stage2_SHELL_WRAPPER_NAME = ghc/ghc.wrapper
63 ghc_stage3_SHELL_WRAPPER_NAME = ghc/ghc.wrapper
65 ghc_stage$(INSTALL_GHC_STAGE)_INSTALL_SHELL_WRAPPER = YES
66 ghc_stage$(INSTALL_GHC_STAGE)_INSTALL_SHELL_WRAPPER_NAME = ghc-$(ProjectVersion)
68 # stage 1 is enabled unless $(stage) is set to something other than 1
69 ifeq "$(filter-out 1,$(stage))" ""
70 $(eval $(call build-prog,ghc,stage1,0))
73 # stage 2 is enabled unless $(stage) is set to something other than 2
74 ifeq "$(filter-out 2,$(stage))" ""
75 $(eval $(call build-prog,ghc,stage2,1))
78 # stage 3 has to be requested explicitly with stage=3
80 $(eval $(call build-prog,ghc,stage3,2))
83 ifneq "$(BINDIST)" "YES"
85 # ToDo: should we add these in the build-prog macro?
86 ghc/stage1/build/tmp/$(ghc_stage1_PROG) : $(compiler_stage1_v_LIB)
87 ghc/stage2/build/tmp/$(ghc_stage2_PROG) : $(compiler_stage2_v_LIB)
88 ghc/stage3/build/tmp/$(ghc_stage3_PROG) : $(compiler_stage3_v_LIB)
90 all_ghc_stage1 : $(GHC_STAGE1)
91 all_ghc_stage2 : $(GHC_STAGE2)
92 all_ghc_stage3 : $(GHC_STAGE3)
94 $(INPLACE_LIB)/extra-gcc-opts : extra-gcc-opts
97 # The GHC programs need to depend on all the helper programs they might call
98 $(GHC_STAGE1) : $(INPLACE_LIB)/extra-gcc-opts $(MANGLER) $(SPLIT)
99 $(GHC_STAGE2) : $(INPLACE_LIB)/extra-gcc-opts $(MANGLER) $(SPLIT)
100 $(GHC_STAGE3) : $(INPLACE_LIB)/extra-gcc-opts $(MANGLER) $(SPLIT)
102 ifeq "$(Windows)" "YES"
103 $(GHC_STAGE1) : $(TOUCHY) $(INPLACE)/stamp-mingw $(INPLACE_LIB)/perl.exe
104 $(GHC_STAGE2) : $(TOUCHY) $(INPLACE)/stamp-mingw $(INPLACE_LIB)/perl.exe
105 $(GHC_STAGE3) : $(TOUCHY) $(INPLACE)/stamp-mingw $(INPLACE_LIB)/perl.exe
110 INSTALL_LIBS += extra-gcc-opts
112 ifeq "$(Windows)" "NO"
113 install: install_ghc_link
114 .PNONY: install_ghc_link
116 $(RM) -f $(DESTDIR)$(bindir)/ghc
117 $(LN_S) ghc-$(ProjectVersion) $(DESTDIR)$(bindir)/ghc
119 # On Windows we install the main binary as $(bindir)/ghc.exe
120 # To get ghc-<version>.exe we have a little C program in driver/ghc
121 install: install_ghc_post
122 .PHONY: install_ghc_post
123 install_ghc_post: install_bins
124 $(RM) -f $(DESTDIR)$(bindir)/ghc.exe
125 $(MV) -f $(DESTDIR)$(bindir)/ghc-stage$(INSTALL_GHC_STAGE).exe $(DESTDIR)$(bindir)/ghc.exe