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