[project @ 1996-07-25 20:43:49 by partain]
[ghc-hetmet.git] / ghc / runtime / Jmakefile
index ea1edaf..713eda0 100644 (file)
@@ -6,7 +6,6 @@
    At the moment, there are a few such subdirs:
        c-as-asm        -- mini-interpreter & register hackery
        gum             -- GUM-specific stuff
-       io              -- support for libPOSIX
        main            -- "main", associated startup stuff, & MISC things
        prims           -- code for primitives that must be written in C
        profiling       -- cost-centre profiling
    Other sorta independent, compile-once subdirs are:
 
        gmp             -- GNU multi-precision library (for Integer)
-       regex           -- GNU regexp package
 */
 
 #define IHaveSubdirs
 
-SUBDIRS = gmp regex
+SUBDIRS = gmp
 
 /****************************************************************
 *                                                              *
@@ -35,6 +33,7 @@ SUBDIRS = gmp regex
 
 GhcDriverNeededHere(depend all) /* we use its C-compiling know-how */
 EtagsNeededHere(tags)
+UnlitNeededHere(depend)
 
 /****************************************************************
 *                                                              *
@@ -48,14 +47,7 @@ strictly speaking), it will probably work -- it is pinned onto
 GHC_OPTS, just for fun.
 */
 
-#if i386_TARGET_ARCH
-# define __plat_specific -mtoggle-sp-mangling
-#else
-# define __plat_specific /*none*/
-#endif
-
-GHC_OPTS = -O2-for-C -optc-DFORCE_GC \
-          __plat_specific $(EXTRA_HC_OPTS)
+GHC_OPTS = $(EXTRA_HC_OPTS)
 
 /* per-build options: shared with libraries */
 #define rts_or_lib(r,l) r
@@ -80,7 +72,6 @@ RTS_LH =                              \
 
 RTS_LC =                               \
        c-as-asm/CallWrap_C.lc          \
-       c-as-asm/FreeMallocPtr.lc       \
        c-as-asm/HpOverflow.lc          \
        c-as-asm/StablePtr.lc           \
        c-as-asm/StablePtrOps.lc        \
@@ -97,13 +88,13 @@ RTS_LC =                            \
        gum/Unpack.lc                   \
        main/GranSim.lc                 \
        main/Itimer.lc                  \
-       main/RednCounts.lc              \
+       main/Ticky.lc                   \
        main/SMRep.lc                   \
        main/Select.lc                  \
        main/Signals.lc                 \
        main/StgOverflow.lc             \
-       main/StgTrace.lc                \
        main/Threads.lc                 \
+       main/RtsFlags.lc                \
        main/main.lc                    \
        prims/PrimArith.lc              \
        prims/PrimMisc.lc               \
@@ -111,9 +102,7 @@ RTS_LC =                            \
        profiling/Hashing.lc            \
        profiling/HeapProfile.lc        \
        profiling/Indexing.lc           \
-       profiling/LifeProfile.lc        \
        profiling/Timer.lc              \
-       storage/Force_GC.lc             \
        storage/SM1s.lc                 \
        storage/SM2s.lc                 \
        storage/SMap.lc                 \
@@ -142,56 +131,18 @@ RTS_LHC =                                 \
        storage/SMmark.lhc              \
        gum/FetchMe.lhc
 
-#if GhcWithReadline == YES
-# define __readline_cfile io/ghcReadline.lc
-#else
-# define __readline_cfile /*none*/
-#endif
-
 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              \
