[project @ 2002-05-31 12:22:33 by panne]
[haskell-directory.git] / Makefile
1 # -----------------------------------------------------------------------------
2 # $Id: Makefile,v 1.29 2002/05/31 12:22:33 panne Exp $
3
4 TOP=..
5 include $(TOP)/mk/boilerplate.mk
6
7 # -----------------------------------------------------------------------------
8
9 SUBDIRS = cbits include
10
11 ALL_DIRS = \
12         Control \
13         Control/Concurrent \
14         Control/Monad \
15         Control/Monad/ST \
16         Data \
17         Data/Array \
18         Database \
19         Debug \
20         Debug/QuickCheck \
21         FileFormat \
22         Foreign \
23         Foreign/C \
24         Foreign/Marshal \
25         GHC \
26         Hugs \
27         Language \
28         Network \
29         NHC \
30         System \
31         System/Console \
32         System/Mem \
33         System/IO \
34         Text \
35         Text/Html \
36         Text/PrettyPrint \
37         Text/ParserCombinators \
38         Text/ParserCombinators/Parsec \
39         Text/Regex \
40         Text/Show \
41         Text/Read
42
43 PACKAGE = base
44
45 SRC_HC_OPTS += -fglasgow-exts -cpp -Iinclude
46 SRC_HSC2HS_OPTS += -Iinclude
47
48 # Make sure we can get hold of regex.h
49 ifneq "$(HavePosixRegex)" "YES"
50 SRC_HC_OPTS     += -Icbits/regex
51 SRC_HSC2HS_OPTS += -Icbits/regex
52 endif
53
54 # -----------------------------------------------------------------------------
55 # Per-module flags
56
57 # ESSENTIAL, for getting reasonable performance from the I/O library:
58 SRC_HC_OPTS += -funbox-strict-fields
59
60 # -----------------------------------------------------------------------------
61 # PrimOpWrappers
62
63 GHC/PrimopWrappers.hs: $(GHC_COMPILER_DIR)/prelude/primops.txt
64         rm -f $@
65         $(GHC_GENPRIMOP) --make-haskell-wrappers < $< > $@
66
67 boot :: GHC/PrimopWrappers.hs
68
69 EXTRA_SRCS  += GHC/PrimopWrappers.hs
70 CLEAN_FILES += GHC/PrimopWrappers.hs
71
72 #-----------------------------------------------------------------------------
73 #       Building the library for GHCi
74 #
75 # The procedure differs from that in fptools/mk/target.mk in one way:
76 #  (*) on Win32 we must split it into two, because a single .o file can't
77 #      have more than 65536 relocations in it.
78
79 ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
80
81 # Turn off standard rule which creates HSbase.o from LIBOBJS.
82 DONT_WANT_STD_GHCI_LIB_RULE=YES
83
84 GHCI_LIBOBJS = $(HS_OBJS)
85
86 INSTALL_LIBS += HSbase1.o HSbase2.o
87
88 endif # TARGETPLATFORM = i386-unknown-mingw32
89
90
91 # -----------------------------------------------------------------------------
92 # Doc building with Haddock
93
94 EXCLUDED_HADDOCK_SRCS = \
95         Data/Generics.hs \
96         GHC/PArr.hs
97
98 HS_PPS = $(addsuffix .raw-hs, $(basename $(filter-out $(EXCLUDED_HADDOCK_SRCS), $(HS_SRCS))))
99
100 HADDOCK = $(FPTOOLS_TOP)/haddock/src/haddock-inplace
101
102 # Urgh, hack needed to ensure that the value of HS_SRCS is computed in time for
103 # the docs rule below.
104 PRE_SRCS := $(ALL_SRCS)
105
106 .PHONY: docs
107 haddock-docs : $(HS_PPS)
108         $(HADDOCK) -t "Haskell Core Libraries" -h -s "." $(HS_PPS)
109
110 %.raw-hs : %.lhs
111         $(GHC_INPLACE) $(HC_OPTS) -D__HADDOCK__ -E -cpp $< -o $<.tmp && sed -e 's/^#.*//' <$<.tmp >$@
112
113 %.raw-hs : %.hs
114         $(GHC_INPLACE) $(HC_OPTS) -D__HADDOCK__ -E -cpp $< -o $<.tmp && sed -e 's/^#.*//' <$<.tmp >$@
115
116 # -----------------------------------------------------------------------------
117
118 include $(TOP)/mk/target.mk
119
120 ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
121 HSbase.o : $(GHCI_LIBOBJS)
122         $(LD) -r $(LD_X) -o HSbase1.o $(filter     GHC/%, $(GHCI_LIBOBJS))
123         $(LD) -r $(LD_X) -o HSbase2.o $(filter-out GHC/%, $(GHCI_LIBOBJS))
124         @touch HSbase.o
125 endif # TARGETPLATFORM = i386-unknown-mingw32
126