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)
29 PACKAGE = -package-name std
31 # Hack by SPJ to delay if-then-else until the pattern rule when we have $*
32 PACKAGE = $(subst ~, ,$(word $(words dummy $(findstring $(notdir $*), PrelMain )), -package-name~std))
34 LIBRARY = libHSstd$(_way).a
37 ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
38 LIBOBJS = $(filter-out PrelHugs.$(way_)o,$(HS_OBJS))
41 #-----------------------------------------------------------------------------
42 # Setting the GHC compile options
44 SRC_HC_OPTS += -recomp -cpp -fglasgow-exts -fvia-C -Rghc-timing $(GhcLibHcOpts) $(PACKAGE)
46 SRC_HC_OPTS += -static
49 ifdef USE_REPORT_PRELUDE
50 SRC_HC_OPTS += -DUSE_REPORT_PRELUDE=1
54 # Object and interface files have suffixes tagged with their ways
57 SRC_HC_OPTS += -hisuf $(way_)hi
60 # Far too much heap is needed to compile PrelNumExtra with -O at the
61 # moment, but there you go..
62 PrelNumExtra_HC_OPTS += -H24m -K2m
64 PrelPack_HC_OPTS += -K4m
65 PrelBase_HC_OPTS += -H12m
66 PrelRead_HC_OPTS += -H20m
67 PrelTup_HC_OPTS += -H12m -K2m
68 PrelNum_HC_OPTS += -H12m -K4m
69 PrelArr_HC_OPTS += -H8m
70 PrelHandle_HC_OPTS += -H20m
71 Time_HC_OPTS += -H24m -K2m
72 Complex_HC_OPTS += -H10m
75 Directory_HC_OPTS += -H8m
77 #-----------------------------------------------------------------------------
78 # Dependency generation
80 SRC_MKDEPENDHS_OPTS += -I$(GHC_INCLUDE_DIR)
82 #-----------------------------------------------------------------------------
85 PrelGHC.$(way_)hi : PrelGHC.hi-boot
88 boot :: PrelGHC.hi $(foreach way, $(WAYS), PrelGHC.$(way)_hi)
91 DLL_DESCRIPTION="GHC-compiled Haskell Prelude"
92 DLL_IMPLIB_NAME = libHSstd_imp.a
93 SRC_BLD_DLL_OPTS += --export-all --output-def=HSstd.def DllVersionInfo.o
94 SRC_BLD_DLL_OPTS += -lwinmm -lHSrts_imp -lHSstd_cbits_imp -lgmp -L. -L../../rts/gmp -L../../rts -Lcbits
97 HS_SRCS := $(filter-out PrelMain.lhs PrelHugs.lhs, $(HS_SRCS))
100 # PrelMain.dll_o isn't to be included in the final .a,
101 # but it needs to be generated
103 all :: PrelMain.dll_o DllVersionInfo.o
107 CLEAN_FILES += PrelGHC.hi $(foreach way, $(WAYS), PrelGHC.$(way)_hi)
110 # If we're building the unregisterised way, it may well be for Hugs.
111 # In that case, remember to bind the cbits objects into a single file
112 # which hugs can load as an auxiliary object file when loading the Prelude.
115 all :: libHSstd_cbits.u_o
116 CLEAN_FILES += libHSstd_cbits.u_o
118 $(RM) libHSstd_cbits.u_o
119 ld -r -o libHSstd_cbits.u_o cbits/*.o
122 #-----------------------------------------------------------------------------
123 # Installation; need to install .hi files as well as libraries
125 # The interface files are put inside the $(libdir), since they
126 # might (potentially) be platform specific..
128 # override is used here because for binary distributions, datadir is
129 # set on the command line. sigh.
131 override datadir:=$(libdir)/imports/std
134 # Files to install from here
136 INSTALL_LIBS += $(LIBRARY)
138 INSTALL_PROGS += $(DLL_NAME)
139 INSTALL_LIBS += PrelMain.dll_o
141 ifeq "$(EnableWin32Dlls)" "YES"
142 $(patsubst %.a,%_imp.a, $(LIBRARY))
145 INSTALL_DATAS += $(HS_IFACES) PrelGHC.$(way_)hi
147 INSTALL_DATAS := $(filter-out PrelHugs.$(way_)hi,$(INSTALL_DATAS))
150 include $(TOP)/mk/target.mk