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