[project @ 1997-07-07 17:08:21 by andre]
[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 #       $Id: Makefile,v 1.13 1997/07/07 17:08:21 andre Exp $
8 #
9 #       
10 #################################################################################
11
12 TOP = ..
13 include $(TOP)/mk/boilerplate.mk
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 += -prof -GPrelude
44 WAY_mr_HC_OPTS += -prof -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
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 -H10m
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 ghc/PrelBase_HC_OPTS         += -H8m
64 ghc/PrelRead_HC_OPTS         += -H8m
65 ghc/IOHandle_HC_OPTS         += -H8m
66
67 #-----------------------------------------------------------------------------
68 #       Dependency generation
69
70 SRC_MKDEPENDHS_OPTS += -ighc:required:glaExts:concurrent -I$(GHC_INCLUDE_DIR)
71
72 #-----------------------------------------------------------------------------
73 #       Rules
74
75 ## 6/97 - the manual copying of .hi-boot files to .hi is not used
76 ## anymore, renamer will look for a .hi-boot directly.
77 ## ToDo: remove old setup.
78
79 ifeq "1" "0"
80
81 # In preparation for building the various libHS* libraries,
82 # we create the interface files needed to boot their build.
83 #
84 # Note that the creation of IOBase, Main and GHC interface
85 # files for umpteen ways is strictly not necessary, they're
86 # all the same, but having the redundant files prevents us
87 # from having to treat the said interface files specially
88 # when creating the dependencies. 
89 #
90 # Note: if you change the *.hi-boot files, this will not be
91 # picked up by the Makefile, you'll have to `make hi-boot'
92 #
93 # Note2: hsc will only read from ghc/GHC.hi regardless of 
94 # which `way' you're compiling, so the copies of the GHC
95 # interface file for the different ways are only there
96 # to pacify `make'
97
98 HIBOOTS=GHC Main IOBase
99
100 # Use variable to control this, so that we can generate
101 # new boot interface files for new ways without having
102 # to re-generate the old lot (followed by complete recompile).
103 #
104 HIBOOT_WAYS = norm $(WAYS)
105
106 hi-boot :
107         @for i in $(HIBOOT_WAYS); do \
108                 echo "Booting interface files for way $$i "; \
109                 if [ "$$i" != "norm" ]; then \
110                    j="$${i}_hi"; \
111                 else \
112                    j='hi'; \
113                 fi; \
114                 for ifile in $(HIBOOTS); do \
115                         echo ".. ghc/$${ifile}.$$j "; \
116                         cp ghc/$${ifile}.hi-boot ghc/$${ifile}.$${j}; \
117                 done; \
118         done
119         @touch ghc/IOBase.lhs
120 else
121 hi-boot :
122         @echo "Done."
123 endif
124
125 boot :: hi-boot
126
127 #-----------------------------------------------------------------------------
128 #       Installation; need to install .hi files as well as libraries
129 #
130 # The interface files are put inside the $(libdir), since they
131 # might (potentially) be platform specific..
132 #
133 # Note: we use `override' here to ignore the setting of datadir
134 # which may have been set on the command-line..naughty, as it
135 # prevents `datadir' from being used from the command-line.
136 # This only applies to binary-distributions, though.n
137
138 ifeq "$(BIN_DIST)" "1"
139 override datadir:=$(libdir)/imports
140 else
141 datadir:=$(libdir)/imports
142 endif
143
144 #
145 # Files to install from here
146
147 INSTALL_LIBS  += $(LIBRARY)
148 INSTALL_DATAS += $(HS_IFACES)
149
150 include $(TOP)/mk/target.mk
151
152