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