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