-       io/closeFile.lc                 \
-       io/createDirectory.lc           \
-       io/env.lc                       \
-       io/errno.lc                     \
-       io/execvpe.lc                   \
-       io/fileEOF.lc                   \
-       io/fileGetc.lc                  \
-       io/fileLookAhead.lc             \
-       io/filePosn.lc                  \
-       io/filePutc.lc                  \
-       io/fileSize.lc                  \
-       io/flushFile.lc                 \
-       io/getBufferMode.lc             \
-       io/getCPUTime.lc                \
-       io/getClockTime.lc              \
-       io/getCurrentDirectory.lc       \
-       io/getDirectoryContents.lc      \
-       io/getLock.lc                   \
-       io/inputReady.lc                \
-       io/openFile.lc                  \
-       io/readFile.lc                  \
-       io/removeDirectory.lc           \
-       io/removeFile.lc                \
-       io/renameDirectory.lc           \
-       io/renameFile.lc                \
-       io/seekFile.lc                  \
-       io/setBuffering.lc              \
-       io/setCurrentDirectory.lc       \
-       io/showTime.lc                  \
-       io/system.lc                    \
-       io/toClockSec.lc                \
-       io/toLocalTime.lc               \
-       io/toUTCTime.lc                 \
-       io/writeFile.lc                 \
-       prims/ByteOps.lc                \
-       storage/SMalloc.lc __readline_cfile
+       hooks/InitEachPE.lc             \
+       main/Mallocs.lc
 
 H_FILES = $(RTS_LH:.lh=.h)
 C_FILES = $(RTS_LC:.lc=.c) $(RTS_LHC:.lhc=.hc) $(CLIB_LC:.lc=.c)
@@ -203,9 +154,9 @@ all depend :: $(H_FILES)
 ExtraStuffToClean ( $(C_FILES) )
 
 /* Literate-pgmming suffix rules used herein */
-LitSuffixRule(.lhc,.hc)
-LitSuffixRule(.lc,.c)
-LitSuffixRule(.lh,.h)
+UnlitSuffixRule(.lhc,.hc)
+UnlitSuffixRule(.lc,.c)
+UnlitSuffixRule(.lh,.h)
 
 /****************************************************************
 *                                                              *
@@ -214,32 +165,34 @@ LitSuffixRule(.lh,.h)
 ****************************************************************/
 
 RTS_OBJS_norm = $(RTS_LC:.lc=.o)    $(RTS_LHC:.lhc=.o)
-RTS_OBJS_p    = $(RTS_LC:.lc=_p.o)  $(RTS_LHC:.lhc=_p.o)
-RTS_OBJS_t    = $(RTS_LC:.lc=_t.o)  $(RTS_LHC:.lhc=_t.o)
-RTS_OBJS_u    = $(RTS_LC:.lc=_u.o)  $(RTS_LHC:.lhc=_u.o)
-RTS_OBJS_mc   = $(RTS_LC:.lc=_mc.o) $(RTS_LHC:.lhc=_mc.o)
-RTS_OBJS_mr   = $(RTS_LC:.lc=_mr.o) $(RTS_LHC:.lhc=_mr.o)
-RTS_OBJS_mt   = $(RTS_LC:.lc=_mt.o) $(RTS_LHC:.lhc=_mt.o)
-RTS_OBJS_mp   = $(RTS_LC:.lc=_mp.o) $(RTS_LHC:.lhc=_mp.o)
-RTS_OBJS_mg   = $(RTS_LC:.lc=_mg.o) $(RTS_LHC:.lhc=_mg.o)
-RTS_OBJS_2s   = $(RTS_LC:.lc=_2s.o) $(RTS_LHC:.lhc=_2s.o)
-RTS_OBJS_1s   = $(RTS_LC:.lc=_1s.o) $(RTS_LHC:.lhc=_1s.o)
-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lc=.l_o)  $(RTS_LHC:.lhc=.l_o)
+RTS_OBJS_m    = $(RTS_LC:.lc=.m_o)  $(RTS_LHC:.lhc=.m_o)
+RTS_OBJS_n    = $(RTS_LC:.lc=.n_o)  $(RTS_LHC:.lhc=.n_o)
+RTS_OBJS_o    = $(RTS_LC:.lc=.o_o)  $(RTS_LHC:.lhc=.o_o)
+RTS_OBJS_A    = $(RTS_LC:.lc=.A_o)  $(RTS_LHC:.lhc=.A_o)
+RTS_OBJS_B    = $(RTS_LC:.lc=.B_o)  $(RTS_LHC:.lhc=.B_o)
 
 CLIB_OBJS     = $(CLIB_LC:.lc=.o)
 
@@ -250,11 +203,6 @@ CLIB_OBJS     = $(CLIB_LC:.lc=.o)
 *                                                              *
 ****************************************************************/
 
-#define CompileClibishly(file,flags)                           @@\
-CAT2(file,.o) : CAT2(file,.c)                                  @@\
-       $(RM) $@                                                @@\
-       $(GHC) -c -o CAT2(file,.o) $(GHCFLAGS) flags CAT2(file,.c)
-
 NormalLibraryTarget(HSclib,$(CLIB_OBJS))
 ExtraStuffToClean($(CLIB_OBJS))
 #if DoInstallGHCSystem == YES
