X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fruntime%2FMakefile;h=1126583b9e5fac8f61754d551bdfb064ee7433b9;hb=967cc47f37cb93a5e2b6df7822c9a646f0428247;hp=3399ebc0da9a3d7a408101ea0c184da58338f614;hpb=02b60157852c1bf3c371b47c33d83814a05153bc;p=ghc-hetmet.git diff --git a/ghc/runtime/Makefile b/ghc/runtime/Makefile index 3399ebc..1126583 100644 --- a/ghc/runtime/Makefile +++ b/ghc/runtime/Makefile @@ -1,5 +1,5 @@ #----------------------------------------------------------------------------- -# $Id: Makefile,v 1.2 1996/11/21 16:48:17 simonm Exp $ +# $Id: Makefile,v 1.12 1998/08/15 14:06:48 sof Exp $ # This is the Makefile for the runtime-system stuff. # This stuff is written in C (and cannot be written in Haskell). @@ -15,7 +15,7 @@ # storage -- the storage manager(s) # # We create two libraries. One, libHSrts.a, is built separately -# for each "build". The other, libHSclib.a is built once: it is just +# for each "way". The other, libHSclib.a is built once: it is just # .lc files that end up the same no matter what, i.e. completely # ordinary C. @@ -25,90 +25,224 @@ #----------------------------------------------------------------------------- -TOP=../.. -SuffixRules_WantStdOnes = NO -UnlitSuffixRules = YES_PLEASE -include $(TOP)/ghc/mk/ghc.mk +TOP=.. +DoingRTS=YES +include $(TOP)/mk/boilerplate.mk -SUBDIRS = gmp -include $(TOP)/mk/subdir.mk - -# If you use EXTRA_HC_OPTS on the command line (which you shouldn't, -# strictly speaking), it will probably work -- it is pinned onto -# GHC_OPTS, just for fun. +WAYS=$(GhcLibWays) -GHC_OPTS = $(EXTRA_HC_OPTS) +# +# A general rule for the grand mk setup is that in a build tree, only +# directories that don't have any subdirs containing Makefiles are built +# all the different `ways' when doing `make all'. +# +# The directory structure for the RTS is a bit at odds to the general +# scheme of things, with the GNU gmp library in gmp/ and a way-independent +# archive libHSclib.a beside all the way-archives for the RTS proper. +# +# So to avoid having to redo building the way-proof pieces each time +# the Makefile is invoked with a different setting of $(way), SUBDIRS +# is only set if $(way) isn't set. +# -# per-build options: shared with libraries -DoingRTS = YES -include ../mk/buildflags.mk +SUBDIRS = gmp #----------------------------------------------------------------------------- # knock the "clib" (completely ordinary C, compiled once) # stuff over the head first... +# +# Write out the rule for libHSclib explicitly, as it is special +# (not to be built n different ways) +# +SRCS_CLIB_LC = $(wildcard hooks/*.lc) main/Mallocs.lc +LIBOBJS_clib = $(SRCS_CLIB_LC:.lc=.o) + +all :: libHSclib.a + +libHSclib.a :: $(LIBOBJS_clib) + @$(RM) $@ + $(AR) $(AR_OPTS) $@ $(LIBOBJS_clib) + $(RANLIB) $@ -CLIB_LC = \ - hooks/ErrorHdr.lc \ - hooks/FreeForeignObj.lc \ - hooks/OutOfHeap.lc \ - hooks/OutOfStk.lc \ - hooks/OutOfVM.lc \ - hooks/NoRunnableThrds.lc \ - hooks/PatErrorHdr.lc \ - hooks/TraceHooks.lc \ - hooks/SizeHooks.lc \ - hooks/InitEachPE.lc \ - main/Mallocs.lc - -ARCHIVE = libHSclib.a -LIBOBJS = $(CLIB_LC:.lc=.o) -DESTDIR = $(INSTLIBDIR_GHC) - -include $(TOP)/mk/lib.mk +# +# Stuff to clean out, only on way `normal' +# +ifeq "$(way)" "" +MOSTLY_CLEAN_FILES += libHSclib.a $(LIBOBJS_clib) +CLEAN_FILES += $(SRCS_CLIB_LC:.lc=.c) +endif + +# +# Add libHSclib to the install library variable *only* +# if we're doing `make install' the `normal' way - don't want +# to install the same library for each different way. +# +ifeq "$(way)" "" +INSTALL_LIBS += libHSclib.a +endif + +#------------------------------------------------------------------ +# +# Run-time system parts that are `way' sensitive, you have to build +# a copy of libHSrts for each different ways. +# + +SRCS_RTS_LH = $(wildcard storage/*.lh) + +SRCS_RTS_LC = $(wildcard c-as-asm/*.lc) \ + gum/GlobAddr.lc \ + gum/HLComms.lc \ + gum/Hash.lc \ + gum/LLComms.lc \ + gum/Pack.lc \ + gum/ParInit.lc \ + gum/RBH.lc \ + gum/Sparks.lc \ + gum/Unpack.lc \ + main/GranSim.lc \ + main/Itimer.lc \ + main/Ticky.lc \ + main/SMRep.lc \ + main/Select.lc \ + main/Signals.lc \ + main/StgOverflow.lc \ + main/Threads.lc \ + main/RtsFlags.lc \ + main/main.lc \ + prims/PrimArith.lc \ + prims/LongLong.lc \ + prims/PrimMisc.lc \ + profiling/CostCentre.lc \ + profiling/Hashing.lc \ + profiling/HeapProfile.lc \ + profiling/Indexing.lc \ + profiling/Timer.lc \ + storage/SM1s.lc \ + storage/SM2s.lc \ + storage/SMap.lc \ + storage/SMcheck.lc \ + storage/SMcompacting.lc \ + storage/SMcopying.lc \ + storage/SMdu.lc \ + storage/SMevac.lc \ + storage/SMextn.lc \ + storage/SMinit.lc \ + storage/SMmarking.lc \ + storage/SMscan.lc \ + storage/SMscav.lc \ + storage/SMstacks.lc \ + storage/SMstatic.lc \ + storage/SMstats.lc \ + storage/mprotect.lc + +# +# LATER: Include Patrick's generational collector +# that's almost-but-not-quite there: storage/SMgen.lc +# + +SRCS_RTS_LHC = $(wildcard main/*.lhc c-as-asm/*.lhc storage/*.lhc gum/*.lhc) + +HEADER_FILES = $(SRCS_RTS_LH:.lh=.h) + +C_SRCS = $(SRCS_RTS_LC:.lc=.c) $(SRCS_RTS_LHC:.lhc=.hc) $(SRCS_CLIB_LC:.lc=.c) $(HEADER_FILES) + +# To avoid having to redo these each time. +.PRECIOUS : %.$(way_)hc + +# +# Clean out header files when doing way `normal' +# +ifeq "$(way)" "" +CLEAN_FILES += $(H_FILES) $(C_SRCS) +endif #----------------------------------------------------------------------------- -# Rules for building various types of objects from C files +# creating and installing libHSrts.a (in its many flavors) +# +LIBRARY = libHSrts$(_way).a +LIBOBJS = $(patsubst %.lc,%.$(way_)o,$(SRCS_RTS_LC)) \ + $(patsubst %.lhc,%.$(way_)o,$(SRCS_RTS_LHC)) -RTS_GHC = $(GHC) -c -o $@ $(GHCFLAGS) $($*_flags) +SRC_HC_OPTS += -I$(GHC_INCLUDE_DIR) $(GCap) $(GC2s) $(GC1s) -O -optc-DIN_GHC_RTS=1 -I$(GHC_RUNTIME_DIR)/storage -%.o : %.c - @$(RM) $@ - $(RTS_GHC) $*.c +# +# Note: _have_ to drop the -optc prefix for the GC-type opts (e.g. -optc-DGCap), since +# -o is interpreted by mkdependC as meaning use as suffix. +# +# Hack: Include -D for all the different collectors to be sure we gather all the deps. +# +SRC_MKDEPENDC_OPTS += -I$(GHC_INCLUDE_DIR) -DGCap -DGC1s -DGC2s + +#----------------------------------------------------------------------------- +# file-specific options +c-as-asm/PerformIO_HC_OPTS = -optc-DIN_GHC_RTS=1 +gum/FetchMe_HC_OPTS = -optc-DIN_GHC_RTS=1 +main/StgStartup_HC_OPTS = -optc-DIN_GHC_RTS=1 +main/StgThreads_HC_OPTS = -optc-DIN_GHC_RTS=1 +main/StgUpdate_HC_OPTS = -optc-DIN_GHC_RTS=1 +storage/SMmark_HC_OPTS = -optc-DIN_GHC_RTS=1 -optc-DMARK_REG_MAP + +#----------------------------------------------------------------------------- +# +# Compiling the individual files +# +# Rules for building various types of objects from C files, +# override the default suffix rule here, as we want to use +# ../driver/ghc (a better C compiler :-) to compile the +# different RTS pieces +# +CC=$(HC) $(HC_OPTS) $($*_HC_OPTS) #----------------------------------------------------------------------------- # the TopClosure +# +# Hook it into the list of files to generate dependencies for +# +C_SRCS += main/TopClosure.c +# +# The TopClosure is not part of libHSrts, so we add an extra all:: +# target to make sure it is built (TopClosure is way-proof): +# +ifeq "$(way)" "" all :: main/TopClosure.o -clean :: - $(RM) main/TopClosure.o +CLEAN_FILES += main/TopClosure.o +# +# The driver expects to find it in lib/ +# +INSTALL_LIBS += main/TopClosure.o +endif + +#----------------------------------------------------------------------------- +# +# Files to install +# +# Just libHSrts is installed uniformly across ways +# +INSTALL_LIBS += $(LIBRARY) -install :: main/TopClosure.o - $(INSTALL) $(INSTLIBFLAGS) main/TopClosure.o $(INSTLIBDIR_GHC)/TopClosure.o #----------------------------------------------------------------------------- -# libHSrts.a, in several different 'ways' - -all :: - @for i in $(WAY_SUFFIXES); do \ - echo; \ - echo =========== Making runtime system for way $$i; \ - echo; \ - $(MAKE) -f Makefile.libHSrts suffix=$$i; \ - done - -install :: - @for i in $(WAY_SUFFIXES); do \ - $(MAKE) -f Makefile.libHSrts suffix=$$i install; \ - done - -clean :: - @$(MAKE) -f Makefile.libHSrts clean - @for i in $(WAY_SUFFIXES); do \ - $(MAKE) -f Makefile.libHSrts suffix=$$i cleanobj; \ - done - -# Dependencies are done by Makefile.libHSrts - -depend :: - @$(MAKE) -f Makefile.libHSrts depend +# +# Building the GUM SysMan +# + +ifeq "$(way)" "mp" +all :: gum/SysMan + +ifdef solaris2_TARGET_OS +__socket_libs = -lsocket -lnsl +else +__socket_libs = +endif + +gum/SysMan : gum/SysMan.mp_o gum/LLComms.mp_o main/Mallocs.o hooks/OutOfVM.o + $(RM) $@ + gcc -o $@ gum/SysMan.mp_o gum/LLComms.mp_o main/Mallocs.o hooks/OutOfVM.o -L$$PVM_ROOT/lib/$$PVM_ARCH -lpvm3 -lgpvm3 $(__socket_libs) + +CLEAN_FILES += gum/SysMan.mp_o gum/SysMan +INSTALL_LIBEXECS += gum/SysMan +endif + +include $(TOP)/mk/target.mk