0379264de3e59461f0af0a08fd2ea3f7bd8706f3
[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 #-----------------------------------------------------------------------------
40 #       Setting the GHC compile options
41
42 SRC_HC_OPTS += -recomp -cpp -fvia-C -fglasgow-exts $(GhcLibHcOpts) $(PACKAGE)
43 ifneq "$(DLLized)" "YES"
44 SRC_HC_OPTS += -static
45 endif
46
47 ifdef USE_REPORT_PRELUDE
48 SRC_HC_OPTS += -DUSE_REPORT_PRELUDE=1
49 endif
50
51 #
52 # Object and interface files have suffixes tagged with their ways
53 #
54 ifneq "$(way)" ""
55 SRC_HC_OPTS += -hisuf $(way_)hi
56 endif
57
58 #-----------------------------------------------------------------------------
59 #       Dependency generation
60
61 SRC_MKDEPENDHS_OPTS += -I$(GHC_INCLUDE_DIR)
62
63 #-----------------------------------------------------------------------------
64 #       Rules
65
66 PrelGHC.$(way_)hi       : PrelGHC.hi-boot
67         cp $< $@
68
69 boot :: PrelGHC.hi $(foreach way, $(WAYS), PrelGHC.$(way)_hi)
70
71 DLL_DESCRIPTION="GHC-compiled Haskell Prelude"
72
73 ifeq "$(DLLized)" "YES"
74 HS_SRCS := $(filter-out PrelMain.lhs PrelHugs.lhs, $(HS_SRCS))
75 endif
76
77 # PrelMain.dll_o isn't to be included in the final .a, 
78 # but it needs to be generated
79 ifeq "$(DLLized)" "YES"
80 all :: PrelMain.dll_o
81 endif
82
83 CLEAN_FILES += PrelGHC.hi $(foreach way, $(WAYS), PrelGHC.$(way)_hi)
84
85 #
86 # If we're building the unregisterised way, it may well be for Hugs.
87 # In that case, remember to bind the cbits objects into a single file
88 # which hugs can load as an auxiliary object file when loading the Prelude.
89 #
90 ifeq "$(way)" "u"
91 all :: libHSstd_cbits.u_o
92 CLEAN_FILES += libHSstd_cbits.u_o
93 libHSstd_cbits.u_o:
94         $(RM) libHSstd_cbits.u_o
95         ld -r -o libHSstd_cbits.u_o cbits/*.o
96 endif
97
98 #-----------------------------------------------------------------------------
99 #       Installation; need to install .hi files as well as libraries
100 #
101 # The interface files are put inside the $(libdir), since they
102 # might (potentially) be platform specific..
103 #
104 # override is used here because for binary distributions, datadir is
105 # set on the command line. sigh.
106 #
107 override datadir:=$(libdir)/imports/std
108
109 #
110 # Files to install from here
111
112 ifeq "$(DLLized)" "YES"
113 INSTALL_LIBS  += PrelMain.dll_o
114 endif
115
116 INSTALL_DATAS += PrelGHC.$(way_)hi
117 ifeq "$(DLLized)" "YES"
118 INSTALL_DATAS := $(filter-out PrelHugs.$(way_)hi,$(INSTALL_DATAS))
119 endif
120
121 include $(TOP)/mk/target.mk