@@ -262,64 +210,27 @@ InstallLibraryTarget(HSclib,$(INSTLIBDIR_GHC))
 #endif
 
 /* all .lc files, so far */
-CompileClibishly(hooks/ErrorHdr,)
-CompileClibishly(hooks/OutOfHeap,)
-CompileClibishly(hooks/OutOfStk,)
-CompileClibishly(hooks/OutOfVM,)
-CompileClibishly(hooks/PatErrorHdr,)
-CompileClibishly(hooks/TraceHooks,)
-CompileClibishly(hooks/SizeHooks,)
-CompileClibishly(io/closeFile,)
-CompileClibishly(io/createDirectory,)
-CompileClibishly(io/env,)
-CompileClibishly(io/errno,)
-CompileClibishly(io/execvpe,)
-CompileClibishly(io/fileEOF,)
-CompileClibishly(io/fileGetc,)
-CompileClibishly(io/fileLookAhead,)
-CompileClibishly(io/filePosn,)
-CompileClibishly(io/filePutc,)
-CompileClibishly(io/fileSize,)
-CompileClibishly(io/flushFile,)
-CompileClibishly(io/getBufferMode,)
-CompileClibishly(io/getCPUTime,)
-CompileClibishly(io/getClockTime,)
-CompileClibishly(io/getCurrentDirectory,)
-CompileClibishly(io/getDirectoryContents,)
-CompileClibishly(io/getLock,)
-CompileClibishly(io/inputReady,)
-CompileClibishly(io/openFile,)
-CompileClibishly(io/readFile,)
-CompileClibishly(io/removeDirectory,)
-CompileClibishly(io/removeFile,)
-CompileClibishly(io/renameDirectory,)
-CompileClibishly(io/renameFile,)
-CompileClibishly(io/seekFile,)
-CompileClibishly(io/setBuffering,)
-CompileClibishly(io/setCurrentDirectory,)
-CompileClibishly(io/showTime,)
-CompileClibishly(io/system,)
-CompileClibishly(io/toClockSec,)
-CompileClibishly(io/toLocalTime,)
-CompileClibishly(io/toUTCTime,)
-CompileClibishly(io/writeFile,)
-CompileClibishly(main/TopClosure,)     /* NB */
-CompileClibishly(main/TopClosure13,)   /* ditto */
-CompileClibishly(prims/ByteOps,)
-CompileClibishly(storage/SMalloc,)
-#if GhcWithReadline == YES
-CompileClibishly(io/ghcReadline,)
-#endif
-
-ExtraStuffToClean(main/TopClosure.o main/TopClosure13.o)
-
-all :: main/TopClosure.o main/TopClosure13.o
-
-install :: main/TopClosure.o main/TopClosure13.o
+CompileCBitsly(GHC,hooks/ErrorHdr,)
+CompileCBitsly(GHC,hooks/FreeForeignObj,)
+CompileCBitsly(GHC,hooks/OutOfHeap,)
+CompileCBitsly(GHC,hooks/OutOfStk,)
+CompileCBitsly(GHC,hooks/OutOfVM,)
+CompileCBitsly(GHC,hooks/NoRunnableThrds,)
+CompileCBitsly(GHC,hooks/PatErrorHdr,)
+CompileCBitsly(GHC,hooks/TraceHooks,)
+CompileCBitsly(GHC,hooks/SizeHooks,)
+CompileCBitsly(GHC,hooks/InitEachPE,)
+CompileCBitsly(GHC,main/Mallocs,)
+CompileCBitsly(GHC,main/TopClosure,)
+
+ExtraStuffToClean(main/TopClosure.o)
+
+all :: main/TopClosure.o
+
+install :: main/TopClosure.o
        $(INSTALL) -c $(INSTLIBFLAGS) main/TopClosure.o   $(INSTLIBDIR_GHC)/TopClosure.o
-       $(INSTALL) -c $(INSTLIBFLAGS) main/TopClosure13.o $(INSTLIBDIR_GHC)/TopClosure13.o
 
-#if GhcBuild_mp == YES
+#if Build_mp == YES
 # if solaris2_TARGET_OS
 #  define __socket_libs -lsocket -lnsl
 # else
