From 4720b45e5950c8f1ecca211855c87e21b87435cf Mon Sep 17 00:00:00 2001 From: sof Date: Fri, 14 Mar 1997 05:11:52 +0000 Subject: [PATCH] [project @ 1997-03-14 05:11:36 by sof] New Makefile setup --- ghc/runtime/Makefile | 243 +++++++++++++++++++++++++++++++++++++--------- ghc/runtime/gmp/Makefile | 32 ++++-- 2 files changed, 217 insertions(+), 58 deletions(-) diff --git a/ghc/runtime/Makefile b/ghc/runtime/Makefile index ff994b3..ff991b0 100644 --- a/ghc/runtime/Makefile +++ b/ghc/runtime/Makefile @@ -1,5 +1,5 @@ #----------------------------------------------------------------------------- -# $Id: Makefile,v 1.3 1997/01/07 13:17:25 simonm Exp $ +# $Id: Makefile,v 1.4 1997/03/14 05:11:52 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,70 +25,217 @@ #----------------------------------------------------------------------------- -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. - -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/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) + +# +# 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) +# +# dependencies +# +SRC_HC_OPTS += -I$(GHC_INCLUDE_DIR) -O -optc-DIN_GHC_RTS=1 -I$(GHC_RUNTIME_DIR)/storage -%.o : %.c - @$(RM) $@ - $(RTS_GHC) $*.c +SRC_MKDEPENDC_OPTS += $(GCap) $(GC2s) $(GC1s) + +#----------------------------------------------------------------------------- +# 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 + + -install :: main/TopClosure.o - $(INSTALL) $(INSTLIBFLAGS) main/TopClosure.o $(INSTLIBDIR_GHC)/TopClosure.o #----------------------------------------------------------------------------- -# libHSrts.a, in several different 'ways' +# +# Files to install +# +# Just libHSrts is installed uniformly across ways +# +INSTALL_LIBS += $(LIBRARY) + + +#----------------------------------------------------------------------------- +# +# 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) $@ + $(HC) $(HC_OPTS) -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_LIBS += gum/SysMan +endif -MAKEFILE = Makefile.libHSrts -DESCR = runtime system -include $(TOP)/ghc/mk/ways.mk +include $(TOP)/mk/target.mk diff --git a/ghc/runtime/gmp/Makefile b/ghc/runtime/gmp/Makefile index 2672965..8b4af73 100644 --- a/ghc/runtime/gmp/Makefile +++ b/ghc/runtime/gmp/Makefile @@ -1,8 +1,11 @@ #----------------------------------------------------------------------------- -# $Id: Makefile,v 1.2 1996/11/21 16:48:25 simonm Exp $ +# $Id: Makefile,v 1.3 1997/03/14 05:11:36 sof Exp $ + +TOP=../.. +include $(TOP)/mk/boilerplate.mk +# There's only one `way' for gmp, empty WAYS variable right away. +WAYS= -TOP=../../.. -include $(TOP)/ghc/mk/ghc.mk GMP_OBJS = $(MPZ_OBJS) $(MPQ_OBJS) $(MPN_OBJS) $(IMPL_OBJS) mp_bases.o @@ -50,20 +53,29 @@ MPN_SRCS = mpn_add.c mpn_sub.c mpn_cmp.c mpn_mul.c mpn_div.c mpn_dm_1.c \ MPN_OBJS = mpn_add.o mpn_sub.o mpn_cmp.o mpn_mul.o mpn_div.o mpn_dm_1.o \ mpn_mod_1.o mpn_lshift.o mpn_rshift.o mpn_rshiftci.o mpn_sqrt.o -CC_OPTS = -I. +# +# Compiling gmp with gcc-2.7.2 *without* -O tripped up a bug in the +# code that sets up and stores the regs around an __asm__ (mpn_mul.c : add_ssaaaa). +# Enabling -O flushed out the problem, so dropping the -O is not advised. +# +SRC_CC_OPTS += -I. -O all depend :: gmp-mparam.h libgmp.a :: stamp-stddefh -ARCHIVE = libgmp.a +LIBRARY = libgmp.a LIBOBJS = $(GMP_OBJS) DESTDIR = $(INSTLIBDIR_GHC) -C_DEP_SRCS = $(IMPL_SRCS) $(MPZ_SRCS) $(MPQ_SRCS) $(MPN_SRCS) +C_SRCS = $(IMPL_SRCS) $(MPZ_SRCS) $(MPQ_SRCS) $(MPN_SRCS) + +# +# Install gmp +# +INSTALL_LIBS += $(LIBRARY) -clean :: - $(RM) test-with-stddefh.c stamp-stddefh \ - cre-mparam gmp-mparam.h mp_bases.c cre-conv-tab +CLEAN_FILES += test-with-stddefh.c stamp-stddefh cre-mparam gmp-mparam.h mp_bases.c cre-conv-tab +SRC_H_FILES+=$(wildcard *.h) COPYING ChangeLog INSTALL Makefile.original README TODO VERSION gmp.texi mpn_mul_classic.c-EXTRA # ToDo: something to make the doc # from here on, it is magic from the original Makefile @@ -105,4 +117,4 @@ gmp-mparam.h: cre-mparam cre-mparam: cre-mparam.c stamp-stddefh gmp.h $(LOCAL_CC) $(CFLAGS) cre-mparam.c -o $@ -include $(TOP)/mk/lib.mk +include $(TOP)/mk/target.mk -- 1.7.10.4