disable all docs in the "quick" and "devel" builds
[ghc-hetmet.git] / mk / bootstrap.mk
1 # -----------------------------------------------------------------------------
2 # $Id: bootstrap.mk,v 1.34 2005/05/10 10:29:49 simonmar Exp $
3 #
4 # Makefile rules for booting from .hc files without a driver.
5 #
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.
10
11 # -----------------------------------------------------------------------------
12 # Set the platform-specific options to send to the C compiler.  These should
13 # match the list in machdepCCOpts in ghc/compiler/DriverFlags.hs.
14 #
15
16 PLATFORM_CC_OPTS =
17 PLATFORM_HC_BOOT_CC_OPTS =
18
19 ifeq "$(i386_TARGET_ARCH)" "1"
20 PLATFORM_CC_OPTS += -DDONT_WANT_WIN32_DLL_SUPPORT
21 PLATFORM_HC_BOOT_CC_OPTS += -fno-defer-pop -fomit-frame-pointer -fno-builtin
22 endif
23
24 ifeq "$(x86_64_TARGET_ARCH)" "1"
25 PLATFORM_HC_BOOT_CC_OPTS += -fomit-frame-pointer -fno-asynchronous-unwind-tables -fno-unit-at-a-time -fno-builtin
26 endif
27
28 ifeq "$(hppa_TARGET_ARCH)" "1"
29 PLATFORM_CC_OPTS += -D_HPUX_SOURCE
30 endif
31
32 ifeq "$(powerpc_TARGET_ARCH)" "1"
33 PLATFORM_CC_OPTS += -static
34 PLATFORM_HC_BOOT_CC_OPTS += -finhibit-size-directive
35 endif
36
37 ifeq "$(rs6000_TARGET_ARCH)" "1"
38 PLATFORM_CC_OPTS += -static
39 PLATFORM_HC_BOOT_CC_OPTS += -finhibit-size-directive
40 endif
41
42 ifeq "$(alpha_TARGET_ARCH)" "1"
43 PLATFORM_CC_OPTS += -static -w
44 PLATFORM_HC_BOOT_CC_OPTS += -mieee
45 endif
46
47 ifeq "$(sparc_TARGET_ARCH)" "1"
48 PLATFORM_HC_BOOT_CC_OPTS += -w
49 endif
50
51 ifeq "$(BootingFromUnregisterisedHc)" "YES"
52 PLATFORM_HC_BOOT_CC_OPTS += -DNO_REGS -DUSE_MINIINTERPRETER
53 endif
54
55 PLATFORM_CC_OPTS += -D__GLASGOW_HASKELL__=$(ProjectVersionInt) 
56
57 HC_BOOT_CC_OPTS = $(PLATFORM_HC_BOOT_CC_OPTS) $(PLATFORM_CC_OPTS) $(CC_OPTS)
58
59 SRC_CC_OPTS += -I$(FPTOOLS_TOP_ABS)/$(GHC_INCLUDE_DIR_REL) -I$(FPTOOLS_TOP_ABS)/libraries/base/include -I$(FPTOOLS_TOP_ABS)/libraries/unix/include -I$(FPTOOLS_TOP_ABS)/libraries/parsec/include
60
61 # C code compiled with UseGhcForCc=YES assumes the existence of certain CPP
62 # symbols defined by GHC (eg. __GLASGOW_HASKELL__), so we better make sure
63 # they're defined.  We can't test $(UseGhcForCc) here though - it isn't defined
64 # yet, so we use lazy expansion.
65 SRC_CC_OPTS += $(if $(findstring YES,$(UseGhcForCc)), $(PLATFORM_HC_BOOT_CC_OPTS) $(PLATFORM_CC_OPTS))
66
67 ifeq "$(GhcWithInterpreter)" "YES"
68 SRC_CC_OPTS += -I$(FPTOOLS_TOP_ABS)/libraries/readline/include
69 endif
70
71 # -----------------------------------------------------------------------------
72 # Linking: we have to give all the libraries explicitly.
73
74 ifeq "$(LeadingUnderscore)" "YES"
75 UNDERSCORE=_
76 else
77 UNDERSCORE=
78 endif
79
80 ifeq "$(HaveLibGmp)" "NO"
81 DASH_L_GHC_RTS_GMP_DIR=-L$(FPTOOLS_TOP_ABS)/$(GHC_RTS_DIR_REL)/gmp
82 endif
83
84 HC_BOOT_LD_OPTS =                               \
85    -L$(FPTOOLS_TOP_ABS)/$(GHC_RTS_DIR_REL)      \
86    $(DASH_L_GHC_RTS_GMP_DIR)                    \
87    -L$(FPTOOLS_TOP_ABS)/libraries/base          \
88    -L$(FPTOOLS_TOP_ABS)/libraries/base/cbits    \
89    -L$(FPTOOLS_TOP_ABS)/libraries/haskell98     \
90    -L$(FPTOOLS_TOP_ABS)/libraries/parsec        \
91    -L$(FPTOOLS_TOP_ABS)/libraries/regex-base    \
92    -L$(FPTOOLS_TOP_ABS)/libraries/regex-posix   \
93    -L$(FPTOOLS_TOP_ABS)/libraries/regex-compat  \
94    -L$(FPTOOLS_TOP_ABS)/libraries/Cabal
95
96 ifeq "$(GhcWithInterpreter)" "YES"
97 HC_BOOT_LD_OPTS += \
98    -L$(FPTOOLS_TOP_ABS)/libraries/template-haskell      \
99    -L$(FPTOOLS_TOP_ABS)/libraries/readline      \
100    -L$(FPTOOLS_TOP_ABS)/libraries/unix          \
101    -L$(FPTOOLS_TOP_ABS)/libraries/unix/cbits
102 endif
103
104 HC_BOOT_LD_OPTS += \
105    -u "$(UNDERSCORE)base_GHCziBase_Izh_static_info" \
106    -u "$(UNDERSCORE)base_GHCziBase_Czh_static_info" \
107    -u "$(UNDERSCORE)base_GHCziFloat_Fzh_static_info" \
108    -u "$(UNDERSCORE)base_GHCziFloat_Dzh_static_info" \
109    -u "$(UNDERSCORE)base_GHCziPtr_Ptr_static_info" \
110    -u "$(UNDERSCORE)base_GHCziWord_Wzh_static_info" \
111    -u "$(UNDERSCORE)base_GHCziInt_I8zh_static_info" \
112    -u "$(UNDERSCORE)base_GHCziInt_I16zh_static_info" \
113    -u "$(UNDERSCORE)base_GHCziInt_I32zh_static_info" \
114    -u "$(UNDERSCORE)base_GHCziInt_I64zh_static_info" \
115    -u "$(UNDERSCORE)base_GHCziWord_W8zh_static_info" \
116    -u "$(UNDERSCORE)base_GHCziWord_W16zh_static_info" \
117    -u "$(UNDERSCORE)base_GHCziWord_W32zh_static_info" \
118    -u "$(UNDERSCORE)base_GHCziWord_W64zh_static_info" \
119    -u "$(UNDERSCORE)base_GHCziStable_StablePtr_static_info" \
120    -u "$(UNDERSCORE)base_GHCziBase_Izh_con_info" \
121    -u "$(UNDERSCORE)base_GHCziBase_Czh_con_info" \
122    -u "$(UNDERSCORE)base_GHCziFloat_Fzh_con_info" \
123    -u "$(UNDERSCORE)base_GHCziFloat_Dzh_con_info" \
124    -u "$(UNDERSCORE)base_GHCziPtr_Ptr_con_info" \
125    -u "$(UNDERSCORE)base_GHCziStable_StablePtr_con_info" \
126    -u "$(UNDERSCORE)base_GHCziBase_False_closure" \
127    -u "$(UNDERSCORE)base_GHCziBase_True_closure" \
128    -u "$(UNDERSCORE)base_GHCziPack_unpackCString_closure" \
129    -u "$(UNDERSCORE)base_GHCziIOBase_stackOverflow_closure" \
130    -u "$(UNDERSCORE)base_GHCziIOBase_heapOverflow_closure" \
131    -u "$(UNDERSCORE)base_GHCziIOBase_nonTermination_closure" \
132    -u "$(UNDERSCORE)base_GHCziIOBase_BlockedOnDeadMVar_closure" \
133    -u "$(UNDERSCORE)base_GHCziIOBase_Deadlock_closure" \
134    -u "$(UNDERSCORE)base_GHCziWeak_runFinalizzerBatch_closure" \
135    -u "$(UNDERSCORE)__stginit_Prelude"
136
137
138 HC_BOOT_LIBS =
139
140 ifeq "$(GhcWithInterpreter)" "YES"
141 HC_BOOT_LIBS += -lHSreadline -lHStemplate-haskell -lHSunix -lHSunix_cbits
142 endif
143
144 HC_BOOT_LIBS +=  -lHSregex-compat -lHSregex-posix -lHSregex-base -lHSCabal -lHShaskell98 -lHSbase -lHSbase_cbits -lHSparsec -lHSrts -lgmp -lm -lrt $(EXTRA_HC_BOOT_LIBS)
145
146 ifeq "$(GhcLibsWithReadline)" "YES"
147 HC_BOOT_LIBS += $(patsubst %, -l%, $(LibsReadline))
148 endif
149
150 ifeq "$(HaveLibDL)" "YES"
151 HC_BOOT_LIBS += -ldl
152 endif