[project @ 2003-09-21 22:20:57 by wolfgang]
[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/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 # Make sure we can get hold of regex.h
42 ifneq "$(HavePosixRegex)" "YES"
43 SRC_HC_OPTS     += -Icbits/regex
44 SRC_HSC2HS_OPTS += -Icbits/regex
45 endif
46
47 # -----------------------------------------------------------------------------
48 # Per-module flags
49
50 # ESSENTIAL, for getting reasonable performance from the I/O library:
51 SRC_HC_OPTS += -funbox-strict-fields
52
53 # -----------------------------------------------------------------------------
54 # PrimOpWrappers
55
56 # These two lines are required for pre-processing ghc/compiler/prelude/primops.txt
57 SRC_CPP_OPTS += -I$(GHC_INCLUDE_DIR)
58 SRC_CPP_OPTS += ${GhcCppOpts}
59
60 ifeq "$(BootingFromHc)" "YES"
61 GHC/PrimopWrappers.hs:
62         touch GHC/PrimopWrappers.hs
63 else
64 GHC/PrimopWrappers.hs: $(GHC_COMPILER_DIR)/prelude/primops.txt
65         @$(RM) $@
66         $(GHC_GENPRIMOP) --make-haskell-wrappers < $< > $@
67 endif
68
69 boot :: GHC/PrimopWrappers.hs
70
71 EXTRA_SRCS  += GHC/PrimopWrappers.hs
72 CLEAN_FILES += GHC/PrimopWrappers.hs
73
74 # -----------------------------------------------------------------------------
75
76 STUBOBJS += \
77    Control/Concurrent_stub.$(way_)o
78    
79 CLEAN_FILES += $(STUBOBJS) \
80    Control/Concurrent_stub.[ch]
81
82 #-----------------------------------------------------------------------------
83 #       Building the library for GHCi
84 #
85 # The procedure differs from that in fptools/mk/target.mk in one way:
86 #  (*) on Win32 we must split it into two, because a single .o file can't
87 #      have more than 65536 relocations in it [due to a bug in the GNU
88 #      linker.]
89
90 OBJECT_FILEFORMAT=unknown
91 ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
92 OBJECT_FILEFORMAT=PEi
93 endif
94 ifeq "$(TARGETPLATFORM)" "i386-unknown-cygwin32"
95 OBJECT_FILEFORMAT=PEi
96 endif
97
98 ifeq "$(OBJECT_FILEFORMAT)" "PEi"
99
100 # Turn off standard rule which creates HSbase.o from LIBOBJS.
101 DONT_WANT_STD_GHCI_LIB_RULE=YES
102
103 GHCI_LIBOBJS = $(HS_OBJS)
104
105 INSTALL_LIBS += HSbase1.o HSbase2.o HSbase3.o
106
107 endif # OBJECT_FILEFORMAT = PEi
108
109
110 # -----------------------------------------------------------------------------
111 # Doc building with Haddock
112
113 EXCLUDED_HADDOCK_SRCS = \
114         GHC/PrimopWrappers.hs \
115         GHC/PArr.hs
116
117 SRC_HADDOCK_OPTS += -t "Haskell Core Libraries (base package)" \
118         --no-implicit-prelude -p prologue.txt
119
120 # -----------------------------------------------------------------------------
121
122 include $(TOP)/mk/target.mk
123
124 ifeq "$(OBJECT_FILEFORMAT)" "PEi"
125 HSbase.o : $(GHCI_LIBOBJS)
126         $(LD) -r $(LD_X) -o HSbase1.o $(filter     GHC/%, $(GHCI_LIBOBJS))
127         $(LD) -r $(LD_X) -o HSbase2.o $(filter     Text/%, $(GHCI_LIBOBJS))
128         $(LD) -r $(LD_X) -o HSbase3.o $(filter-out GHC/% Text/%, $(GHCI_LIBOBJS))
129         @touch HSbase.o
130 endif # OBJECT_FILEFORMAT = PEi
131