db136bfba462a901f9d1c512c2e4214e4be4e479
[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 LIBRARY = libHS$(_way).a
26 HS_SRCS = $(wildcard *.lhs)
27 HS_OBJS = $(HS_SRCS:.lhs=.$(way_)o)
28 LIBOBJS = $(HS_OBJS)
29 HS_IFACES= $(HS_SRCS:.lhs=.$(way_)hi) PrelGHC.$(way_)hi
30
31
32 #-----------------------------------------------------------------------------
33 #       Setting the GHC compile options
34
35 SRC_HC_OPTS += -recomp -cpp -fglasgow-exts -fvia-C -Rghc-timing $(GhcLibHcOpts) -fcompiling-prelude
36 ifneq "$(way)" "dll"
37 SRC_HC_OPTS += -static
38 endif
39
40 #
41 # Object and interface files have suffixes tagged with their ways
42 #
43 ifneq "$(way)" ""
44 SRC_HC_OPTS += -hisuf $(way_)hi
45 endif
46
47 # per-module flags
48 PrelArrExtra_HC_OPTS     += -monly-2-regs
49 Directory_HC_OPTS        += -monly-3-regs 
50 Time_HC_OPTS             += -monly-3-regs
51
52 # Far too much heap is needed to compile PrelNumExtra with -O at the
53 # moment, but there you go..
54 PrelNumExtra_HC_OPTS     += -H34m -K2m
55
56 PrelPack_HC_OPTS         += -K4m
57 PrelBase_HC_OPTS         += -H12m
58 PrelRead_HC_OPTS         += -H20m
59 PrelTup_HC_OPTS          += -H12m -K2m
60 PrelNum_HC_OPTS          += -H12m -K4m
61 PrelArr_HC_OPTS          += -H8m
62 PrelHandle_HC_OPTS       += -H20m
63 Time_HC_OPTS             += -H24m -K2m
64 Complex_HC_OPTS          += -H10m
65 IO_HC_OPTS               += -H12m
66 PrelMain_HC_OPTS         += -fno-prune-tydecls # avoids an apparent bug; ToDo
67 List_HC_OPTS             += -H8m
68 Directory_HC_OPTS        += -H8m
69
70 #-----------------------------------------------------------------------------
71 #       Dependency generation
72
73 SRC_MKDEPENDHS_OPTS += -I$(GHC_INCLUDE_DIR)
74
75 #-----------------------------------------------------------------------------
76 #       Rules
77
78 PrelGHC.$(way_)hi       : PrelGHC.hi-boot
79         cp $< $@
80
81 boot :: PrelGHC.hi $(foreach way, $(WAYS), PrelGHC.$(way)_hi)
82
83 DLL_NAME = HSprel.dll
84 DLL_IMPLIB_NAME = libHS_imp.a
85 SRC_BLD_DLL_OPTS += --export-all --output-def=HSprel.def
86 SRC_BLD_DLL_OPTS += -lwinmm -lHSrts_imp -lHS_cbits_imp -lgmp -L. -L../../rts/gmp -L../../rts -Lcbits
87
88
89 ifeq "$(way)" "dll"
90 HS_SRCS := $(filter-out PrelMain.lhs, $(HS_SRCS))
91 endif
92
93
94 #-----------------------------------------------------------------------------
95 #       Installation; need to install .hi files as well as libraries
96 #
97 # The interface files are put inside the $(libdir), since they
98 # might (potentially) be platform specific..
99 #
100 # override is used here because for binary distributions, datadir is
101 # set on the command line. sigh.
102 #
103 override datadir:=$(libdir)/imports/std
104
105 #
106 # Files to install from here
107
108 INSTALL_LIBS  += $(LIBRARY)
109 INSTALL_DATAS += $(HS_IFACES)
110
111 include $(TOP)/mk/target.mk