[project @ 2000-11-14 14:33:02 by simonmar]
[ghc-hetmet.git] / ghc / lib / std / Makefile
1 #################################################################################
2 #
3 #                           ghc/lib/std/Makefile
4 #
5 #               Makefile for building the GHC Prelude libraries umpteen ways
6 #
7 #       
8 #################################################################################
9
10 TOP = ../..
11 include $(TOP)/mk/boilerplate.mk
12
13 WAYS=$(GhcLibWays)
14
15 ifeq "$(way)" ""
16 SUBDIRS = cbits
17 else
18 SUBDIRS=
19 endif
20
21 #-----------------------------------------------------------------------------
22 #       Setting the standard variables
23 #
24
25 HC         = $(GHC_INPLACE)
26 MKDEPENDHS = $(GHC_INPLACE)
27
28 ifneq "$(DLLized)" "YES"
29 PACKAGE = -package-name std
30 else
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))
33 endif
34
35 HSLIB = std
36
37 ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
38 LIBOBJS = $(filter-out PrelHugs.$(way_)o,$(HS_OBJS))
39 endif
40
41 #-----------------------------------------------------------------------------
42 #       Setting the GHC compile options
43
44 SRC_HC_OPTS += -recomp -cpp -fvia-C -fglasgow-exts $(GhcLibHcOpts) $(PACKAGE)
45 ifneq "$(DLLized)" "YES"
46 SRC_HC_OPTS += -static
47 endif
48
49 ifdef USE_REPORT_PRELUDE
50 SRC_HC_OPTS += -DUSE_REPORT_PRELUDE=1
51 endif
52
53 #
54 # Object and interface files have suffixes tagged with their ways
55 #
56 ifneq "$(way)" ""
57 SRC_HC_OPTS += -hisuf $(way_)hi
58 endif
59
60 # Far too much heap is needed to compile PrelNumExtra with -O at the
61 # moment, but there you go..
62 <<<<<<< Makefile
63 # PrelNumExtra_HC_OPTS     += -H24m -K2m
64
65 # PrelPack_HC_OPTS       += -K4m
66 # PrelBase_HC_OPTS         += -H12m
67 # PrelRead_HC_OPTS         += -H20m
68 # PrelTup_HC_OPTS          += -H12m -K2m
69 # PrelNum_HC_OPTS                += -H12m -K4m
70 # PrelArr_HC_OPTS          += -H8m
71 # PrelHandle_HC_OPTS       += -H20m
72 # Time_HC_OPTS             += -H24m -K2m
73 # Complex_HC_OPTS          += -H10m
74 # IO_HC_OPTS             += -H12m
75 # List_HC_OPTS             += -H8m
76 # Directory_HC_OPTS        += -H8m
77 =======
78 PrelNumExtra_HC_OPTS     += +RTS -H24m -K2m -RTS
79 >>>>>>> 1.50
80
81 <<<<<<< Makefile
82 =======
83 PrelPack_HC_OPTS         += +RTS -K4m -RTS
84 PrelBase_HC_OPTS         += +RTS -H12m -RTS
85 PrelRead_HC_OPTS         += +RTS -H20m -RTS
86 PrelTup_HC_OPTS          += +RTS -H12m -K2m -RTS
87 PrelNum_HC_OPTS          += +RTS -H12m -K4m -RTS
88 PrelArr_HC_OPTS          += +RTS -H8m -RTS
89 PrelHandle_HC_OPTS       += +RTS -H20m -RTS
90 Time_HC_OPTS             += +RTS -H24m -K2m -RTS
91 Complex_HC_OPTS          += +RTS -H10m -RTS
92 IO_HC_OPTS               += +RTS -H12m -RTS
93 List_HC_OPTS             += +RTS -H8m -RTS
94 Directory_HC_OPTS        += +RTS -H8m -RTS
95
96 >>>>>>> 1.50
97 #-----------------------------------------------------------------------------
98 #       Dependency generation
99
100 SRC_MKDEPENDHS_OPTS += -I$(GHC_INCLUDE_DIR)
101
102 #-----------------------------------------------------------------------------
103 #       Rules
104
105 PrelGHC.$(way_)hi       : PrelGHC.hi-boot
106         cp $< $@
107
108 boot :: PrelGHC.hi $(foreach way, $(WAYS), PrelGHC.$(way)_hi)
109
110 DLL_DESCRIPTION="GHC-compiled Haskell Prelude"
111
112 ifeq "$(DLLized)" "YES"
113 HS_SRCS := $(filter-out PrelMain.lhs PrelHugs.lhs, $(HS_SRCS))
114 endif
115
116 # PrelMain.dll_o isn't to be included in the final .a, 
117 # but it needs to be generated
118 ifeq "$(DLLized)" "YES"
119 all :: PrelMain.dll_o
120 endif
121
122 CLEAN_FILES += PrelGHC.hi $(foreach way, $(WAYS), PrelGHC.$(way)_hi)
123
124 #
125 # If we're building the unregisterised way, it may well be for Hugs.
126 # In that case, remember to bind the cbits objects into a single file
127 # which hugs can load as an auxiliary object file when loading the Prelude.
128 #
129 ifeq "$(way)" "u"
130 all :: libHSstd_cbits.u_o
131 CLEAN_FILES += libHSstd_cbits.u_o
132 libHSstd_cbits.u_o:
133         $(RM) libHSstd_cbits.u_o
134         ld -r -o libHSstd_cbits.u_o cbits/*.o
135 endif
136
137 #-----------------------------------------------------------------------------
138 #       Installation; need to install .hi files as well as libraries
139 #
140 # The interface files are put inside the $(libdir), since they
141 # might (potentially) be platform specific..
142 #
143 # override is used here because for binary distributions, datadir is
144 # set on the command line. sigh.
145 #
146 override datadir:=$(libdir)/imports/std
147
148 #
149 # Files to install from here
150
151 ifeq "$(DLLized)" "YES"
152 INSTALL_LIBS  += PrelMain.dll_o
153 endif
154
155 INSTALL_DATAS += PrelGHC.$(way_)hi
156 ifeq "$(DLLized)" "YES"
157 INSTALL_DATAS := $(filter-out PrelHugs.$(way_)hi,$(INSTALL_DATAS))
158 endif
159
160 include $(TOP)/mk/target.mk