[project @ 2003-07-24 12:19:57 by ralf]
[haskell-directory.git] / Makefile
1 # -----------------------------------------------------------------------------
2 # $Id: Makefile,v 1.45 2003/07/24 12:19:57 ralf 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/ParserCombinators/Parsec \
37         Text/Regex \
38         Text/Show \
39         Text/Read
40
41 PACKAGE = base
42
43 SRC_HC_OPTS += -fglasgow-exts -cpp -Iinclude -\#include HsBase.h
44 SRC_HSC2HS_OPTS += -Iinclude -I$(FPTOOLS_TOP)/ghc/includes
45
46 # Make sure we can get hold of regex.h
47 ifneq "$(HavePosixRegex)" "YES"
48 SRC_HC_OPTS     += -Icbits/regex
49 SRC_HSC2HS_OPTS += -Icbits/regex
50 endif
51
52 # -----------------------------------------------------------------------------
53 # Per-module flags
54
55 # ESSENTIAL, for getting reasonable performance from the I/O library:
56 SRC_HC_OPTS += -funbox-strict-fields
57
58 # -----------------------------------------------------------------------------
59 # PrimOpWrappers
60
61 ifeq "$(BootingFromHc)" "YES"
62 GHC/PrimopWrappers.hs:
63         touch GHC/PrimopWrappers.hs
64 else
65 GHC/PrimopWrappers.hs: $(GHC_COMPILER_DIR)/prelude/primops.txt
66         @$(RM) $@
67         $(GHC_GENPRIMOP) --make-haskell-wrappers < $< > $@
68 endif
69
70 boot :: GHC/PrimopWrappers.hs
71
72 EXTRA_SRCS  += GHC/PrimopWrappers.hs
73 CLEAN_FILES += GHC/PrimopWrappers.hs
74
75 #-----------------------------------------------------------------------------
76 #       Building the library for GHCi
77 #
78 # The procedure differs from that in fptools/mk/target.mk in one way:
79 #  (*) on Win32 we must split it into two, because a single .o file can't
80 #      have more than 65536 relocations in it [due to a bug in the GNU
81 #      linker.]
82
83 OBJECT_FILEFORMAT=unknown
84 ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
85 OBJECT_FILEFORMAT=PEi
86 endif
87 ifeq "$(TARGETPLATFORM)" "i386-unknown-cygwin32"
88 OBJECT_FILEFORMAT=PEi
89 endif
90
91 ifeq "$(OBJECT_FILEFORMAT)" "PEi"
92
93 # Turn off standard rule which creates HSbase.o from LIBOBJS.
94 DONT_WANT_STD_GHCI_LIB_RULE=YES
95
96 GHCI_LIBOBJS = $(HS_OBJS)
97
98 INSTALL_LIBS += HSbase1.o HSbase2.o HSbase3.o
99
100 endif # OBJECT_FILEFORMAT = PEi
101
102
103 # -----------------------------------------------------------------------------
104 # Doc building with Haddock
105
106 EXCLUDED_HADDOCK_SRCS = \
107         GHC/PrimopWrappers.hs \
108         GHC/PArr.hs
109
110 SRC_HADDOCK_OPTS += -t "Haskell Core Libraries (base package)" \
111         --no-implicit-prelude -p prologue.txt
112
113 # -----------------------------------------------------------------------------
114
115 include $(TOP)/mk/target.mk
116
117 ifeq "$(OBJECT_FILEFORMAT)" "PEi"
118 HSbase.o : $(GHCI_LIBOBJS)
119         $(LD) -r $(LD_X) -o HSbase1.o $(filter     GHC/%, $(GHCI_LIBOBJS))
120         $(LD) -r $(LD_X) -o HSbase2.o $(filter     Text/%, $(GHCI_LIBOBJS))
121         $(LD) -r $(LD_X) -o HSbase3.o $(filter-out GHC/% Text/%, $(GHCI_LIBOBJS))
122         @touch HSbase.o
123 endif # OBJECT_FILEFORMAT = PEi
124