@@ -327,10 +238,10 @@ install :: main/TopClosure.o main/TopClosure13.o
 # endif
 
 AllTarget(gum/SysMan)
-gum/SysMan : gum/SysMan_mp.o gum/LLComms_mp.o
+gum/SysMan : gum/SysMan.mp_o gum/LLComms.mp_o main/Mallocs.o hooks/OutOfVM.o
        $(RM) $@
-       $(CC) gum/SysMan_mp.o gum/LLComms_mp.o -o $@ -L$$PVM_ROOT/lib/$$PVM_ARCH -lpvm3 -lgpvm3 __socket_libs
-ExtraStuffToClean(gum/SysMan_mp.o gum/SysMan)
+       $(CC) -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
+ExtraStuffToClean(gum/SysMan.mp_o gum/SysMan)
 # if DoInstallGHCSystem == YES
 install :: gum/SysMan
        $(INSTALL) -c $(INSTBINFLAGS) gum/SysMan $(INSTLIBDIR_GHC)/SysMan
@@ -346,29 +257,29 @@ install :: gum/SysMan
 /* to build and install the per-build rts stuff */
 
 #ifndef SpecialGhcRtsLibTarget
-#define SpecialGhcRtsLibTarget(tag,objs)                                       @@\
-AllTarget(CAT3(libHSrts,tag,.a))                                               @@\
-ExtraStuffToClean(objs CAT3(libHSrts,tag,.a))                                  @@\
-CAT3(libHSrts,tag,.a):: $(H_FILES) objs                                        @@\
-       $(RM) $@                                                                @@\
-       $(AR) $@ objs                                                           @@\
+#define SpecialGhcRtsLibTarget(tag,objs)       @@\
+AllTarget(CAT3(libHSrts,tag,.a))               @@\
+ExtraStuffToClean(objs CAT3(libHSrts,tag,.a))  @@\
+CAT3(libHSrts,tag,.a):: $(H_FILES) objs        @@\
+       $(RM) $@                                @@\
+       $(AR) $@ objs                           @@\
        $(RANLIB) $@
 #endif /* SpecialGhcRtsLibTarget */
 
 #ifndef SpecialGhcRtsLibInstallTarget
 #if DoInstallGHCSystem == YES
-#define SpecialGhcRtsLibInstallTarget(tag)                                     @@\
-install :: CAT3(libHSrts,tag,.a)                                               @@\
-       $(INSTALL) $(INSTLIBFLAGS) \                                            @@\
-               CAT3(libHSrts,tag,.a) \                                         @@\
-               $(INSTLIBDIR_GHC)/CAT3(libHSrts,tag,.a)                         @@\
+#define SpecialGhcRtsLibInstallTarget(tag)                     @@\
+install :: CAT3(libHSrts,tag,.a)                               @@\
+       $(INSTALL) $(INSTLIBFLAGS) \                            @@\
+               CAT3(libHSrts,tag,.a) \                         @@\
+               $(INSTLIBDIR_GHC)/CAT3(libHSrts,tag,.a)         @@\
        $(RANLIB) $(INSTLIBDIR_GHC)/CAT3(libHSrts,tag,.a)
 #else /* ! DoInstallGHC... */
 #define SpecialGhcRtsLibInstallTarget(tag) /*nothing*/
 #endif /* ! DoInstallGHC... */
 #endif /* SpecialGhcRtsLibInstallTarget */
 
-#define BigBuildTarget(tag,objs)       \
+#define BigBuildRtsTarget(tag,objs)    \
 SpecialGhcRtsLibTarget(tag,objs)       @@\
 SpecialGhcRtsLibInstallTarget(tag)
 
@@ -382,33 +293,35 @@ SpecialGhcRtsLibInstallTarget(tag)
 MakeDirectories(install, $(INSTLIBDIR_GHC))
 #endif /* DoInstallGHCSystem */
 
