1 # -----------------------------------------------------------------------------
2 # $Id: bootstrap.mk,v 1.27 2003/09/02 10:23:30 simonmar Exp $
4 # Makefile rules for booting from .hc files without a driver.
6 # When booting from .hc files without a compiler installed, we don't have
7 # the benefit of the GHC driver to add all the magic options required to
8 # compile the .hc files, so we have to duplicate that functionality here.
9 # The result is unfortunately ugly, but we don't have another choice.
14 include $(TOP)/mk/version.mk
15 include $(TOP)/mk/paths.mk
20 # -----------------------------------------------------------------------------
21 # Set the platform-specific options to send to the C compiler. These should
22 # match the list in machdepCCOpts in ghc/compiler/DriverFlags.hs.
26 PLATFORM_HC_BOOT_CC_OPTS =
28 ifeq "$(i386_TARGET_ARCH)" "1"
29 PLATFORM_CC_OPTS += -DDONT_WANT_WIN32_DLL_SUPPORT
30 PLATFORM_HC_BOOT_CC_OPTS += -fno-defer-pop -fomit-frame-pointer
33 ifeq "$(hppa_TARGET_ARCH)" "1"
34 PLATFORM_CC_OPTS += -static -D_HPUX_SOURCE
37 ifeq "$(powerpc_TARGET_ARCH)" "1"
38 PLATFORM_CC_OPTS += -static
39 PLATFORM_HC_BOOT_CC_OPTS += -finhibit-size-directive
42 ifeq "$(rs6000_TARGET_ARCH)" "1"
43 PLATFORM_CC_OPTS += -static
44 PLATFORM_HC_BOOT_CC_OPTS += -finhibit-size-directive
47 ifeq "$(mingw32_TARGET_OS)" "1"
48 PLATFORM_CC_OPTS += -mno-cygwin
51 ifeq "$(alpha_TARGET_ARCH)" "1"
52 PLATFORM_CC_OPTS += -static -w
53 PLATFORM_HC_BOOT_CC_OPTS += -mieee
56 ifeq "$(sparc_TARGET_ARCH)" "1"
57 PLATFORM_HC_BOOT_CC_OPTS += -w
60 ifeq "$(BootingFromUnregisterisedHc)" "YES"
61 PLATFORM_HC_BOOT_CC_OPTS += -DNO_REGS -DUSE_MINIINTERPRETER
62 SRC_CC_OPTS += -DNO_REGS -DUSE_MINIINTERPRETER
63 # Add these flags to SRC_CC_OPTS too, because they need to be passed to the plain .c
67 PLATFORM_CC_OPTS += -D__GLASGOW_HASKELL__=$(ProjectVersionInt)
69 HC_BOOT_CC_OPTS = $(PLATFORM_HC_BOOT_CC_OPTS) $(PLATFORM_CC_OPTS) $(CC_OPTS)
71 SRC_CC_OPTS += -I$(FPTOOLS_TOP_ABS)/ghc/includes -I$(FPTOOLS_TOP_ABS)/libraries/base/include -I$(FPTOOLS_TOP_ABS)/libraries/unix/include
73 ifeq "$(GhcWithInterpreter)" "YES"
74 SRC_CC_OPTS += -I$(FPTOOLS_TOP_ABS)/libraries/readline/include
77 # -----------------------------------------------------------------------------
78 # Linking: we have to give all the libraries explicitly.
80 ifeq "$(LeadingUnderscore)" "YES"
86 ifeq "$(HaveLibGmp)" "NO"
87 DASH_L_GHC_RTS_GMP_DIR=-L$(FPTOOLS_TOP_ABS)/ghc/rts/gmp
91 -L$(FPTOOLS_TOP_ABS)/ghc/rts \
92 $(DASH_L_GHC_RTS_GMP_DIR) \
93 -L$(FPTOOLS_TOP_ABS)/libraries/base \
94 -L$(FPTOOLS_TOP_ABS)/libraries/base/cbits \
95 -L$(FPTOOLS_TOP_ABS)/libraries/haskell98
97 ifeq "$(GhcWithInterpreter)" "YES"
99 -L$(FPTOOLS_TOP_ABS)/libraries/haskell-src \
100 -L$(FPTOOLS_TOP_ABS)/libraries/readline \
101 -L$(FPTOOLS_TOP_ABS)/libraries/unix \
102 -L$(FPTOOLS_TOP_ABS)/libraries/unix/cbits
106 -u "$(UNDERSCORE)GHCziBase_Izh_static_info" \
107 -u "$(UNDERSCORE)GHCziBase_Czh_static_info" \
108 -u "$(UNDERSCORE)GHCziFloat_Fzh_static_info" \
109 -u "$(UNDERSCORE)GHCziFloat_Dzh_static_info" \
110 -u "$(UNDERSCORE)GHCziPtr_Ptr_static_info" \
111 -u "$(UNDERSCORE)GHCziWord_Wzh_static_info" \
112 -u "$(UNDERSCORE)GHCziInt_I8zh_static_info" \
113 -u "$(UNDERSCORE)GHCziInt_I16zh_static_info" \
114 -u "$(UNDERSCORE)GHCziInt_I32zh_static_info" \
115 -u "$(UNDERSCORE)GHCziInt_I64zh_static_info" \
116 -u "$(UNDERSCORE)GHCziWord_W8zh_static_info" \
117 -u "$(UNDERSCORE)GHCziWord_W16zh_static_info" \
118 -u "$(UNDERSCORE)GHCziWord_W32zh_static_info" \
119 -u "$(UNDERSCORE)GHCziWord_W64zh_static_info" \
120 -u "$(UNDERSCORE)GHCziStable_StablePtr_static_info" \
121 -u "$(UNDERSCORE)GHCziBase_Izh_con_info" \
122 -u "$(UNDERSCORE)GHCziBase_Czh_con_info" \
123 -u "$(UNDERSCORE)GHCziFloat_Fzh_con_info" \
124 -u "$(UNDERSCORE)GHCziFloat_Dzh_con_info" \
125 -u "$(UNDERSCORE)GHCziPtr_Ptr_con_info" \
126 -u "$(UNDERSCORE)GHCziStable_StablePtr_con_info" \
127 -u "$(UNDERSCORE)GHCziBase_False_closure" \
128 -u "$(UNDERSCORE)GHCziBase_True_closure" \
129 -u "$(UNDERSCORE)GHCziPack_unpackCString_closure" \
130 -u "$(UNDERSCORE)GHCziIOBase_stackOverflow_closure" \
131 -u "$(UNDERSCORE)GHCziIOBase_heapOverflow_closure" \
132 -u "$(UNDERSCORE)GHCziIOBase_NonTermination_closure" \
133 -u "$(UNDERSCORE)GHCziIOBase_BlockedOnDeadMVar_closure" \
134 -u "$(UNDERSCORE)GHCziIOBase_Deadlock_closure" \
135 -u "$(UNDERSCORE)GHCziWeak_runFinalizzerBatch_closure" \
136 -u "$(UNDERSCORE)__stginit_Prelude"
141 ifeq "$(GhcWithInterpreter)" "YES"
142 HC_BOOT_LIBS += -lHSreadline -lHShaskell-src -lHSunix -lHSunix_cbits
145 HC_BOOT_LIBS += -lHShaskell98 -lHSbase -lHSbase_cbits -lHSrts -lgmp -lm $(EXTRA_HC_BOOT_LIBS)
147 ifeq "$(GhcLibsWithReadline)" "YES"
148 HC_BOOT_LIBS += $(patsubst %, -l%, $(LibsReadline))
151 ifeq "$(HaveLibDL)" "YES"