-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
+#
+# 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