[project @ 2003-07-23 15:39:54 by simonmar]
[haskell-directory.git] / Makefile
1 # -----------------------------------------------------------------------------
2 # $Id: Makefile,v 1.44 2003/07/23 15:39:54 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/Array/IO \
19         Data/STRef \
20         Debug \
21         Debug/QuickCheck \
22         Foreign \
23         Foreign/C \
24         Foreign/Marshal \
25         GHC \
26         System \
27         System/Console \
28         System/Mem \
29         System/IO \
30         System/Posix \
31         Text \
32         Text/Html \
33         Text/PrettyPrint \
34         Text/ParserCombinators \
35         Text/ParserCombinators/Parsec \
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 ifeq "$(BootingFromHc)" "YES"
61 GHC/PrimopWrappers.hs:
62         touch GHC/PrimopWrappers.hs
63 else
64 GHC/PrimopWrappers.hs: $(GHC_COMPILER_DIR)/prelude/primops.txt
65         @$(RM) $@
66         $(GHC_GENPRIMOP) --make-haskell-wrappers < $< > $@
67 endif
68
69 boot :: GHC/PrimopWrappers.hs
70
71 EXTRA_SRCS  += GHC/PrimopWrappers.hs
72 CLEAN_FILES += GHC/PrimopWrappers.hs
73
74 #-----------------------------------------------------------------------------
75 #       Building the library for GHCi
76 #
77 # The procedure differs from that in fptools/mk/target.mk in one way:
78 #  (*) on Win32 we must split it into two, because a single .o file can't
79 #      have more than 65536 relocations in it [due to a bug in the GNU
80 #      linker.]
81
82 OBJECT_FILEFORMAT=unknown
83 ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
84 OBJECT_FILEFORMAT=PEi
85 endif
86 ifeq "$(TARGETPLATFORM)" "i386-unknown-cygwin32"
87 OBJECT_FILEFORMAT=PEi
88 endif
89
90 ifeq "$(OBJECT_FILEFORMAT)" "PEi"
91
92 # Turn off standard rule which creates HSbase.o from LIBOBJS.
93 DONT_WANT_STD_GHCI_LIB_RULE=YES
94
95 GHCI_LIBOBJS = $(HS_OBJS)
96
97 INSTALL_LIBS += HSbase1.o HSbase2.o HSbase3.o
98
99 endif # OBJECT_FILEFORMAT = PEi
100
101
102 # -----------------------------------------------------------------------------
103 # Doc building with Haddock
104
105 EXCLUDED_HADDOCK_SRCS = \
106         GHC/PrimopWrappers.hs \
107         GHC/PArr.hs
108
109 SRC_HADDOCK_OPTS += -t "Haskell Core Libraries (base package)" \
110         --no-implicit-prelude -p prologue.txt
111
112 # -----------------------------------------------------------------------------
113
114 include $(TOP)/mk/target.mk
115
116 ifeq "$(OBJECT_FILEFORMAT)" "PEi"
117 HSbase.o : $(GHCI_LIBOBJS)
118         $(LD) -r $(LD_X) -o HSbase1.o $(filter     GHC/%, $(GHCI_LIBOBJS))
119         $(LD) -r $(LD_X) -o HSbase2.o $(filter     Text/%, $(GHCI_LIBOBJS))
120         $(LD) -r $(LD_X) -o HSbase3.o $(filter-out GHC/% Text/%, $(GHCI_LIBOBJS))
121         @touch HSbase.o
122 endif # OBJECT_FILEFORMAT = PEi
123