[project @ 2005-01-19 23:33:25 by ross]
[haskell-directory.git] / Makefile
1 TOP=..
2 include $(TOP)/mk/boilerplate.mk
3
4 # -----------------------------------------------------------------------------
5
6 SUBDIRS = cbits include
7
8 ALL_DIRS = \
9         Control \
10         Control/Concurrent \
11         Control/Parallel \
12         Control/Monad \
13         Control/Monad/ST \
14         Data \
15         Data/Generics \
16         Data/Array \
17         Data/Array/IO \
18         Data/STRef \
19         Debug \
20         Foreign \
21         Foreign/C \
22         Foreign/Marshal \
23         GHC \
24         System \
25         System/Console \
26         System/Mem \
27         System/IO \
28         System/Posix \
29         System/Process \
30         Text \
31         Text/Html \
32         Text/PrettyPrint \
33         Text/ParserCombinators \
34         Text/Regex \
35         Text/Show \
36         Text/Read
37
38 PACKAGE = base
39 VERSION = 1.0
40
41 SRC_HC_OPTS += -fglasgow-exts -cpp -Iinclude -"\#include" HsBase.h
42 SRC_HSC2HS_OPTS += -Iinclude -I$(FPTOOLS_TOP)/ghc/includes
43
44 # If there is no system-supplied POSIX regex library, use our own
45 ifneq "$(HavePosixRegex)" "YES"
46 # Make sure we can get hold of regex.h
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 # These two lines are required for pre-processing ghc/compiler/prelude/primops.txt
61 SRC_CPP_OPTS += -I$(GHC_INCLUDE_DIR)
62 SRC_CPP_OPTS += ${GhcCppOpts}
63
64 ifeq "$(BootingFromHc)" "YES"
65 GHC/PrimopWrappers.hs:
66         touch GHC/PrimopWrappers.hs
67 else
68 GHC/PrimopWrappers.hs: $(GHC_COMPILER_DIR)/prelude/primops.txt
69         @$(RM) $@
70         $(GHC_GENPRIMOP) --make-haskell-wrappers < $< > $@
71 endif
72
73 boot :: GHC/PrimopWrappers.hs
74
75 EXTRA_SRCS  += GHC/PrimopWrappers.hs
76 CLEAN_FILES += GHC/PrimopWrappers.hs
77
78 # -----------------------------------------------------------------------------
79 ifneq "$(BootingFromHc)" "YES"
80 STUBOBJS += \
81    Control/Concurrent_stub.$(way_)o
82    
83 CLEAN_FILES += $(STUBOBJS) \
84    Control/Concurrent_stub.[ch]
85 endif
86
87 #-----------------------------------------------------------------------------
88 #       Building the library for GHCi
89 #
90 # The procedure differs from that in fptools/mk/target.mk in one way:
91 #  (*) on Win32 we must split it into two, because a single .o file can't
92 #      have more than 65536 relocations in it [due to a bug in the GNU
93 #      linker.]
94
95 OBJECT_FILEFORMAT=unknown
96 ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
97 OBJECT_FILEFORMAT=PEi
98 endif
99 ifeq "$(TARGETPLATFORM)" "i386-unknown-cygwin32"
100 OBJECT_FILEFORMAT=PEi
101 endif
102
103 ifeq "$(OBJECT_FILEFORMAT)" "PEi"
104
105 # Turn off standard rule which creates HSbase.o from LIBOBJS.
106 DONT_WANT_STD_GHCI_LIB_RULE=YES
107
108 GHCI_LIBOBJS = $(HS_OBJS)
109
110 INSTALL_LIBS += HSbase1.o HSbase2.o HSbase3.o
111
112 endif # OBJECT_FILEFORMAT = PEi
113
114
115 # -----------------------------------------------------------------------------
116 # Doc building with Haddock
117
118 EXCLUDED_HADDOCK_SRCS = \
119         GHC/PrimopWrappers.hs \
120         GHC/PArr.hs
121
122 SRC_HADDOCK_OPTS += -t "Haskell Hierarchical Libraries ($(PACKAGE) package)" \
123         --no-implicit-prelude
124
125 # -----------------------------------------------------------------------------
126
127 GHC/ForeignPtr.o Data/Array/IO/Internals.o Data/Array/Base.o \
128   Data/Generics/Instances.o Data/Complex.o Data/Array.o Data/STRef.o \
129   Data/Dynamic.o Data/Typeable.o Data/PackedString.o System/Mem/Weak.o \
130   System/Mem/StableName.o System/Posix/Types.o Control/Monad/ST.o \
131   Control/Exception.o Foreign/C/Types.o Foreign/ForeignPtr.o: include/Typeable.h
132
133 System/Posix/Types.o Foreign/C/Types.o: include/CTypes.h
134
135 # -----------------------------------------------------------------------------
136
137 include $(TOP)/mk/target.mk
138
139 ifeq "$(OBJECT_FILEFORMAT)" "PEi"
140 HSbase.o : $(GHCI_LIBOBJS)
141         $(LD) -r $(LD_X) -o HSbase1.o $(filter     GHC/%, $(GHCI_LIBOBJS))
142         $(LD) -r $(LD_X) -o HSbase2.o $(filter     Text/%, $(GHCI_LIBOBJS))
143         $(LD) -r $(LD_X) -o HSbase3.o $(filter-out GHC/% Text/%, $(GHCI_LIBOBJS) $(STUBOBJS))
144         @touch HSbase.o
145 endif # OBJECT_FILEFORMAT = PEi
146