# -----------------------------------------------------------------------------
-# $Id: Makefile,v 1.1 2001/06/28 14:15:01 simonmar Exp $
+# $Id: Makefile,v 1.12 2002/02/11 17:10:56 simonmar Exp $
-TOP=../..
+TOP=..
include $(TOP)/mk/boilerplate.mk
-ifeq "$(way)" ""
-SUBDIRS = cbits
-else
-SUBDIRS=
-endif
+# -----------------------------------------------------------------------------
+
+SUBDIRS = cbits include
ALL_DIRS = \
Control \
Data/Array \
Database \
Debug \
+ Debug/QuickCheck \
FileFormat \
Foreign \
Foreign/C \
Network \
NHC \
System \
+ System/Console \
+ System/Mem \
System/IO \
Text \
+ Text/Html \
+ Text/PrettyPrint \
+ Text/Regex \
Text/Show
-PRE_SRCS += $(wildcard $(patsubst %, %/*.hsc, $(ALL_DIRS)))
-SRC_HSC2HS_OPTS += -Iinclude -I.
+PKG = base
-ALL_HS_SRCS = $(wildcard $(patsubst %, %/*.hs, . $(ALL_DIRS)))
-ALL_LHS_SRCS += $(wildcard GHC/*.lhs)
-ALL_HS_OBJS = $(patsubst %.hs, %.o, $(ALL_HS_SRCS)) \
- $(patsubst %.lhs, %.o, $(ALL_LHS_SRCS))
+SRC_HC_OPTS += -fglasgow-exts -cpp -Iinclude
+SRC_HSC2HS_OPTS += -Iinclude
+# ESSENTIAL, for getting reasonable performance from the I/O library:
+GHC/IOBase_HC_OPTS = -funbox-strict-fields
-srcs : $(HS_SRCS) GHC/Prim.$(way_)hi
+# -----------------------------------------------------------------------------
+# PrimOpWrappers
-# dependencies between .hsc files
-GHC/IO.hs : GHC/Handle.hs
+GHC/PrimopWrappers.hs: $(GHC_COMPILER_DIR)/prelude/primops.txt
+ rm -f $@
+ $(GHC_GENPRIMOP) --make-haskell-wrappers < $< > $@
-GHC/Prim.$(way_)hi : GHC/Prim.hi-boot
- cp $< $@
+boot :: GHC/PrimopWrappers.hs
+
+CLEAN_FILES += GHC/PrimopWrappers.hs
-SRC_HC_OPTS += -cpp -fglasgow-exts -fvia-C -I$(FPTOOLS_TOP)/ghc/includes -Iinclude -package-name std -H128m $(GhcLibHcOpts)
+# -----------------------------------------------------------------------------
+# GHC/Prim.hi-boot
-LIBNAME = libHScore$(_way).a
+GHC/Prim.$(way_)hi : GHC/Prim.hi-boot
+ cp $< $@
-CLEAN_FILES += $(ALL_HS_OBJS)
+ALL_PRIMS = GHC/Prim.hi $(foreach way, $(WAYS), GHC/Prim.$(way)_hi)
-all :: $(LIBNAME)
+lib : $(ALL_PRIMS)
-lib : srcs
- $(GHC_INPLACE) $(HC_OPTS) --make $(ALL_HS_SRCS) $(ALL_LHS_SRCS)
+boot :: $(ALL_PRIMS)
-$(LIBNAME) : lib
- $(RM) $@
- $(AR) $(AR_OPTS) $@ $(ALL_HS_OBJS)
- $(RANLIB) $@
+CLEAN_FILES += $(ALL_PRIMS)
-%.o : %.hs
- $(GHC_INPLACE) $(HC_OPTS) --make $<
-%.o : %.lhs
- $(GHC_INPLACE) $(HC_OPTS) --make $<
+SRC_CPP_OPTS += -I$(GHC_INCLUDE_DIR) -traditional
+
+# -----------------------------------------------------------------------------
include $(TOP)/mk/target.mk
+