Makefile 3.98 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#################################################################################
#
#			    ghc/lib/std/Makefile
#
#		Makefile for building the GHC Prelude libraries umpteen ways
#
#	
#################################################################################

TOP = ../..
include $(TOP)/mk/boilerplate.mk

WAYS=$(GhcLibWays)

ifeq "$(way)" ""
SUBDIRS = cbits
else
SUBDIRS=
endif

#-----------------------------------------------------------------------------
# 	Setting the standard variables
#

25
26
27
HC 	   = $(GHC_INPLACE)
MKDEPENDHS = $(GHC_INPLACE)

rrt's avatar
rrt committed
28
29
30
31
ifneq "$(way)" "dll"
PACKAGE = -package-name std
else
# Hack by SPJ to delay if-then-else until the pattern rule when we have $*
rrt's avatar
rrt committed
32
PACKAGE = $(subst ~, ,$(word $(words dummy $(findstring $(notdir $*), PrelMain )), -package-name~std))
rrt's avatar
rrt committed
33
endif
34
LIBRARY = libHSstd$(_way).a
35

36
LIBOBJS = $(HS_OBJS)
rrt's avatar
rrt committed
37
ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
rrt's avatar
rrt committed
38
LIBOBJS = $(filter-out PrelHugs.$(way_)o,$(HS_OBJS))
rrt's avatar
rrt committed
39
endif
40
41
42
43

#-----------------------------------------------------------------------------
# 	Setting the GHC compile options

rrt's avatar
rrt committed
44
SRC_HC_OPTS += -recomp -cpp -fglasgow-exts -fvia-C -Rghc-timing $(GhcLibHcOpts) $(PACKAGE)
sof's avatar
sof committed
45
46
47
ifneq "$(way)" "dll"
SRC_HC_OPTS += -static
endif
48

49
50
51
52
ifdef USE_REPORT_PRELUDE
SRC_HC_OPTS += -DUSE_REPORT_PRELUDE=1
endif

53
54
55
56
57
58
59
#
# Object and interface files have suffixes tagged with their ways
#
ifneq "$(way)" ""
SRC_HC_OPTS += -hisuf $(way_)hi
endif

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
63

64
PrelPack_HC_OPTS	 += -K4m
65
PrelBase_HC_OPTS         += -H12m
66
67
PrelRead_HC_OPTS         += -H20m
PrelTup_HC_OPTS          += -H12m -K2m
68
PrelNum_HC_OPTS		 += -H12m -K4m
69
PrelArr_HC_OPTS          += -H8m
70
71
PrelHandle_HC_OPTS       += -H20m
Time_HC_OPTS             += -H24m -K2m
72
73
Complex_HC_OPTS          += -H10m
IO_HC_OPTS	         += -H12m
74
75
List_HC_OPTS             += -H8m
Directory_HC_OPTS        += -H8m
76
77
78
79
80
81
82
83
84
85
86
87
88
89

#-----------------------------------------------------------------------------
# 	Dependency generation

SRC_MKDEPENDHS_OPTS += -I$(GHC_INCLUDE_DIR)

#-----------------------------------------------------------------------------
# 	Rules

PrelGHC.$(way_)hi	: PrelGHC.hi-boot
	cp $< $@

boot :: PrelGHC.hi $(foreach way, $(WAYS), PrelGHC.$(way)_hi)

rrt's avatar
rrt committed
90
DLL_NAME = HSstd.dll
sof's avatar
sof committed
91
DLL_DESCRIPTION="GHC-compiled Haskell Prelude"
92
DLL_IMPLIB_NAME = libHSstd_imp.a
rrt's avatar
rrt committed
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
sof's avatar
sof committed
95
96

ifeq "$(way)" "dll"
rrt's avatar
rrt committed
97
HS_SRCS := $(filter-out PrelMain.lhs PrelHugs.lhs, $(HS_SRCS))
sof's avatar
sof committed
98
99
endif

sof's avatar
sof committed
100
101
# PrelMain.dll_o isn't to be included in the final .a, 
# but it needs to be generated
sof's avatar
sof committed
102
ifeq "$(way)" "dll"
sof's avatar
sof committed
103
104
all :: PrelMain.dll_o DllVersionInfo.o

sof's avatar
sof committed
105
106
endif

107
108
CLEAN_FILES += PrelGHC.hi $(foreach way, $(WAYS), PrelGHC.$(way)_hi)

109
110
111
112
113
114
#
# If we're building the unregisterised way, it may well be for Hugs.
# In that case, remember to bind the cbits objects into a single file
# which hugs can load as an auxiliary object file when loading the Prelude.
#
ifeq "$(way)" "u"
115
116
117
118
119
all :: libHSstd_cbits.u_o
CLEAN_FILES += libHSstd_cbits.u_o
libHSstd_cbits.u_o:
	$(RM) libHSstd_cbits.u_o
	ld -r -o libHSstd_cbits.u_o cbits/*.o
120
121
endif

122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#-----------------------------------------------------------------------------
# 	Installation; need to install .hi files as well as libraries
#
# The interface files are put inside the $(libdir), since they
# might (potentially) be platform specific..
#
# override is used here because for binary distributions, datadir is
# set on the command line. sigh.
#
override datadir:=$(libdir)/imports/std

#
# Files to install from here
# 
INSTALL_LIBS  += $(LIBRARY)
rrt's avatar
rrt committed
137
ifeq "$(way)" "dll"
sof's avatar
sof committed
138
INSTALL_PROGS += $(DLL_NAME)
rrt's avatar
rrt committed
139
140
141
142
143
INSTALL_LIBS  += PrelMain.dll_o
else
ifeq "$(EnableWin32Dlls)" "YES"
$(patsubst %.a,%_imp.a, $(LIBRARY))
endif
sof's avatar
sof committed
144
endif
145
INSTALL_DATAS += $(HS_IFACES) PrelGHC.$(way_)hi
rrt's avatar
rrt committed
146
147
148
ifeq "$(way)" "dll"
INSTALL_DATAS := $(filter-out PrelHugs.$(way_)hi,$(INSTALL_DATAS))
endif
149
150

include $(TOP)/mk/target.mk