[project @ 2005-01-28 23:33:57 by krasimir]
[ghc-base.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         System/Directory \
31         Text \
32         Text/Html \
33         Text/PrettyPrint \
34         Text/ParserCombinators \
35         Text/Regex \
36         Text/Show \
37         Text/Read
38
39 PACKAGE = base
40 VERSION = 1.0
41
42 SRC_HC_OPTS += -fglasgow-exts -cpp -Iinclude -"\#include" HsBase.h
43 SRC_HSC2HS_OPTS += -Iinclude -I$(FPTOOLS_TOP)/ghc/includes
44
45 # If there is no system-supplied POSIX regex library, use our own
46 ifneq "$(HavePosixRegex)" "YES"
47 # Make sure we can get hold of regex.h
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 ifneq "$(BootingFromHc)" "YES"
81 STUBOBJS += \
82    Control/Concurrent_stub.$(way_)o
83    
84 CLEAN_FILES += $(STUBOBJS) \
85    Control/Concurrent_stub.[ch]
86 endif
87
88 #-----------------------------------------------------------------------------
89 #       Building the library for GHCi
90 #
91 # The procedure differs from that in fptools/mk/target.mk in one way:
92 #  (*) on Win32 we must split it into two, because a single .o file can't
93 #      have more than 65536 relocations in it [due to a bug in the GNU
94 #      linker.]
95
96 OBJECT_FILEFORMAT=unknown
97 ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
98 OBJECT_FILEFORMAT=PEi
99 endif
100 ifeq "$(TARGETPLATFORM)" "i386-unknown-cygwin32"
101 OBJECT_FILEFORMAT=PEi
102 endif
103
104 ifeq "$(OBJECT_FILEFORMAT)" "PEi"
105
106 # Turn off standard rule which creates HSbase.o from LIBOBJS.
107 DONT_WANT_STD_GHCI_LIB_RULE=YES
108
109 GHCI_LIBOBJS = $(HS_OBJS)
110
111 INSTALL_LIBS += HSbase1.o HSbase2.o HSbase3.o
112
113 endif # OBJECT_FILEFORMAT = PEi
114
115
116 # -----------------------------------------------------------------------------
117 # Doc building with Haddock
118
119 EXCLUDED_HADDOCK_SRCS = \
120         GHC/PrimopWrappers.hs \
121         GHC/PArr.hs
122
123 SRC_HADDOCK_OPTS += -t "Haskell Hierarchical Libraries ($(PACKAGE) package)" \
124         --no-implicit-prelude
125
126 # -----------------------------------------------------------------------------
127
128 GHC/ForeignPtr.o Data/Array/IO/Internals.o Data/Array/Base.o \
129   Data/Generics/Instances.o Data/Complex.o Data/Array.o Data/STRef.o \
130   Data/Dynamic.o Data/Typeable.o Data/PackedString.o System/Mem/Weak.o \
131   System/Mem/StableName.o System/Posix/Types.o Control/Monad/ST.o \
132   Control/Exception.o Foreign/C/Types.o Foreign/ForeignPtr.o: include/Typeable.h
133
134 System/Posix/Types.o Foreign/C/Types.o: include/CTypes.h
135
136 # -----------------------------------------------------------------------------
137
138 include $(TOP)/mk/target.mk
139
140 ifeq "$(OBJECT_FILEFORMAT)" "PEi"
141 HSbase.o : $(GHCI_LIBOBJS)
142         $(LD) -r $(LD_X) -o HSbase1.o $(filter     GHC/%, $(GHCI_LIBOBJS))
143         $(LD) -r $(LD_X) -o HSbase2.o $(filter     Text/%, $(GHCI_LIBOBJS))
144         $(LD) -r $(LD_X) -o HSbase3.o $(filter-out GHC/% Text/%, $(GHCI_LIBOBJS) $(STUBOBJS))
145         @touch HSbase.o
146 endif # OBJECT_FILEFORMAT = PEi
147