1 #################################################################################
5 # Makefile for building the GHC Prelude libraries umpteen ways
8 #################################################################################
11 include $(TOP)/mk/boilerplate.mk
21 #-----------------------------------------------------------------------------
22 # Setting the standard variables
26 MKDEPENDHS = $(GHC_INPLACE)
28 LIBRARY = libHS$(_way).a
31 #-----------------------------------------------------------------------------
32 # Setting the GHC compile options
34 SRC_HC_OPTS += -recomp -cpp -fglasgow-exts -fvia-C -Rghc-timing $(GhcLibHcOpts) -fcompiling-prelude
36 SRC_HC_OPTS += -static
39 ifdef USE_REPORT_PRELUDE
40 SRC_HC_OPTS += -DUSE_REPORT_PRELUDE=1
44 # Object and interface files have suffixes tagged with their ways
47 SRC_HC_OPTS += -hisuf $(way_)hi
51 PrelArrExtra_HC_OPTS += -monly-2-regs
53 # Far too much heap is needed to compile PrelNumExtra with -O at the
54 # moment, but there you go..
55 PrelNumExtra_HC_OPTS += -H24m -K2m
57 PrelPack_HC_OPTS += -K4m
58 PrelBase_HC_OPTS += -H12m
59 PrelRead_HC_OPTS += -H20m
60 PrelTup_HC_OPTS += -H12m -K2m
61 PrelNum_HC_OPTS += -H12m -K4m
62 PrelArr_HC_OPTS += -H8m
63 PrelHandle_HC_OPTS += -H20m
64 Time_HC_OPTS += -H24m -K2m
65 Complex_HC_OPTS += -H10m
68 Directory_HC_OPTS += -H8m
70 #-----------------------------------------------------------------------------
71 # Dependency generation
73 SRC_MKDEPENDHS_OPTS += -I$(GHC_INCLUDE_DIR)
75 #-----------------------------------------------------------------------------
78 PrelGHC.$(way_)hi : PrelGHC.hi-boot
81 boot :: PrelGHC.hi $(foreach way, $(WAYS), PrelGHC.$(way)_hi)
84 DLL_DESCRIPTION="GHC-compiled Haskell Prelude"
85 DLL_IMPLIB_NAME = libHS_imp.a
86 SRC_BLD_DLL_OPTS += --export-all --output-def=HSprel.def DllVersionInfo.o
87 SRC_BLD_DLL_OPTS += -lwinmm -lHSrts_imp -lHScbits_imp -lgmp -L. -L../../rts/gmp -L../../rts -Lcbits
90 HS_SRCS := $(filter-out PrelMain.lhs, $(HS_SRCS))
93 # PrelMain.dll_o isn't to be included in the final .a,
94 # but it needs to be generated
96 all :: PrelMain.dll_o DllVersionInfo.o
101 # Building PrelMain.dll_o is, unfortunately, somewhat tricky
102 # with the current DLL setup. PrelMain.dll_o should refer to
103 # all its imports bar Main.main_closure as residing in DLLs.
104 # But, since the .hi's of PrelBase et al. is in the same
105 # directory as PrelMain, the compiler will assume that they
106 # reside in the same DLL as PrelMain & generate code accordingly.
108 # So, we copy out PrelMain.lhs to ".." and build it there &
109 # copy the gen'ed object file back in again.
112 PrelMain.dll_o : PrelMain.lhs
113 $(RM) ../PrelMain.lhs
114 $(CP) PrelMain.lhs ../
115 $(MAKE) -C .. PrelMain.dll_o way=dll HC_OPTS="$(filter-out -fcompiling-prelude, $(HC_OPTS))"
116 $(MV) ../PrelMain.dll_o .
117 $(RM) ../PrelMain.lhs ../PrelMain.dll_hi
120 #-----------------------------------------------------------------------------
121 # Installation; need to install .hi files as well as libraries
123 # The interface files are put inside the $(libdir), since they
124 # might (potentially) be platform specific..
126 # override is used here because for binary distributions, datadir is
127 # set on the command line. sigh.
129 override datadir:=$(libdir)/imports/std
132 # Files to install from here
134 INSTALL_LIBS += $(LIBRARY)
135 ifeq "$(EnableWin32DLLs)" "YES"
136 INSTALL_PROGS += $(DLL_NAME)
137 INSTALL_LIBS += $(patsubst %.a, %_imp.a, $(LIBRARY)) PrelMain.dll_o
138 INSTALL_DATAS += dLL_ifs.hi
140 INSTALL_DATAS += $(HS_IFACES) PrelGHC.$(way_)hi
142 include $(TOP)/mk/target.mk