#----------------------------------------------------------------------------- # $Id: Makefile.libHS,v 1.5 1997/01/07 01:17:38 simonpj Exp $ TOP = ../.. include $(TOP)/ghc/mk/ghc.mk # per-build options: shared with runtime system include ../mk/buildflags.mk # ============= ADDED BY SIMON ============= ifeq ($(GhcWithHscBuiltViaC),YES) HC = $(GHC) SuffixRule_hc_o = YES else HaskellSuffixRules = YES endif include $(TOP)/mk/rules.mk # =========================================== # Everything here *must* be compiled with the Glasgow Haskell compiler. # (Hence the use of $(GHC), rather than $(HC).) # The driver will give warnings if -split-objs, but that's cool... GHC_OPTS = \ -recomp -cpp -fglasgow-exts -fvia-C \ $(HcMaxHeapFlag) $(EXTRA_HC_OPTS) SRCS = $(wildcard ghc/*.lhs required/*.lhs glaExts/*.lhs concurrent/*.lhs) ifeq ($(suffix), norm) OBJS = $(SRCS:.lhs=.o) else OBJS = $(SRCS:.lhs=.$(suffix)_o) endif #----------------------------------------------------------------------------- # Rules for building various types of objects from HS files # Note: the $(*_flags) module-specific flags come after the $(GHC_OPTS_..) # so that things like -O can be overriden on a per-module basis. ifeq ($(SplitObjs),YES) LIB_GHC = $(GHC) $(GHCFLAGS) -split-objs $(notdir $*) -o $@ -c else LIB_GHC = $(GHC) $(GHCFLAGS) -o $@ -c endif ifneq ($(GhcWithHscBuiltViaC),YES) %.o : %.lhs $(LIB_GHC) $($*_flags) $*.lhs %.$(suffix)_o : %.lhs $(LIB_GHC) $(GHC_OPTS_$(suffix)) $($*_flags) $*.hs else # $(GhcWithHscBuiltViaC) == YES %.$(suffix)_o : %.hc $(LIB_GHC) $(GHC_OPTS_$(suffix)) $($*_flags) $*.hs endif #----------------------------------------------------------------------------- # build the library itself... ifeq ($(suffix), norm) LIB = libHS.a # this one is special else LIB = libHS_$(suffix).a endif $(LIB) : $(OBJS) @$(RM) $@ $(AR) $@ $^ all :: $(LIB) clean :: $(RM) $(LIB) $(RM) $(OBJS) install :: $(LIB) $(INSTALL) $(INSTLIBFLAGS) $(LIB) $(INSTLIBDIR_GHC) $(RANLIB) $(INSTLIBDIR_GHC)/$(LIB) veryclean :: $(RM) */*.hc */*.hi #----------------------------------------------------------------------------- # per-module flags # The -Onots are only because -O would not go through on # a reasonably-sized machine (i.e., one I have) ghc/PackedString_flags = '-\#include"cbits/stgio.h"' -monly-3-regs required/Directory_flags = '-\#include"cbits/stgio.h"' -monly-3-regs required/System_flags = '-\#include"cbits/stgio.h"' ghc/ArrBase_flags = '-fno-implicit-prelude' ghc/IOBase_flags = '-fno-implicit-prelude' ghc/IOHandle_flags = '-fno-implicit-prelude' ghc/PrelBase_flags = '-fno-implicit-prelude' ghc/PrelIO_flags = '-fno-implicit-prelude' ghc/PrelList_flags = '-fno-implicit-prelude' ghc/PrelNum_flags = '-fno-implicit-prelude' ghc/PrelRead_flags = '-fno-implicit-prelude' ghc/PrelTup_flags = '-fno-implicit-prelude' ghc/STBase_flags = '-fno-implicit-prelude' glaExts/Foreign_flags = '-fno-implicit-prelude' glaExts/PackedString_flags = '-fno-implicit-prelude' glaExts/ST_flags = '-fno-implicit-prelude' required/Array_flags = '-fno-implicit-prelude' required/Char_flags = '-fno-implicit-prelude' required/IO_flags = '-fno-implicit-prelude' required/Ix_flags = '-fno-implicit-prelude' required/Maybe_flags = '-fno-implicit-prelude' required/Monad_flags = '-fno-implicit-prelude' required/Ratio_flags = '-fno-implicit-prelude' concurrent/Merge_flags = -iconcurrent concurrent/Parallel_flags = -fglasgow-exts concurrent/Concurrent_flags = -iconcurrent #----------------------------------------------------------------------------- # Depend and install stuff MKDEPENDHS_OPTS += -I$(GHC_INCLUDES) MKDEPENDHS_OPTS += -irequired:ghc:hbc:glaExts:concurrent MKDEPENDHS_OPTS += $(foreach way,$(WAY_SUFFIXES),-s .$(way)) # Todo: make this a generic include of hsdepend.mk or something. depend :: $(SRCS) $(MKDEPENDHS) $(MKDEPENDHSFLAGS) -- $(GHCFLAGS) -- -f .depend $(SRCS) #----------------------------------------------------------------------------- # install hi files ifeq ($(suffix),norm) HI_FILES = $(SRCS:.hs=.hi) else HI_FILES = $(SRCS:.hs=.$(suffix)_hi) endif install :: $(HI_FILES) $(INSTALL) $(INSTDATAFLAGS) $(HI_FILES) $(INSTIMPORTSDIR_GHC)