[project @ 1997-09-05 09:16:19 by simonm]
[ghc-hetmet.git] / ghc / lib / 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 ifeq "$(way)" ""
16 SUBDIRS = cbits
17 ifeq ($(IncludeTestDirsInBuild),YES)
18   SUBDIRS += tests
19 endif
20 else
21 SUBDIRS=
22 endif
23
24 #-----------------------------------------------------------------------------
25 #       Setting the standard variables
26 #
27
28 LIB_DIRS = ghc required glaExts concurrent
29
30 LIBRARY = libHS$(_way).a
31 HS_SRCS = $(foreach d, $(LIB_DIRS), $(wildcard $(d)/*.lhs))
32 HS_OBJS = $(HS_SRCS:.lhs=.$(way_)o)
33 LIBOBJS = $(HS_OBJS)
34 HS_IFACES= $(HS_SRCS:.lhs=.$(way_)hi) ghc/GHC.$(way_)hi
35
36 #-----------------------------------------------------------------------------
37 #       Setting the GHC compile options
38
39 SRC_HC_OPTS += -recomp -cpp -fglasgow-exts -fvia-C -Rghc-timing $(GhcLibHcOpts)
40
41 #
42 # Profiling options
43 WAY_p_HC_OPTS += -GPrelude
44 WAY_mr_HC_OPTS += -GPrelude
45
46 #
47 # Object and interface files have suffixes tagged with their ways
48 #
49 ifneq "$(way)" ""
50 SRC_HC_OPTS += -hisuf $(way_)hi
51 endif
52
53 # per-module flags
54 ghc/ArrBase_HC_OPTS          += -monly-2-regs
55 glaExts/PackedString_HC_OPTS += -monly-3-regs
56 required/Directory_HC_OPTS   += -monly-3-regs 
57 concurrent/Parallel_HC_OPTS  += -fglasgow-exts
58 required/Time_HC_OPTS        += -monly-3-regs -H12m
59
60 # Far too much heap is needed to compile PrelNum with -O at the
61 # moment, but there you go..
62 ghc/PrelNum_HC_OPTS          += -H30m
63 # Note: this option has to go in the Makefile rather than in an
64 # OPTIONS line in the source file. The reason being that we want
65 # to override the SRC_HC_OPTS of -O, and anything option coming
66 # from the Makefile overrides what's in OPTIONS lines. (mumble_HC_OPTS
67 # does override SRC_HC_OPTS settings)
68 ghc/UnsafeST_HC_OPTS         += -Onot
69
70 ghc/PrelBase_HC_OPTS         += -H8m
71 ghc/PrelRead_HC_OPTS         += -H8m
72 ghc/IOHandle_HC_OPTS         += -H8m
73
74 #-----------------------------------------------------------------------------
75 #       Dependency generation
76
77 SRC_MKDEPENDHS_OPTS += -ighc:required:glaExts:concurrent -I$(GHC_INCLUDE_DIR)
78
79 #-----------------------------------------------------------------------------
80 #       Rules
81
82 ghc/GHC.$(way_)hi       : ghc/GHC.hi-boot
83         cp $< $@
84
85 boot :: ghc/GHC.hi $(foreach way, $(WAYS), ghc/GHC.$(way)_hi)
86
87 #-----------------------------------------------------------------------------
88 #       Installation; need to install .hi files as well as libraries
89 #
90 # The interface files are put inside the $(libdir), since they
91 # might (potentially) be platform specific..
92 #
93 # Note: we use `override' here to ignore the setting of datadir
94 # which may have been set on the command-line..naughty, as it
95 # prevents `datadir' from being used from the command-line.
96 # This only applies to binary-distributions, though.n
97
98 ifeq "$(BIN_DIST)" "1"
99 override datadir:=$(libdir)/imports
100 else
101 datadir:=$(libdir)/imports
102 endif
103
104 #
105 # Files to install from here
106
107 INSTALL_LIBS  += $(LIBRARY)
108 INSTALL_DATAS += $(HS_IFACES)
109
110 include $(TOP)/mk/target.mk