31adf52a21090385c302e61a02f21d8b9d54f364
[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 ifdef USE_REPORT_PRELUDE
47 SRC_HC_OPTS += -DUSE_REPORT_PRELUDE=1
48 endif
49
50 # Special options
51 PrelStorable_HC_OPTS = -monly-3-regs
52 PrelCError_HC_OPTS   = +RTS -K4m -RTS
53 PrelInt_HC_OPTS      = -monly-3-regs
54 PrelWord_HC_OPTS     = -monly-3-regs
55
56 #-----------------------------------------------------------------------------
57 #       Dependency generation
58
59 SRC_MKDEPENDHS_OPTS += -I$(GHC_INCLUDE_DIR)
60
61 #-----------------------------------------------------------------------------
62 #       Rules
63
64 PrelPrimopWrappers.hs: ../../compiler/prelude/primops.txt
65         rm -f PrelPrimopWrappers.hs
66         ../../utils/genprimopcode/genprimopcode  --make-haskell-wrappers \
67                 < ../../compiler/prelude/primops.txt > PrelPrimopWrappers.hs
68
69 PrelGHC.$(way_)hi       : PrelGHC.hi-boot
70         cp $< $@
71
72 boot :: PrelGHC.hi $(foreach way, $(WAYS), PrelGHC.$(way)_hi)
73
74 ifneq "$(BootingFromHc)" "YES"
75 boot :: PrelPrimopWrappers.hs
76 all  :: PrelPrimopWrappers.hs
77 endif
78
79 DLL_DESCRIPTION="GHC-compiled Haskell Prelude"
80
81 ifeq "$(DLLized)" "YES"
82 HS_SRCS := $(filter-out PrelMain.lhs, $(HS_SRCS))
83 # PrelMain.dll_o isn't to be included in the final .a, 
84 # but it needs to be generated
85 all :: PrelMain.dll_o
86 endif
87
88 CLEAN_FILES += PrelGHC.hi $(foreach way, $(WAYS), PrelGHC.$(way)_hi)
89
90 #-----------------------------------------------------------------------------
91 #       Installation; need to install .hi files as well as libraries
92 #
93 # The interface files are put inside the $(libdir), since they
94 # might (potentially) be platform specific..
95 #
96 # override is used here because for binary distributions, datadir is
97 # set on the command line. sigh.
98 #
99 override datadir:=$(libdir)/imports/std
100
101 #
102 # Files to install from here
103
104 ifeq "$(DLLized)" "YES"
105 INSTALL_LIBS  += PrelMain.dll_o
106 endif
107
108 INSTALL_DATAS += PrelGHC.$(way_)hi
109
110 include $(TOP)/mk/target.mk