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