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 HSC_SRCS = $(wildcard *.hsc)
41 HSC_HS = $(patsubst %.hsc,%.hs, $(HSC_SRCS))
42 HS_SRCS := $(HSC_HS) $(filter-out $(HSC_HS),$(HS_SRCS))
44 #-----------------------------------------------------------------------------
45 # Setting the GHC compile options
47 SRC_HC_OPTS += -cpp -fvia-C -fglasgow-exts $(GhcLibHcOpts) $(PACKAGE)
49 ifdef USE_REPORT_PRELUDE
50 SRC_HC_OPTS += -DUSE_REPORT_PRELUDE=1
53 # Object and interface files have suffixes tagged with their ways
55 SRC_HC_OPTS += -hisuf $(way_)hi
59 PrelStorable_HC_OPTS = -monly-3-regs
61 #-----------------------------------------------------------------------------
62 # Dependency generation
64 SRC_MKDEPENDHS_OPTS += -I$(GHC_INCLUDE_DIR)
66 #-----------------------------------------------------------------------------
69 PrelPrimopWrappers.hs: ../../compiler/prelude/primops.txt
70 rm -f PrelPrimopWrappers.hs
71 ../../utils/genprimopcode/genprimopcode --make-haskell-wrappers \
72 < ../../compiler/prelude/primops.txt > PrelPrimopWrappers.hs
74 PrelGHC.$(way_)hi : PrelGHC.hi-boot
77 boot :: PrelPrimopWrappers.hs PrelGHC.hi $(foreach way, $(WAYS), PrelGHC.$(way)_hi)
78 all :: PrelPrimopWrappers.hs
80 DLL_DESCRIPTION="GHC-compiled Haskell Prelude"
82 ifeq "$(DLLized)" "YES"
83 HS_SRCS := $(filter-out PrelMain.lhs PrelHugs.lhs, $(HS_SRCS))
84 # PrelMain.dll_o isn't to be included in the final .a,
85 # but it needs to be generated
89 CLEAN_FILES += PrelPrimopWrappers.hs PrelGHC.hi $(foreach way, $(WAYS), PrelGHC.$(way)_hi)
92 $(patsubst %.hsc, %.hs, $(HSC_SRCS)) \
93 $(patsubst %.hsc, %.hs.c, $(HSC_SRCS)) \
94 $(patsubst %.hsc, %.hs.h, $(HSC_SRCS))
96 #-----------------------------------------------------------------------------
97 # Installation; need to install .hi files as well as libraries
99 # The interface files are put inside the $(libdir), since they
100 # might (potentially) be platform specific..
102 # override is used here because for binary distributions, datadir is
103 # set on the command line. sigh.
105 override datadir:=$(libdir)/imports/std
108 # Files to install from here
110 ifeq "$(DLLized)" "YES"
111 INSTALL_LIBS += PrelMain.dll_o
114 INSTALL_DATAS += PrelGHC.$(way_)hi
115 ifeq "$(DLLized)" "YES"
116 INSTALL_DATAS := $(filter-out PrelHugs.$(way_)hi,$(INSTALL_DATAS))
119 include $(TOP)/mk/target.mk