-IfGhcBuild_normal(BigBuildTarget(,$(RTS_OBJS_norm)))
-IfGhcBuild_p(BigBuildTarget(_p,   $(RTS_OBJS_p)))
-IfGhcBuild_t(BigBuildTarget(_t,   $(RTS_OBJS_t)))
-IfGhcBuild_u(BigBuildTarget(_u,   $(RTS_OBJS_u)))
-IfGhcBuild_mc(BigBuildTarget(_mc, $(RTS_OBJS_mc)))
-IfGhcBuild_mr(BigBuildTarget(_mr, $(RTS_OBJS_mr)))
-IfGhcBuild_mt(BigBuildTarget(_mt, $(RTS_OBJS_mt)))
-IfGhcBuild_mp(BigBuildTarget(_mp, $(RTS_OBJS_mp)))
-IfGhcBuild_mg(BigBuildTarget(_mg, $(RTS_OBJS_mg)))
-IfGhcBuild_2s(BigBuildTarget(_2s, $(RTS_OBJS_2s)))
-IfGhcBuild_1s(BigBuildTarget(_1s, $(RTS_OBJS_1s)))
-IfGhcBuild_du(BigBuildTarget(_du, $(RTS_OBJS_du)))
-IfGhcBuild_a(BigBuildTarget(_a,   $(RTS_OBJS_a)))
-IfGhcBuild_b(BigBuildTarget(_b,   $(RTS_OBJS_b)))
-IfGhcBuild_c(BigBuildTarget(_c,   $(RTS_OBJS_c)))
-IfGhcBuild_d(BigBuildTarget(_d,   $(RTS_OBJS_d)))
-IfGhcBuild_e(BigBuildTarget(_e,   $(RTS_OBJS_e)))
-IfGhcBuild_f(BigBuildTarget(_f,   $(RTS_OBJS_f)))
-IfGhcBuild_g(BigBuildTarget(_g,   $(RTS_OBJS_g)))
-IfGhcBuild_h(BigBuildTarget(_h,   $(RTS_OBJS_h)))
-IfGhcBuild_i(BigBuildTarget(_i,   $(RTS_OBJS_i)))
-IfGhcBuild_j(BigBuildTarget(_j,   $(RTS_OBJS_j)))
-IfGhcBuild_k(BigBuildTarget(_k,   $(RTS_OBJS_k)))
-IfGhcBuild_l(BigBuildTarget(_l,   $(RTS_OBJS_l)))
-IfGhcBuild_m(BigBuildTarget(_m,   $(RTS_OBJS_m)))
-IfGhcBuild_n(BigBuildTarget(_n,   $(RTS_OBJS_n)))
-IfGhcBuild_o(BigBuildTarget(_o,   $(RTS_OBJS_o)))
+IfBuild_normal(BigBuildRtsTarget(,$(RTS_OBJS_norm)))
+IfBuild_p(BigBuildRtsTarget(_p,   $(RTS_OBJS_p)))
+IfBuild_t(BigBuildRtsTarget(_t,   $(RTS_OBJS_t)))
+IfBuild_u(BigBuildRtsTarget(_u,   $(RTS_OBJS_u)))
+IfBuild_mc(BigBuildRtsTarget(_mc, $(RTS_OBJS_mc)))
+IfBuild_mr(BigBuildRtsTarget(_mr, $(RTS_OBJS_mr)))
+IfBuild_mt(BigBuildRtsTarget(_mt, $(RTS_OBJS_mt)))
+IfBuild_mp(BigBuildRtsTarget(_mp, $(RTS_OBJS_mp)))
+IfBuild_mg(BigBuildRtsTarget(_mg, $(RTS_OBJS_mg)))
+IfBuild_2s(BigBuildRtsTarget(_2s, $(RTS_OBJS_2s)))
+IfBuild_1s(BigBuildRtsTarget(_1s, $(RTS_OBJS_1s)))
+IfBuild_du(BigBuildRtsTarget(_du, $(RTS_OBJS_du)))
+IfBuild_a(BigBuildRtsTarget(_a,   $(RTS_OBJS_a)))
+IfBuild_b(BigBuildRtsTarget(_b,   $(RTS_OBJS_b)))
+IfBuild_c(BigBuildRtsTarget(_c,   $(RTS_OBJS_c)))
+IfBuild_d(BigBuildRtsTarget(_d,   $(RTS_OBJS_d)))
+IfBuild_e(BigBuildRtsTarget(_e,   $(RTS_OBJS_e)))
+IfBuild_f(BigBuildRtsTarget(_f,   $(RTS_OBJS_f)))
+IfBuild_g(BigBuildRtsTarget(_g,   $(RTS_OBJS_g)))
+IfBuild_h(BigBuildRtsTarget(_h,   $(RTS_OBJS_h)))
+IfBuild_i(BigBuildRtsTarget(_i,   $(RTS_OBJS_i)))
+IfBuild_j(BigBuildRtsTarget(_j,   $(RTS_OBJS_j)))
+IfBuild_k(BigBuildRtsTarget(_k,   $(RTS_OBJS_k)))
+IfBuild_l(BigBuildRtsTarget(_l,   $(RTS_OBJS_l)))
+IfBuild_m(BigBuildRtsTarget(_m,   $(RTS_OBJS_m)))
+IfBuild_n(BigBuildRtsTarget(_n,   $(RTS_OBJS_n)))
+IfBuild_o(BigBuildRtsTarget(_o,   $(RTS_OBJS_o)))
+IfBuild_A(BigBuildRtsTarget(_A,   $(RTS_OBJS_A)))
+IfBuild_B(BigBuildRtsTarget(_B,   $(RTS_OBJS_B)))
 
 
 /****************************************************************
@@ -417,51 +330,52 @@ IfGhcBuild_o(BigBuildTarget(_o,   $(RTS_OBJS_o)))
 *                                                              *
 ****************************************************************/
 
