7ed06cbcf110daddf460bafd57d55d8e3cb0782f
[ghc-base.git] / Makefile
1 # -----------------------------------------------------------------------------
2 # $Id: Makefile,v 1.46 2003/07/24 13:53:20 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/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 # These two lines are required for pre-processing ghc/compiler/prelude/primops.txt
62 SRC_CPP_OPTS += -I$(GHC_INCLUDE_DIR)
63 SRC_CPP_OPTS += ${GhcCppOpts}
64
65 ifeq "$(BootingFromHc)" "YES"
66 GHC/PrimopWrappers.hs:
67         touch GHC/PrimopWrappers.hs
68 else
69 GHC/PrimopWrappers.hs: $(GHC_COMPILER_DIR)/prelude/primops.txt
70         @$(RM) $@
71         $(GHC_GENPRIMOP) --make-haskell-wrappers < $< > $@
72 endif
73
74 boot :: GHC/PrimopWrappers.hs
75
76 EXTRA_SRCS  += GHC/PrimopWrappers.hs
77 CLEAN_FILES += GHC/PrimopWrappers.hs
78
79 #-----------------------------------------------------------------------------
80 #       Building the library for GHCi
81 #
82 # The procedure differs from that in fptools/mk/target.mk in one way:
83 #  (*) on Win32 we must split it into two, because a single .o file can't
84 #      have more than 65536 relocations in it [due to a bug in the GNU
85 #      linker.]
86
87 OBJECT_FILEFORMAT=unknown
88 ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
89 OBJECT_FILEFORMAT=PEi
90 endif
91 ifeq "$(TARGETPLATFORM)" "i386-unknown-cygwin32"
92 OBJECT_FILEFORMAT=PEi
93 endif
94
95 ifeq "$(OBJECT_FILEFORMAT)" "PEi"
96
97 # Turn off standard rule which creates HSbase.o from LIBOBJS.
98 DONT_WANT_STD_GHCI_LIB_RULE=YES
99
100 GHCI_LIBOBJS = $(HS_OBJS)
101
102 INSTALL_LIBS += HSbase1.o HSbase2.o HSbase3.o
103
104 endif # OBJECT_FILEFORMAT = PEi
105
106
107 # -----------------------------------------------------------------------------
108 # Doc building with Haddock
109
110 EXCLUDED_HADDOCK_SRCS = \
111         GHC/PrimopWrappers.hs \
112         GHC/PArr.hs
113
114 SRC_HADDOCK_OPTS += -t "Haskell Core Libraries (base package)" \
115         --no-implicit-prelude -p prologue.txt
116
117 # -----------------------------------------------------------------------------
118
119 include $(TOP)/mk/target.mk
120
121 ifeq "$(OBJECT_FILEFORMAT)" "PEi"
122 HSbase.o : $(GHCI_LIBOBJS)
123         $(LD) -r $(LD_X) -o HSbase1.o $(filter     GHC/%, $(GHCI_LIBOBJS))
124         $(LD) -r $(LD_X) -o HSbase2.o $(filter     Text/%, $(GHCI_LIBOBJS))
125         $(LD) -r $(LD_X) -o HSbase3.o $(filter-out GHC/% Text/%, $(GHCI_LIBOBJS))
126         @touch HSbase.o
127 endif # OBJECT_FILEFORMAT = PEi
128