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