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