[project @ 2001-05-18 16:54:04 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
27 ifneq "$(DLLized)" "YES"
28 PACKAGE = -package-name std
29 else
30 # Hack by SPJ to delay if-then-else until the pattern rule when we have $*
31 PACKAGE = $(subst ~, ,$(word $(words dummy $(findstring $(notdir $*), PrelMain )), -package-name~std))
32 endif
33
34 HSLIB = std
35
36 # we don't want PrelMain in the GHCi library.
37 GHCI_LIBOBJS = $(filter-out PrelMain.$(way_)o,$(HS_OBJS))
38
39 BOOT_SRCS += PrelPrimopWrappers.hs
40
41 #-----------------------------------------------------------------------------
42 #       Setting the GHC compile options
43
44 SRC_HC_OPTS += -cpp -fvia-C -fglasgow-exts $(GhcLibHcOpts) $(PACKAGE)
45
46 SRC_HSC2HS_OPTS += -Icbits
47
48 ifdef USE_REPORT_PRELUDE
49 SRC_HC_OPTS += -DUSE_REPORT_PRELUDE=1
50 endif
51
52 # ESSENTIAL, for getting reasonable performance from the I/O library:
53 PrelIOBase_HC_OPTS   = -funbox-strict-fields 
54
55 # debugging...
56 PrelIOBase_HC_OPTS   += -fno-ignore-asserts
57 PrelHandle_HC_OPTS   += -fno-ignore-asserts
58 PrelIO_HC_OPTS       += -fno-ignore-asserts
59
60 # Special options
61 PrelStorable_HC_OPTS = -monly-3-regs
62 PrelCError_HC_OPTS   = +RTS -K4m -RTS
63 PrelInt_HC_OPTS      = -monly-3-regs
64 PrelWord_HC_OPTS     = -monly-3-regs
65
66 #-----------------------------------------------------------------------------
67 #       Dependency generation
68
69 SRC_MKDEPENDHS_OPTS += -I$(GHC_INCLUDE_DIR)
70
71 #-----------------------------------------------------------------------------
72 #       Rules
73
74 PrelPrimopWrappers.hs: ../../compiler/prelude/primops.txt
75         rm -f PrelPrimopWrappers.hs
76         ../../utils/genprimopcode/genprimopcode  --make-haskell-wrappers \
77                 < ../../compiler/prelude/primops.txt > PrelPrimopWrappers.hs
78
79 PrelGHC.$(way_)hi       : PrelGHC.hi-boot
80         cp $< $@
81
82 boot :: PrelGHC.hi $(foreach way, $(WAYS), PrelGHC.$(way)_hi)
83
84 ifneq "$(BootingFromHc)" "YES"
85 boot :: PrelPrimopWrappers.hs
86 all  :: PrelPrimopWrappers.hs
87 endif
88
89 DLL_DESCRIPTION="GHC-compiled Haskell Prelude"
90
91 ifeq "$(DLLized)" "YES"
92 HS_SRCS := $(filter-out PrelMain.lhs, $(HS_SRCS))
93 # PrelMain.dll_o isn't to be included in the final .a, 
94 # but it needs to be generated
95 all :: PrelMain.dll_o
96 endif
97
98 CLEAN_FILES += PrelGHC.hi $(foreach way, $(WAYS), PrelGHC.$(way)_hi)
99
100 #-----------------------------------------------------------------------------
101 #       Installation; need to install .hi files as well as libraries
102 #
103 # The interface files are put inside the $(libdir), since they
104 # might (potentially) be platform specific..
105 #
106 # override is used here because for binary distributions, datadir is
107 # set on the command line. sigh.
108 #
109 override datadir:=$(libdir)/imports/std
110
111 #
112 # Files to install from here
113
114 ifeq "$(DLLized)" "YES"
115 INSTALL_LIBS  += PrelMain.dll_o
116 endif
117
118 INSTALL_DATAS += PrelGHC.$(way_)hi
119
120 include $(TOP)/mk/target.mk