-#define DoRtsFile(file,isuf,way,flags)                                  @@\
-CAT3(file,way,.o) : CAT2(file,isuf)                                     @@\
+#define DoRtsFile(file,isuf,way,vsuf,flags)                             @@\
+CAT3(file.,way,o) : CAT2(file,isuf)                                     @@\
        $(RM) $@                                                         @@\
-       $(GHC) -c -o CAT3(file,way,.o) $(GHCFLAGS) flags CAT2(file,isuf)
-
-#define CompileRTSishly(file,isuf,flags)                       @@\
-IfGhcBuild_normal(DoRtsFile(file,isuf,,flags $(GHC_OPTS_norm)))        \
-IfGhcBuild_p(DoRtsFile(file,isuf,_p,   flags $(GHC_OPTS_p)))   \
-IfGhcBuild_t(DoRtsFile(file,isuf,_t,   flags $(GHC_OPTS_t)))   \
-IfGhcBuild_u(DoRtsFile(file,isuf,_u,   flags $(GHC_OPTS_u)))   \
-IfGhcBuild_mc(DoRtsFile(file,isuf,_mc, flags $(GHC_OPTS_mc)))  \
-IfGhcBuild_mr(DoRtsFile(file,isuf,_mr, flags $(GHC_OPTS_mr)))  \
-IfGhcBuild_mt(DoRtsFile(file,isuf,_mt, flags $(GHC_OPTS_mt)))  \
-IfGhcBuild_mp(DoRtsFile(file,isuf,_mp, flags $(GHC_OPTS_mp)))  \
-IfGhcBuild_mg(DoRtsFile(file,isuf,_mg, flags $(GHC_OPTS_mg)))  \
-IfGhcBuild_2s(DoRtsFile(file,isuf,_2s, flags $(GHC_OPTS_2s)))  \
-IfGhcBuild_1s(DoRtsFile(file,isuf,_1s, flags $(GHC_OPTS_1s)))  \
-IfGhcBuild_du(DoRtsFile(file,isuf,_du, flags $(GHC_OPTS_du)))  \
-IfGhcBuild_a(DoRtsFile(file,isuf,_a,   flags $(GHC_OPTS_a)))   \
-IfGhcBuild_b(DoRtsFile(file,isuf,_b,   flags $(GHC_OPTS_b)))   \
-IfGhcBuild_c(DoRtsFile(file,isuf,_c,   flags $(GHC_OPTS_c)))   \
-IfGhcBuild_d(DoRtsFile(file,isuf,_d,   flags $(GHC_OPTS_d)))   \
-IfGhcBuild_e(DoRtsFile(file,isuf,_e,   flags $(GHC_OPTS_e)))   \
-IfGhcBuild_f(DoRtsFile(file,isuf,_f,   flags $(GHC_OPTS_f)))   \
-IfGhcBuild_g(DoRtsFile(file,isuf,_g,   flags $(GHC_OPTS_g)))   \
-IfGhcBuild_h(DoRtsFile(file,isuf,_h,   flags $(GHC_OPTS_h)))   \
-IfGhcBuild_i(DoRtsFile(file,isuf,_i,   flags $(GHC_OPTS_i)))   \
-IfGhcBuild_j(DoRtsFile(file,isuf,_j,   flags $(GHC_OPTS_j)))   \
-IfGhcBuild_k(DoRtsFile(file,isuf,_k,   flags $(GHC_OPTS_k)))   \
-IfGhcBuild_l(DoRtsFile(file,isuf,_l,   flags $(GHC_OPTS_l)))   \
-IfGhcBuild_m(DoRtsFile(file,isuf,_m,   flags $(GHC_OPTS_m)))   \
-IfGhcBuild_n(DoRtsFile(file,isuf,_n,   flags $(GHC_OPTS_n)))   \
-IfGhcBuild_o(DoRtsFile(file,isuf,_o,   flags $(GHC_OPTS_o)))
+       $(GHC) -c -o CAT3(file.,way,o) $(GHCFLAGS) flags $(CAT3(GHC,_OPTS,vsuf)) CAT2(file,isuf)
+
+#define CompileRTSishly(file,isuf,flags)               @@\
+IfBuild_normal(DoRtsFile(file,isuf,,_norm,flags))      \
+IfBuild_p(DoRtsFile(file,isuf,p_,_p,             flags))       \
+IfBuild_t(DoRtsFile(file,isuf,t_,_t,             flags))       \
+IfBuild_u(DoRtsFile(file,isuf,u_,_u,             flags))       \
+IfBuild_mc(DoRtsFile(file,isuf,mc_,_mc,   flags))      \
+IfBuild_mr(DoRtsFile(file,isuf,mr_,_mr,   flags))      \
+IfBuild_mt(DoRtsFile(file,isuf,mt_,_mt,   flags))      \
+IfBuild_mp(DoRtsFile(file,isuf,mp_,_mp,   flags))      \
+IfBuild_mg(DoRtsFile(file,isuf,mg_,_mg,   flags))      \
+IfBuild_2s(DoRtsFile(file,isuf,2s_,_2s,   flags))      \
+IfBuild_1s(DoRtsFile(file,isuf,1s_,_1s,   flags))      \
+IfBuild_du(DoRtsFile(file,isuf,du_,_du,   flags))      \
+IfBuild_a(DoRtsFile(file,isuf,a_,_a,             flags))       \
+IfBuild_b(DoRtsFile(file,isuf,b_,_b,             flags))       \
+IfBuild_c(DoRtsFile(file,isuf,c_,_c,             flags))       \
+IfBuild_d(DoRtsFile(file,isuf,d_,_d,             flags))       \
+IfBuild_e(DoRtsFile(file,isuf,e_,_e,             flags))       \
+IfBuild_f(DoRtsFile(file,isuf,f_,_f,             flags))       \
+IfBuild_g(DoRtsFile(file,isuf,g_,_g,             flags))       \
+IfBuild_h(DoRtsFile(file,isuf,h_,_h,             flags))       \
+IfBuild_i(DoRtsFile(file,isuf,i_,_i,             flags))       \
+IfBuild_j(DoRtsFile(file,isuf,j_,_j,             flags))       \
+IfBuild_k(DoRtsFile(file,isuf,k_,_k,             flags))       \
+IfBuild_l(DoRtsFile(file,isuf,l_,_l,             flags))       \
+IfBuild_m(DoRtsFile(file,isuf,m_,_m,             flags))       \
+IfBuild_n(DoRtsFile(file,isuf,n_,_n,             flags))       \
+IfBuild_o(DoRtsFile(file,isuf,o_,_o,             flags))       \
+IfBuild_A(DoRtsFile(file,isuf,A_,_A,             flags))       \
+IfBuild_B(DoRtsFile(file,isuf,B_,_B,             flags))
 
 /* here we go: */
 
 CompileRTSishly(c-as-asm/CallWrap_C,.c,)
