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