1 # -----------------------------------------------------------------------------
2 # $Id: Makefile,v 1.31 2002/06/08 13:11:27 panne Exp $
5 include $(TOP)/mk/boilerplate.mk
7 # -----------------------------------------------------------------------------
9 SUBDIRS = cbits include
37 Text/ParserCombinators \
38 Text/ParserCombinators/Parsec \
45 SRC_HC_OPTS += -fglasgow-exts -cpp -Iinclude
46 SRC_HSC2HS_OPTS += -Iinclude
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
54 # -----------------------------------------------------------------------------
57 # ESSENTIAL, for getting reasonable performance from the I/O library:
58 SRC_HC_OPTS += -funbox-strict-fields
60 # -----------------------------------------------------------------------------
63 GHC/PrimopWrappers.hs: $(GHC_COMPILER_DIR)/prelude/primops.txt
65 $(GHC_GENPRIMOP) --make-haskell-wrappers < $< > $@
67 boot :: GHC/PrimopWrappers.hs
69 EXTRA_SRCS += GHC/PrimopWrappers.hs
70 CLEAN_FILES += GHC/PrimopWrappers.hs
72 #-----------------------------------------------------------------------------
73 # Building the library for GHCi
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 [due to a bug in the GNU
80 OBJECT_FILEFORMAT=unknown
81 ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
84 ifeq "$(TARGETPLATFORM)" "i386-unknown-cygwin32"
88 ifeq "$(OBJECT_FILEFORMAT)" "PEi"
90 # Turn off standard rule which creates HSbase.o from LIBOBJS.
91 DONT_WANT_STD_GHCI_LIB_RULE=YES
93 GHCI_LIBOBJS = $(HS_OBJS)
95 INSTALL_LIBS += HSbase1.o HSbase2.o HSbase3.o
97 endif # OBJECT_FILEFORMAT = PEi
100 # -----------------------------------------------------------------------------
101 # Doc building with Haddock
103 EXCLUDED_HADDOCK_SRCS = \
107 HS_PPS = $(addsuffix .raw-hs, $(basename $(filter-out $(EXCLUDED_HADDOCK_SRCS), $(HS_SRCS))))
109 HADDOCK = $(FPTOOLS_TOP)/haddock/src/haddock-inplace
111 # Urgh, hack needed to ensure that the value of HS_SRCS is computed in time for
112 # the docs rule below.
113 PRE_SRCS := $(ALL_SRCS)
116 haddock-docs : $(HS_PPS)
117 $(HADDOCK) -t "Haskell Core Libraries" -h -s "." $(HS_PPS)
120 $(GHC_INPLACE) $(HC_OPTS) -D__HADDOCK__ -E -cpp $< -o $<.tmp && sed -e 's/^#.*//' <$<.tmp >$@
123 $(GHC_INPLACE) $(HC_OPTS) -D__HADDOCK__ -E -cpp $< -o $<.tmp && sed -e 's/^#.*//' <$<.tmp >$@
125 # -----------------------------------------------------------------------------
127 include $(TOP)/mk/target.mk
129 ifeq "$(OBJECT_FILEFORMAT)" "PEi"
130 HSbase.o : $(GHCI_LIBOBJS)
131 $(LD) -r $(LD_X) -o HSbase1.o $(filter GHC/%, $(GHCI_LIBOBJS))
132 $(LD) -r $(LD_X) -o HSbase2.o $(filter Text/%, $(GHCI_LIBOBJS))
133 $(LD) -r $(LD_X) -o HSbase3.o $(filter-out GHC/% Text/%, $(GHCI_LIBOBJS))
135 endif # OBJECT_FILEFORMAT = PEi