-CompileRTSishly(c-as-asm/FreeMallocPtr,.c,)
 CompileRTSishly(c-as-asm/HpOverflow,.c,)
-CompileRTSishly(c-as-asm/PerformIO,.hc,-mtoggle-sp-mangling/*toggle it back*/)
+CompileRTSishly(c-as-asm/PerformIO,.hc,-optc-DIN_GHC_RTS=1)
 CompileRTSishly(c-as-asm/StablePtr,.c,)
 CompileRTSishly(c-as-asm/StablePtrOps,.c,)
 CompileRTSishly(c-as-asm/StgDebug,.c,)
 CompileRTSishly(c-as-asm/StgMiniInt,.c,)
-CompileRTSishly(gum/FetchMe,.hc,-mtoggle-sp-mangling/*toggle it back*/)
+CompileRTSishly(gum/FetchMe,.hc,-optc-DIN_GHC_RTS=1)
 CompileRTSishly(gum/GlobAddr,.c,)
 CompileRTSishly(gum/HLComms,.c,)
 CompileRTSishly(gum/Hash,.c,)
@@ -474,26 +388,24 @@ CompileRTSishly(gum/SysMan,.c,) /* NB: not in library */
 CompileRTSishly(gum/Unpack,.c,)
 CompileRTSishly(main/GranSim,.c,)
 CompileRTSishly(main/Itimer,.c,)
