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