[project @ 2004-09-29 15:50:51 by simonmar]
[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
40 SRC_HC_OPTS += -fglasgow-exts -cpp -Iinclude -"\#include" HsBase.h
41 SRC_HSC2HS_OPTS += -Iinclude -I$(FPTOOLS_TOP)/ghc/includes
42
43 # If there is no system-supplied POSIX regex library, use our own
44 ifneq "$(HavePosixRegex)" "YES"
45 # Make sure we can get hold of regex.h
46 SRC_HC_OPTS     += -Icbits/regex
47 SRC_HSC2HS_OPTS += -Icbits/regex
48 endif
49
50 # -----------------------------------------------------------------------------
51 # Per-module flags
52
53 # ESSENTIAL, for getting reasonable performance from the I/O library:
54 SRC_HC_OPTS += -funbox-strict-fields
55
56 # -----------------------------------------------------------------------------
57 # PrimOpWrappers
58
59 # These two lines are required for pre-processing ghc/compiler/prelude/primops.txt
60 SRC_CPP_OPTS += -I$(GHC_INCLUDE_DIR)
61 SRC_CPP_OPTS += ${GhcCppOpts}
62
63 ifeq "$(BootingFromHc)" "YES"
64 GHC/PrimopWrappers.hs:
65         touch GHC/PrimopWrappers.hs
66 else
67 GHC/PrimopWrappers.hs: $(GHC_COMPILER_DIR)/prelude/primops.txt
68         @$(RM) $@
69         $(GHC_GENPRIMOP) --make-haskell-wrappers < $< > $@
70 endif
71
72 boot :: GHC/PrimopWrappers.hs
73
74 EXTRA_SRCS  += GHC/PrimopWrappers.hs
75 CLEAN_FILES += GHC/PrimopWrappers.hs
76
77 # -----------------------------------------------------------------------------
78 ifneq "$(BootingFromHc)" "YES"
79 STUBOBJS += \
80    Control/Concurrent_stub.$(way_)o
81    
82 CLEAN_FILES += $(STUBOBJS) \
83    Control/Concurrent_stub.[ch]
84 endif
85
86 #-----------------------------------------------------------------------------
87 #       Building the library for GHCi
88 #
89 # The procedure differs from that in fptools/mk/target.mk in one way:
90 #  (*) on Win32 we must split it into two, because a single .o file can't
91 #      have more than 65536 relocations in it [due to a bug in the GNU
92 #      linker.]
93
94 OBJECT_FILEFORMAT=unknown
95 ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
96 OBJECT_FILEFORMAT=PEi
97 endif
98 ifeq "$(TARGETPLATFORM)" "i386-unknown-cygwin32"
99 OBJECT_FILEFORMAT=PEi
100 endif
101
102 ifeq "$(OBJECT_FILEFORMAT)" "PEi"
103
104 # Turn off standard rule which creates HSbase.o from LIBOBJS.
105 DONT_WANT_STD_GHCI_LIB_RULE=YES
106
107 GHCI_LIBOBJS = $(HS_OBJS)
108
109 INSTALL_LIBS += HSbase1.o HSbase2.o HSbase3.o
110
111 endif # OBJECT_FILEFORMAT = PEi
112
113
114 # -----------------------------------------------------------------------------
115 # Doc building with Haddock
116
117 EXCLUDED_HADDOCK_SRCS = \
118         GHC/PrimopWrappers.hs \
119         GHC/PArr.hs
120
121 SRC_HADDOCK_OPTS += -t "Haskell Hierarchical Libraries ($(PACKAGE) package)" \
122         --no-implicit-prelude
123
124 # -----------------------------------------------------------------------------
125
126 GHC/ForeignPtr.o Data/Array/IO/Internals.o Data/Array/Base.o \
127   Data/Generics/Instances.o Data/Complex.o Data/Array.o Data/STRef.o \
128   Data/Dynamic.o Data/Typeable.o Data/PackedString.o System/Mem/Weak.o \
129   System/Mem/StableName.o System/Posix/Types.o Control/Monad/ST.o \
130   Control/Exception.o Foreign/C/Types.o Foreign/ForeignPtr.o: include/Typeable.h
131
132 System/Posix/Types.o Foreign/C/Types.o: include/CTypes.h
133
134 # -----------------------------------------------------------------------------
135
136 include $(TOP)/mk/target.mk
137
138 ifeq "$(OBJECT_FILEFORMAT)" "PEi"
139 HSbase.o : $(GHCI_LIBOBJS)
140         $(LD) -r $(LD_X) -o HSbase1.o $(filter     GHC/%, $(GHCI_LIBOBJS))
141         $(LD) -r $(LD_X) -o HSbase2.o $(filter     Text/%, $(GHCI_LIBOBJS))
142         $(LD) -r $(LD_X) -o HSbase3.o $(filter-out GHC/% Text/%, $(GHCI_LIBOBJS) $(STUBOBJS))
143         @touch HSbase.o
144 endif # OBJECT_FILEFORMAT = PEi
145