1 # -----------------------------------------------------------------------------
2 # $Id: bootstrap.mk,v 1.9 2001/05/22 11:29:04 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 += -static -finhibit-size-directive
47 ifeq "$(mingw32_TARGET_OS)" "1"
48 PLATFORM_CC_OPTS += -mno-cygwin
51 PLATFORM_CC_OPTS += -D__GLASGOW_HASKELL__=$(ProjectVersionInt)
53 HC_BOOT_CC_OPTS = $(PLATFORM_HC_BOOT_CC_OPTS) $(PLATFORM_CC_OPTS) $(CC_OPTS)
55 SRC_CC_OPTS += -I$(FPTOOLS_TOP_ABS)/ghc/includes -I$(FPTOOLS_TOP_ABS)/ghc/lib/std/cbits -I$(FPTOOLS_TOP_ABS)/hslibs/lang/cbits -I$(FPTOOLS_TOP_ABS)/hslibs/posix/cbits -I$(FPTOOLS_TOP_ABS)/hslibs/util/cbits -I$(FPTOOLS_TOP_ABS)/hslibs/text/cbits -I$(FPTOOLS_TOP_ABS)/hslibs/hssource/cbits
57 # -----------------------------------------------------------------------------
58 # Linking: we have to give all the libraries explicitly.
61 -L$(FPTOOLS_TOP_ABS)/ghc/rts \
62 -L$(FPTOOLS_TOP_ABS)/ghc/rts/gmp \
63 -L$(FPTOOLS_TOP_ABS)/ghc/lib/std \
64 -L$(FPTOOLS_TOP_ABS)/ghc/lib/std/cbits \
65 -L$(FPTOOLS_TOP_ABS)/hslibs/lang \
66 -L$(FPTOOLS_TOP_ABS)/hslibs/lang/cbits \
67 -L$(FPTOOLS_TOP_ABS)/hslibs/concurrent \
68 -L$(FPTOOLS_TOP_ABS)/hslibs/concurrent/cbits \
69 -L$(FPTOOLS_TOP_ABS)/hslibs/posix \
70 -L$(FPTOOLS_TOP_ABS)/hslibs/posix/cbits \
71 -L$(FPTOOLS_TOP_ABS)/hslibs/util \
72 -L$(FPTOOLS_TOP_ABS)/hslibs/util/cbits \
73 -L$(FPTOOLS_TOP_ABS)/hslibs/text \
74 -u "PrelBase_Izh_static_info" \
75 -u "PrelBase_Czh_static_info" \
76 -u "PrelFloat_Fzh_static_info" \
77 -u "PrelFloat_Dzh_static_info" \
78 -u "PrelPtr_Ptr_static_info" \
79 -u "PrelWord_Wzh_static_info" \
80 -u "PrelInt_I8zh_static_info" \
81 -u "PrelInt_I16zh_static_info" \
82 -u "PrelInt_I32zh_static_info" \
83 -u "PrelInt_I64zh_static_info" \
84 -u "PrelWord_W8zh_static_info" \
85 -u "PrelWord_W16zh_static_info" \
86 -u "PrelWord_W32zh_static_info" \
87 -u "PrelWord_W64zh_static_info" \
88 -u "PrelStable_StablePtr_static_info" \
89 -u "PrelBase_Izh_con_info" \
90 -u "PrelBase_Czh_con_info" \
91 -u "PrelFloat_Fzh_con_info" \
92 -u "PrelFloat_Dzh_con_info" \
93 -u "PrelPtr_Ptr_con_info" \
94 -u "PrelStable_StablePtr_con_info" \
95 -u "PrelBase_False_closure" \
96 -u "PrelBase_True_closure" \
97 -u "PrelPack_unpackCString_closure" \
98 -u "PrelIOBase_stackOverflow_closure" \
99 -u "PrelIOBase_heapOverflow_closure" \
100 -u "PrelIOBase_NonTermination_closure" \
101 -u "PrelIOBase_BlockedOnDeadMVar_closure" \
102 -u "PrelWeak_runFinalizzerBatch_closure" \
103 -u "__init_Prelude" \
104 -u "PrelMain_mainIO_closure" \
107 HC_BOOT_LIBS = -lHStext -lHSutil -lHSposix -lHSposix_cbits -lHSconcurrent -lHSlang -lHSlang_cbits -lHSstd -lHSstd_cbits -lHSrts -lgmp $(EXTRA_HC_BOOT_LIBS)
109 ifeq "$(GhcLibsWithReadline)" "YES"
110 HC_BOOT_LIBS += $(patsubst %, -l%, $(LibsReadline))
113 ifeq "$(HaveLibDL)" "YES"
117 # -----------------------------------------------------------------------------
118 # suffix rules for building a .o from a .hc file.
121 $(CC) -x c $< -o $@ -S -O $(HC_BOOT_CC_OPTS) -I. `echo $(patsubst -monly-%-regs, -DSTOLEN_X86_REGS=%, $(filter -monly-%-regs, $($*_HC_OPTS))) | sed 's/^$$/-DSTOLEN_X86_REGS=4/'`
124 $(GHC_MANGLER) $< $@ $(patsubst -monly-%-regs, %, $(filter -monly-%-regs, $($*_HC_OPTS)))