[project @ 2003-07-31 17:45:22 by ross]
[ghc-base.git] / Makefile
1 # -----------------------------------------------------------------------------
2 # $Id: Makefile,v 1.47 2003/07/31 17:45:22 ross Exp $
3
4 TOP=..
5 include $(TOP)/mk/boilerplate.mk
6
7 # -----------------------------------------------------------------------------
8
9 SUBDIRS = cbits include
10
11 ALL_DIRS = \
12         Control \
13         Control/Concurrent \
14         Control/Monad \
15         Control/Monad/ST \
16         Data \
17         Data/Generics \
18         Data/Array \
19         Data/Array/IO \
20         Data/STRef \
21         Debug \
22         Debug/QuickCheck \
23         Foreign \
24         Foreign/C \
25         Foreign/Marshal \
26         GHC \
27         System \
28         System/Console \
29         System/Mem \
30         System/IO \
31         System/Posix \
32         Text \
33         Text/Html \
34         Text/PrettyPrint \
35         Text/ParserCombinators \
36         Text/Regex \
37         Text/Show \
38         Text/Read
39
40 PACKAGE = base
41
42 SRC_HC_OPTS += -fglasgow-exts -cpp -Iinclude -\#include HsBase.h
43 SRC_HSC2HS_OPTS += -Iinclude -I$(FPTOOLS_TOP)/ghc/includes
44
45 # Make sure we can get hold of regex.h
46 ifneq "$(HavePosixRegex)" "YES"
47 SRC_HC_OPTS     += -Icbits/regex
48 SRC_HSC2HS_OPTS += -Icbits/regex
49 endif
50
51 # -----------------------------------------------------------------------------
52 # Per-module flags
53
54 # ESSENTIAL, for getting reasonable performance from the I/O library:
55 SRC_HC_OPTS += -funbox-strict-fields
56
57 # -----------------------------------------------------------------------------
58 # PrimOpWrappers
59
60 # These two lines are required for pre-processing ghc/compiler/prelude/primops.txt
61 SRC_CPP_OPTS += -I$(GHC_INCLUDE_DIR)
62 SRC_CPP_OPTS += ${GhcCppOpts}
63
64 ifeq "$(BootingFromHc)" "YES"
65 GHC/PrimopWrappers.hs:
66         touch GHC/PrimopWrappers.hs
67 else
68 GHC/PrimopWrappers.hs: $(GHC_COMPILER_DIR)/prelude/primops.txt
69         @$(RM) $@
70         $(GHC_GENPRIMOP) --make-haskell-wrappers < $< > $@
71 endif
72
73 boot :: GHC/PrimopWrappers.hs
74
75 EXTRA_SRCS  += GHC/PrimopWrappers.hs
76 CLEAN_FILES += GHC/PrimopWrappers.hs
77
78 #-----------------------------------------------------------------------------
79 #       Building the library for GHCi
80 #
81 # The procedure differs from that in fptools/mk/target.mk in one way:
82 #  (*) on Win32 we must split it into two, because a single .o file can't
83 #      have more than 65536 relocations in it [due to a bug in the GNU
84 #      linker.]
85
86 OBJECT_FILEFORMAT=unknown
87 ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
88 OBJECT_FILEFORMAT=PEi
89 endif
90 ifeq "$(TARGETPLATFORM)" "i386-unknown-cygwin32"
91 OBJECT_FILEFORMAT=PEi
92 endif
93
94 ifeq "$(OBJECT_FILEFORMAT)" "PEi"
95
96 # Turn off standard rule which creates HSbase.o from LIBOBJS.
97 DONT_WANT_STD_GHCI_LIB_RULE=YES
98
99 GHCI_LIBOBJS = $(HS_OBJS)
100
101 INSTALL_LIBS += HSbase1.o HSbase2.o HSbase3.o
102
103 endif # OBJECT_FILEFORMAT = PEi
104
105
106 # -----------------------------------------------------------------------------
107 # Doc building with Haddock
108
109 EXCLUDED_HADDOCK_SRCS = \
110         GHC/PrimopWrappers.hs \
111         GHC/PArr.hs
112
113 SRC_HADDOCK_OPTS += -t "Haskell Core Libraries (base package)" \
114         --no-implicit-prelude -p prologue.txt
115
116 # -----------------------------------------------------------------------------
117
118 include $(TOP)/mk/target.mk
119
120 ifeq "$(OBJECT_FILEFORMAT)" "PEi"
121 HSbase.o : $(GHCI_LIBOBJS)
122         $(LD) -r $(LD_X) -o HSbase1.o $(filter     GHC/%, $(GHCI_LIBOBJS))
123         $(LD) -r $(LD_X) -o HSbase2.o $(filter     Text/%, $(GHCI_LIBOBJS))
124         $(LD) -r $(LD_X) -o HSbase3.o $(filter-out GHC/% Text/%, $(GHCI_LIBOBJS))
125         @touch HSbase.o
126 endif # OBJECT_FILEFORMAT = PEi
127