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