1 #-----------------------------------------------------------------------------
2 # $Id: Makefile.libHS,v 1.7 1997/01/18 10:04:27 simonpj Exp $
5 include $(TOP)/ghc/mk/ghc.mk
7 # per-build options: shared with runtime system
8 include ../mk/buildflags.mk
10 # ============= ADDED BY SIMON =============
11 ifeq ($(GhcWithHscBuiltViaC),YES)
15 HaskellSuffixRules = YES
17 include $(TOP)/mk/rules.mk
18 # ===========================================
20 # Everything here *must* be compiled with the Glasgow Haskell compiler.
21 # (Hence the use of $(GHC), rather than $(HC).)
22 # The driver will give warnings if -split-objs, but that's cool...
25 -recomp -cpp -fglasgow-exts -fvia-C \
26 $(HcMaxHeapFlag) $(EXTRA_HC_OPTS)
28 #-----------------------------------------------------------------------------
29 # Rules for building various types of objects from HS files
31 # Note: the $(*_flags) module-specific flags come after the $(GHC_OPTS_..)
32 # so that things like -O can be overriden on a per-module basis.
34 ifeq ($(SplitObjs),YES)
35 LIB_GHC = $(GHC) $(GHCFLAGS) -split-objs $(notdir $*) -o $@ -c
37 LIB_GHC = $(GHC) $(GHCFLAGS) -o $@ -c
40 ifneq ($(GhcWithHscBuiltViaC),YES)
42 $(LIB_GHC) $($*_flags) $*.lhs
45 $(LIB_GHC) $(GHC_OPTS_$(suffix)) $($*_flags) $*.lhs
47 else # $(GhcWithHscBuiltViaC) == YES
50 $(LIB_GHC) $(GHC_OPTS_$(suffix)) $($*_flags) $*.hc
53 #-----------------------------------------------------------------------------
54 # build the library itself...
56 ifeq ($(suffix), norm)
57 ARCHIVE = libHS.a # this one is special
59 ARCHIVE = libHS_$(suffix).a
62 SRCS = $(wildcard ghc/*.lhs glaExts/*.lhs required/*.lhs concurrent/*.lhs)
63 ifeq ($(suffix), norm)
64 LIBOBJS = $(SRCS:.lhs=.o)
66 LIBOBJS = $(SRCS:.lhs=.$(suffix)_o)
68 DESTDIR = $(INSTLIBDIR_GHC)
70 include $(TOP)/mk/lib.mk
72 #-----------------------------------------------------------------------------
75 # The -Onots are only because -O would not go through on
76 # a reasonably-sized machine (i.e., one I have)
78 ghc/PackedString_flags = '-\#include"cbits/stgio.h"' -monly-3-regs
79 required/Directory_flags = '-\#include"cbits/stgio.h"' -monly-3-regs
80 required/System_flags = '-\#include"cbits/stgio.h"'
82 concurrent/Merge_flags = -iconcurrent
83 concurrent/Parallel_flags = -fglasgow-exts
84 concurrent/Concurrent_flags = -iconcurrent
86 ghc/ArrBase_flags = '-fno-implicit-prelude'
87 ghc/IOBase_flags = '-fno-implicit-prelude'
88 ghc/IOHandle_flags = '-fno-implicit-prelude'
89 ghc/PrelBase_flags = '-fno-implicit-prelude'
90 ghc/PrelIO_flags = '-fno-implicit-prelude'
91 ghc/PrelList_flags = '-fno-implicit-prelude'
92 ghc/PrelNum_flags = '-fno-implicit-prelude'
93 ghc/PrelRead_flags = '-fno-implicit-prelude'
94 ghc/PrelTup_flags = '-fno-implicit-prelude'
95 ghc/STBase_flags = '-fno-implicit-prelude'
96 glaExts/Foreign_flags = '-fno-implicit-prelude'
97 glaExts/PackedString_flags = '-fno-implicit-prelude'
98 glaExts/ST_flags = '-fno-implicit-prelude'
99 required/Array_flags = '-fno-implicit-prelude'
100 required/Char_flags = '-fno-implicit-prelude'
101 required/IO_flags = '-fno-implicit-prelude'
102 required/Ix_flags = '-fno-implicit-prelude'
103 required/Maybe_flags = '-fno-implicit-prelude'
104 required/Monad_flags = '-fno-implicit-prelude'
105 required/Ratio_flags = '-fno-implicit-prelude'
108 #-----------------------------------------------------------------------------
109 # Depend and install stuff
111 MKDEPENDHS_OPTS += -I$(GHC_INCLUDES)
112 MKDEPENDHS_OPTS += -irequired:ghc:hbc:glaExts:concurrent
113 MKDEPENDHS_OPTS += $(foreach way,$(WAY_SUFFIXES),-s .$(way))
115 # Todo: make this a generic include of hsdepend.mk or something.
117 $(MKDEPENDHS) $(MKDEPENDHSFLAGS) -- $(GHCFLAGS) -- -f .depend $(SRCS)
119 # Copy the crucial IOBase hi file over
121 cp ghc/IOBase.hi-boot ghc/IOBase.hi
122 cp ghc/Main.hi-boot ghc/Main.hi
123 cp ghc/GHC.hi-boot ghc/GHC.hi
125 #-----------------------------------------------------------------------------
128 ifeq ($(suffix),norm)
129 HI_FILES = $(SRCS:.lhs=.hi)
131 HI_FILES = $(SRCS:.lhs=.$(suffix)_hi)
134 install :: $(HI_FILES)
135 $(INSTALL) $(INSTDATAFLAGS) $(HI_FILES) $(INSTIMPORTSDIR_GHC)