1 # -----------------------------------------------------------------------------
2 # $Id: Makefile,v 1.32 2002/06/13 23:26:55 sof Exp $
5 include $(TOP)/mk/boilerplate.mk
7 # -----------------------------------------------------------------------------
9 SUBDIRS = cbits include
38 Text/ParserCombinators \
39 Text/ParserCombinators/Parsec \
46 SRC_HC_OPTS += -fglasgow-exts -cpp -Iinclude
47 SRC_HSC2HS_OPTS += -Iinclude
49 # Make sure we can get hold of regex.h
50 ifneq "$(HavePosixRegex)" "YES"
51 SRC_HC_OPTS += -Icbits/regex
52 SRC_HSC2HS_OPTS += -Icbits/regex
55 # -----------------------------------------------------------------------------
58 # ESSENTIAL, for getting reasonable performance from the I/O library:
59 SRC_HC_OPTS += -funbox-strict-fields
61 # -----------------------------------------------------------------------------
64 GHC/PrimopWrappers.hs: $(GHC_COMPILER_DIR)/prelude/primops.txt
66 $(GHC_GENPRIMOP) --make-haskell-wrappers < $< > $@
68 boot :: GHC/PrimopWrappers.hs
70 EXTRA_SRCS += GHC/PrimopWrappers.hs
71 CLEAN_FILES += GHC/PrimopWrappers.hs
73 #-----------------------------------------------------------------------------
74 # Building the library for GHCi
76 # The procedure differs from that in fptools/mk/target.mk in one way:
77 # (*) on Win32 we must split it into two, because a single .o file can't
78 # have more than 65536 relocations in it [due to a bug in the GNU
81 OBJECT_FILEFORMAT=unknown
82 ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
85 ifeq "$(TARGETPLATFORM)" "i386-unknown-cygwin32"
89 ifeq "$(OBJECT_FILEFORMAT)" "PEi"
91 # Turn off standard rule which creates HSbase.o from LIBOBJS.
92 DONT_WANT_STD_GHCI_LIB_RULE=YES
94 GHCI_LIBOBJS = $(HS_OBJS)
96 INSTALL_LIBS += HSbase1.o HSbase2.o HSbase3.o
98 endif # OBJECT_FILEFORMAT = PEi
101 # -----------------------------------------------------------------------------
102 # Doc building with Haddock
104 EXCLUDED_HADDOCK_SRCS = \
108 HS_PPS = $(addsuffix .raw-hs, $(basename $(filter-out $(EXCLUDED_HADDOCK_SRCS), $(HS_SRCS))))
110 HADDOCK = $(FPTOOLS_TOP)/haddock/src/haddock-inplace
112 # Urgh, hack needed to ensure that the value of HS_SRCS is computed in time for
113 # the docs rule below.
114 PRE_SRCS := $(ALL_SRCS)
117 haddock-docs : $(HS_PPS)
118 $(HADDOCK) -t "Haskell Core Libraries" -h -s "." $(HS_PPS)
121 $(GHC_INPLACE) $(HC_OPTS) -D__HADDOCK__ -E -cpp $< -o $<.tmp && sed -e 's/^#.*//' <$<.tmp >$@
124 $(GHC_INPLACE) $(HC_OPTS) -D__HADDOCK__ -E -cpp $< -o $<.tmp && sed -e 's/^#.*//' <$<.tmp >$@
126 # -----------------------------------------------------------------------------
128 include $(TOP)/mk/target.mk
130 ifeq "$(OBJECT_FILEFORMAT)" "PEi"
131 HSbase.o : $(GHCI_LIBOBJS)
132 $(LD) -r $(LD_X) -o HSbase1.o $(filter GHC/%, $(GHCI_LIBOBJS))
133 $(LD) -r $(LD_X) -o HSbase2.o $(filter Text/%, $(GHCI_LIBOBJS))
134 $(LD) -r $(LD_X) -o HSbase3.o $(filter-out GHC/% Text/%, $(GHCI_LIBOBJS))
136 endif # OBJECT_FILEFORMAT = PEi