1 #-----------------------------------------------------------------------------
2 # $Id: Makefile.libHS,v 1.2 1996/11/21 16:47:42 simonm Exp $
5 include $(TOP)/ghc/mk/ghc.mk
7 # per-build options: shared with runtime system
8 include ../mk/buildflags.mk
10 # Everything here *must* be compiled with the Glasgow Haskell compiler.
11 # (Hence the use of $(GHC), rather than $(HC).)
12 # The driver will give warnings if -split-objs, but that's cool...
15 -recomp -cpp -dcore-lint -irequired -fusing-ghc-internals -fvia-C \
16 $(HcMaxHeapFlag) $(EXTRA_HC_OPTS)
18 SRCS = $(wildcard prelude/*.hs required/*.hs concurrent/*.hs)
19 OBJS = $(SRCS:.hs=.$(suffix)_o)
21 #-----------------------------------------------------------------------------
22 # Rules for building various types of objects from HS files
24 # Note: the $(*_flags) module-specific flags come after the $(GHC_OPTS_..)
25 # so that things like -O can be overriden on a per-module basis.
27 ifeq ($(SplitObjs),YES)
28 LIB_GHC = $(GHC) $(GHCFLAGS) -split-objs $(notdir $*) -o $@ -c
30 LIB_GHC = $(GHC) $(GHCFLAGS) -o $@ -c
33 ifneq ($(GhcWithHscBuiltViaC),YES)
35 $(LIB_GHC) $($*_flags) $*.hs
38 $(LIB_GHC) $(GHC_OPTS_$(suffix)) $($*_flags) $*.hs
40 else # $(GhcWithHscBuiltViaC) == YES
43 $(LIB_GHC) $(GHC_OPTS_$(suffix)) $($*_flags) $*.hs
46 #-----------------------------------------------------------------------------
47 # build the library itself...
49 ifeq ($(suffix), norm)
50 LIB = libHS.a # this one is special
52 LIB = libHS_$(suffix).a
66 $(INSTALL) $(INSTLIBFLAGS) $(LIB) $(INSTLIBDIR_GHC)
67 $(RANLIB) $(INSTLIBDIR_GHC)/$(LIB)
72 #-----------------------------------------------------------------------------
75 # The -Onots are only because -O would not go through on
76 # a reasonably-sized machine (i.e., one I have)
78 prelude/Prelude_flags = \
79 -iprelude -fglasgow-exts -fcompiling-ghc-internals Prelude \
80 -fno-implicit-prelude '-\#include"cbits/stgio.h"' -H18m -Onot
81 prelude/GHCbase_flags = \
82 -iprelude -fglasgow-exts -fcompiling-ghc-internals GHCbase \
83 '-\#include"cbits/stgio.h"' -H20m -monly-2-regs -Onot
84 prelude/GHCerr_flags = \
85 -iprelude -fglasgow-exts -fcompiling-ghc-internals GHCerr -H12m -Onot
86 prelude/GHCps_flags = \
87 -iprelude -fglasgow-exts '-\#include"cbits/stgio.h"' -monly-3-regs -Onot
88 prelude/GHCio_flags = \
89 -iprelude -fglasgow-exts '-\#include"cbits/stgio.h"' -Onot
90 prelude/GHCmain_flags = -iprelude -fglasgow-exts
91 prelude/PreludeGlaST_flags = -iprelude -fglasgow-exts
93 required/Array_flags = -fglasgow-exts -iprelude -Onot
94 required/Directory_flags = \
95 -fglasgow-exts '-\#include"cbits/stgio.h"' -monly-3-regs
96 required/IO_flags = -fglasgow-exts '-\#include"cbits/stgio.h"'
97 required/Ix_flags = -fglasgow-exts
98 required/System_flags = -fglasgow-exts '-\#include"cbits/stgio.h"'
100 concurrent/Merge_flags = -iconcurrent
101 concurrent/Parallel_flags = -fglasgow-exts
102 concurrent/Concurrent_flags = -iconcurrent
104 #-----------------------------------------------------------------------------
105 # Depend and install stuff
107 MKDEPENDHS_OPTS += -I$(GHC_INCLUDES)
108 MKDEPENDHS_OPTS += -irequired:prelude:ghc:hbc:glaExts:concurrent
109 MKDEPENDHS_OPTS += $(foreach way,$(WAY_SUFFIXES),-s .$(way))
111 # Todo: make this a generic include of hsdepend.mk or something.
113 $(MKDEPENDHS) $(MKDEPENDHSFLAGS) -- $(GHCFLAGS) -- -f .depend $(SRCS)
115 #-----------------------------------------------------------------------------
118 ifeq ($(suffix),norm)
119 HI_FILES = $(SRCS:.hs=.hi)
121 HI_FILES = $(SRCS:.hs=.$(suffix)_hi)
124 install :: $(HI_FILES)
125 $(INSTALL) $(INSTDATAFLAGS) $(HI_FILES) $(INSTIMPORTSDIR_GHC)