Makefile 3.09 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 25
#################################################################################
#
#			    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
#

LIBRARY = libHS$(_way).a
26
HS_SRCS = $(wildcard *.lhs)
27 28 29 30 31 32 33 34
HS_OBJS = $(HS_SRCS:.lhs=.$(way_)o)
LIBOBJS = $(HS_OBJS)
HS_IFACES= $(HS_SRCS:.lhs=.$(way_)hi) PrelGHC.$(way_)hi


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

sof's avatar
sof committed
35 36 37 38
SRC_HC_OPTS += -recomp -cpp -fglasgow-exts -fvia-C -Rghc-timing $(GhcLibHcOpts) -fcompiling-prelude
ifneq "$(way)" "dll"
SRC_HC_OPTS += -static
endif
39 40 41 42 43 44 45 46 47 48 49 50 51 52

#
# Profiling options
WAY_p_HC_OPTS += -GPrelude
WAY_mr_HC_OPTS += -GPrelude

#
# Object and interface files have suffixes tagged with their ways
#
ifneq "$(way)" ""
SRC_HC_OPTS += -hisuf $(way_)hi
endif

# per-module flags
53 54 55
PrelArrExtra_HC_OPTS     += -monly-2-regs
Directory_HC_OPTS   	 += -monly-3-regs 
Time_HC_OPTS        	 += -monly-3-regs
56

57 58 59
# argh, adding USP seems to require extra heap... an extra 2 to 6MB,
# in fact, on each of these.  (KSW 1998-12)

60
# Far too much heap is needed to compile PrelNumExtra with -O at the
61
# moment, but there you go..
62
PrelNumExtra_HC_OPTS     += -H34m -K2m
63

64
PrelPack_HC_OPTS	 += -K4m
65 66 67
PrelBase_HC_OPTS         += -H12m
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
PrelMain_HC_OPTS	 += -fno-prune-tydecls # avoids an apparent bug; ToDo
75 76
List_HC_OPTS             += -H8m
Directory_HC_OPTS        += -H8m
77 78 79 80 81 82 83 84 85 86 87 88 89 90

#-----------------------------------------------------------------------------
# 	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)

sof's avatar
sof committed
91 92 93 94 95 96 97 98 99 100 101
DLL_NAME = HSprel.dll
DLL_IMPLIB_NAME = libHS_imp.a
SRC_BLD_DLL_OPTS += --export-all --output-def=HSprel.def
SRC_BLD_DLL_OPTS += -lwinmm -lHSrts_imp -lHS_cbits_imp -lgmp -L. -L../../rts/gmp -L../../rts -Lcbits


ifeq "$(way)" "dll"
HS_SRCS := $(filter-out PrelMain.lhs, $(HS_SRCS))
endif


102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
#-----------------------------------------------------------------------------
# 	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)
INSTALL_DATAS += $(HS_IFACES)

include $(TOP)/mk/target.mk