1 #################################################################################
5 # Makefile for building the GHC Prelude libraries umpteen ways
8 #################################################################################
11 include $(TOP)/mk/boilerplate.mk
21 #-----------------------------------------------------------------------------
22 # Setting the standard variables
28 ifneq "$(DLLized)" "YES"
29 PACKAGE = -package-name std
31 # Hack by SPJ to delay if-then-else until the pattern rule when we have $*
32 PACKAGE = $(subst ~, ,$(word $(words dummy $(findstring $(notdir $*), PrelMain )), -package-name~std))
37 # we don't want PrelMain in the GHCi library.
38 GHCI_LIBOBJS = $(filter-out PrelMain.$(way_)o,$(HS_OBJS))
40 BOOT_SRCS += PrelPrimopWrappers.hs
42 HSC_SRCS = $(wildcard *.hsc)
43 HSC_HS = $(patsubst %.hsc,%.hs, $(HSC_SRCS))
44 HS_SRCS := $(HSC_HS) $(filter-out $(HSC_HS),$(HS_SRCS))
46 #-----------------------------------------------------------------------------
47 # Setting the GHC compile options
49 SRC_HC_OPTS += -cpp -fvia-C -fglasgow-exts $(GhcLibHcOpts) $(PACKAGE)
51 ifdef USE_REPORT_PRELUDE
52 SRC_HC_OPTS += -DUSE_REPORT_PRELUDE=1
56 PrelStorable_HC_OPTS = -monly-3-regs
57 PrelCError_HC_OPTS = +RTS -K4m -RTS
59 #-----------------------------------------------------------------------------
60 # Dependency generation
62 SRC_MKDEPENDHS_OPTS += -I$(GHC_INCLUDE_DIR)
64 #-----------------------------------------------------------------------------
67 PrelPrimopWrappers.hs: ../../compiler/prelude/primops.txt
68 rm -f PrelPrimopWrappers.hs
69 ../../utils/genprimopcode/genprimopcode --make-haskell-wrappers \
70 < ../../compiler/prelude/primops.txt > PrelPrimopWrappers.hs
72 PrelGHC.$(way_)hi : PrelGHC.hi-boot
75 boot :: PrelPrimopWrappers.hs PrelGHC.hi $(foreach way, $(WAYS), PrelGHC.$(way)_hi)
76 all :: PrelPrimopWrappers.hs
78 DLL_DESCRIPTION="GHC-compiled Haskell Prelude"
80 ifeq "$(DLLized)" "YES"
81 HS_SRCS := $(filter-out PrelMain.lhs, $(HS_SRCS))
82 # PrelMain.dll_o isn't to be included in the final .a,
83 # but it needs to be generated
87 CLEAN_FILES += PrelGHC.hi $(foreach way, $(WAYS), PrelGHC.$(way)_hi)
90 $(patsubst %.hsc, %.hs, $(HSC_SRCS)) \
91 $(patsubst %.hsc, %.hs.c, $(HSC_SRCS)) \
92 $(patsubst %.hsc, %.hs.h, $(HSC_SRCS))
94 #-----------------------------------------------------------------------------
95 # Installation; need to install .hi files as well as libraries
97 # The interface files are put inside the $(libdir), since they
98 # might (potentially) be platform specific..
100 # override is used here because for binary distributions, datadir is
101 # set on the command line. sigh.
103 override datadir:=$(libdir)/imports/std
106 # Files to install from here
108 ifeq "$(DLLized)" "YES"
109 INSTALL_LIBS += PrelMain.dll_o
112 INSTALL_DATAS += PrelGHC.$(way_)hi
114 include $(TOP)/mk/target.mk