[project @ 2002-04-24 16:13:26 by simonmar]
[ghc-base.git] / Makefile
1 # -----------------------------------------------------------------------------
2 # $Id: Makefile,v 1.24 2002/04/24 16:13:26 simonmar 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/Regex \
39         Text/Show \
40         Text/Read
41
42 PACKAGE = base
43
44 SRC_HC_OPTS += -fglasgow-exts -cpp -Iinclude
45 SRC_HSC2HS_OPTS += -Iinclude
46
47 # Make sure we can get hold of regex.h
48 ifneq "$(HavePosixRegex)" "YES"
49 SRC_HC_OPTS     += -Icbits/regex
50 SRC_HSC2HS_OPTS += -Icbits/regex
51 endif
52
53 # -----------------------------------------------------------------------------
54 # Per-module flags
55
56 # ESSENTIAL, for getting reasonable performance from the I/O library:
57 SRC_HC_OPTS += -funbox-strict-fields
58
59 # -----------------------------------------------------------------------------
60 # PrimOpWrappers
61
62 GHC/PrimopWrappers.hs: $(GHC_COMPILER_DIR)/prelude/primops.txt
63         rm -f $@
64         $(GHC_GENPRIMOP) --make-haskell-wrappers < $< > $@
65
66 boot :: GHC/PrimopWrappers.hs
67
68 CLEAN_FILES += GHC/PrimopWrappers.hs
69
70 #-----------------------------------------------------------------------------
71 #       Building the library for GHCi
72 #
73 # The procedure differs from that in fptools/mk/target.mk in one way:
74 #  (*) on Win32 we must split it into two, because a single .o file can't
75 #      have more than 65536 relocations in it.
76
77 ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
78
79 # Turn off standard rule which creates HSbase.o from LIBOBJS.
80 DONT_WANT_STD_GHCI_LIB_RULE=YES
81
82 GHCI_LIBOBJS = $(HS_OBJS)
83
84 INSTALL_LIBS += HSbase1.o HSbase2.o
85
86 endif # TARGETPLATFORM = i386-unknown-mingw32
87
88
89 # -----------------------------------------------------------------------------
90 # Doc building with Haddock
91
92 EXCLUDED_HADDOCK_SRCS = \
93         GHC/Err.lhs \
94         Data/Generics.hs \
95         GHC/PArr.hs \
96         Control/Monad/Error.hs \
97         Control/Monad/Reader.hs \
98         Control/Monad/State.hs \
99         Control/Monad/Writer.hs
100
101 HS_PPS = $(addsuffix .raw-hs, $(basename $(filter-out $(EXCLUDED_HADDOCK_SRCS), $(HS_SRCS))))
102
103 HADDOCK = $(FPTOOLS_TOP)/haddock/src/haddock-inplace
104
105 # Urgh, hack needed to ensure that the value of HS_SRCS is computed in time for
106 # the docs rule below.
107 PRE_SRCS := $(ALL_SRCS)
108
109 .PHONY: docs
110 haddock-docs : $(HS_PPS)
111         $(HADDOCK) -t "Haskell Core Libraries" -h -s "." $(HS_PPS)
112
113 %.raw-hs : %.lhs
114         $(GHC_INPLACE) $(HC_OPTS) -D__HADDOCK__ -E -cpp $< -o $<.tmp && sed -e 's/^#.*//' <$<.tmp >$@
115
116 %.raw-hs : %.hs
117         $(GHC_INPLACE) $(HC_OPTS) -E -cpp $< -o $<.tmp && sed -e 's/^#.*//' <$<.tmp >$@
118
119 # -----------------------------------------------------------------------------
120
121 include $(TOP)/mk/target.mk
122
123 ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
124 HSbase.o : $(GHCI_LIBOBJS)
125         $(LD) -r $(LD_X) -o HSbase1.o $(filter     GHC/%, $(GHCI_LIBOBJS))
126         $(LD) -r $(LD_X) -o HSbase2.o $(filter-out GHC/%, $(GHCI_LIBOBJS))
127         @touch HSbase.o
128 endif # TARGETPLATFORM = i386-unknown-mingw32
129