-CompileRTSishly(main/RednCounts,.c,)
+CompileRTSishly(main/Ticky,.c,)
 CompileRTSishly(main/SMRep,.c,)
 CompileRTSishly(main/Select,.c,)
 CompileRTSishly(main/Signals,.c,)
 CompileRTSishly(main/StgOverflow,.c,)
-CompileRTSishly(main/StgStartup,.hc,-mtoggle-sp-mangling/*toggle it back*/)
-CompileRTSishly(main/StgThreads,.hc,-mtoggle-sp-mangling/*toggle it back*/)
-CompileRTSishly(main/StgTrace,.c,)
-CompileRTSishly(main/StgUpdate,.hc,-mtoggle-sp-mangling/*toggle it back*/)
+CompileRTSishly(main/StgStartup,.hc,-optc-DIN_GHC_RTS=1)
+CompileRTSishly(main/StgThreads,.hc,-optc-DIN_GHC_RTS=1)
+CompileRTSishly(main/StgUpdate,.hc,-optc-DIN_GHC_RTS=1)
 CompileRTSishly(main/Threads,.c,)
+CompileRTSishly(main/RtsFlags,.c,)
 CompileRTSishly(main/main,.c,)
 CompileRTSishly(profiling/CostCentre,.c,)
 CompileRTSishly(profiling/Hashing,.c,)
 CompileRTSishly(profiling/HeapProfile,.c,)
 CompileRTSishly(profiling/Indexing,.c,)
-CompileRTSishly(profiling/LifeProfile,.c,)
 CompileRTSishly(profiling/Timer,.c,)
 CompileRTSishly(prims/PrimArith,.c,)
 CompileRTSishly(prims/PrimMisc,.c,)
-CompileRTSishly(storage/Force_GC,.c,)
 CompileRTSishly(storage/SM1s,.c,)
 CompileRTSishly(storage/SM2s,.c,)
 CompileRTSishly(storage/SMap,.c,)
@@ -505,7 +417,7 @@ CompileRTSishly(storage/SMevac,.c,)
 CompileRTSishly(storage/SMextn,.c,)
 CompileRTSishly(storage/SMgen,.c,)
 CompileRTSishly(storage/SMinit,.c,)
-CompileRTSishly(storage/SMmark,.hc,-optc-DMARK_REG_MAP)
+CompileRTSishly(storage/SMmark,.hc,-optc-DIN_GHC_RTS=1 -optc-DMARK_REG_MAP)
 CompileRTSishly(storage/SMmarking,.c,)
 CompileRTSishly(storage/SMscan,.c,)
 CompileRTSishly(storage/SMscav,.c,)
@@ -524,11 +436,5 @@ ClearTagsFile()
 /* this is not the way we should do this [WDP [lazy] 94/09] */
 CTagsTarget( $(RTS_LC) $($RTS_LHC) $(CLIB_LC) )
 CTagsTarget( gmp/[a-z]*.c )
-CTagsTarget( regex/[a-z]*.c )
 
 CDependTarget( $(RTS_LC) $($RTS_LHC) $(CLIB_LC) )
-
-LitStuffNeededHere(docs depend)
-InfoStuffNeededHere(docs)
-
-/*LitDocRootTargetWithNamedOutput(threadroot,lit,threadroot-standalone)*/