d662b0763ff67f0ce876919c2a20d46d74d9a0b3
[ghc-hetmet.git] / ghc / lib / exts / Makefile
1 #################################################################################
2 #
3 #                           ghc/lib/Makefile
4 #
5 #               Makefile for building the GHC Prelude libraries umpteen ways
6 #
7 #       
8 #################################################################################
9
10 TOP = ../..
11 include $(TOP)/mk/boilerplate.mk
12
13 WAYS=$(GhcLibWays)
14
15 #-----------------------------------------------------------------------------
16 #       Setting the standard variables
17 #
18
19 LIBRARY = libHSexts$(_way).a
20 HS_SRCS = $(wildcard *.lhs)
21 HS_OBJS = $(HS_SRCS:.lhs=.$(way_)o)
22 LIBOBJS = $(HS_OBJS)
23 HS_IFACES= $(HS_SRCS:.lhs=.$(way_)hi)
24
25 #-----------------------------------------------------------------------------
26 #       Setting the GHC compile options
27
28 SRC_HC_OPTS += -recomp -cpp -fglasgow-exts -fvia-C -Rghc-timing $(GhcLibHcOpts)
29
30 ifneq "$(way)" "dll"
31 SRC_HC_OPTS += -static
32 endif
33
34 #
35 # Profiling options
36 WAY_p_HC_OPTS += -GPrelude
37 WAY_mr_HC_OPTS += -GPrelude
38
39 #
40 # Object and interface files have suffixes tagged with their ways
41 #
42 ifneq "$(way)" ""
43 SRC_HC_OPTS += -hisuf $(way_)hi
44 endif
45
46 Int_HC_OPTS          += -H20m -fno-prune-tydecls -monly-3-regs
47 Word_HC_OPTS         += -H20m -monly-3-regs
48 Foreign_HC_OPTS      += -fno-prune-tydecls
49 NativeInfo_HC_OPTS   += -fno-prune-tydecls
50 Dynamic_HC_OPTS      += $(MAGIC_HSCPP_OPTS)
51
52 MAGIC_HSCPP_OPTS=-DBEGIN_FOR_GHC='-}' -DEND_FOR_GHC='{-' -DBEGIN_FOR_HUGS='{-' -DEND_FOR_HUGS='-}'
53
54 #-----------------------------------------------------------------------------
55 #       Dependency generation
56
57 SRC_MKDEPENDHS_OPTS += -I$(GHC_INCLUDE_DIR) -optdep--include-prelude -optdep-w $(MAGIC_HSCPP_OPTS)
58
59 #-----------------------------------------------------------------------------
60 #       Win32 DLL setup
61
62 DLL_NAME = HSexts.dll
63 DLL_IMPLIB_NAME = libHSexts_imp.a
64 SRC_BLD_DLL_OPTS += --export-all --output-def=HSexts.def
65 SRC_BLD_DLL_OPTS += -lwinmm -lHSrts_imp -lHScbits_imp -lHS_imp -lgmp -L. -L../../rts/gmp -L../../rts -L../std -L../std/cbits
66
67 #-----------------------------------------------------------------------------
68 #       Installation; need to install .hi files as well as libraries
69 #
70 # The interface files are put inside the $(libdir), since they
71 # might (potentially) be platform specific..
72 #
73 # override is used here because for binary distributions, datadir is
74 # set on the command line. sigh.
75 #
76 override datadir:=$(libdir)/imports/exts
77
78 #
79 # Files to install from here
80
81 INSTALL_LIBS  += $(LIBRARY)
82 INSTALL_DATAS += $(HS_IFACES)
83
84 ifeq "$(EnableWin32DLLs)" "YES"
85 INSTALL_PROGS += $(DLL_NAME)
86 INSTALL_LIBS  += $(patsubst %.a, %_imp.a, $(LIBRARY)) 
87 INSTALL_DATAS += dLL_ifs.hi
88 endif
89
90 include $(TOP)/mk/target.mk