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