<commit_before>#-----------------------------------------------------------------------------
# $Id: Makefile,v 1.5 1997/03/17 20:34:59 simonpj Exp $

#  This is the Makefile for the runtime-system stuff.
#  This stuff is written in C (and cannot be written in Haskell).
#
#  Things are organised into exactly one level of subdirs.
#
#  At the moment, there are a few such subdirs:
#	c-as-asm	-- mini-interpreter & register hackery
#	gum		-- GUM-specific stuff
#	main		-- "main", associated startup stuff, & MISC things
#	prims		-- code for primitives that must be written in C
#	profiling	-- cost-centre profiling
#	storage		-- the storage manager(s)
#
#  We create two libraries.  One, libHSrts<tag>.a, is built separately
#  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.

#  Other sorta independent, compile-once subdirs are:

#	gmp		-- GNU multi-precision library (for Integer)

#-----------------------------------------------------------------------------

TOP=..
DoingRTS=YES
include $(TOP)/mk/boilerplate.mk

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

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) $@

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

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

#
# dependencies
#
SRC_HC_OPTS += -I$(GHC_INCLUDE_DIR) $(GCap) $(GC2s) $(GC1s) -O -optc-DIN_GHC_RTS=1 -I$(GHC_RUNTIME_DIR)/storage 

SRC_MKDEPENDC_OPTS += -I$(GHC_INCLUDE_DIR) $(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<commit_msg>[project @ 1997-03-20 11:44:07 by sof] mkdependC updates<commit_after>#-----------------------------------------------------------------------------
# $Id: Makefile,v 1.6 1997/03/20 11:44:07 sof Exp $

#  This is the Makefile for the runtime-system stuff.
#  This stuff is written in C (and cannot be written in Haskell).
#
#  Things are organised into exactly one level of subdirs.
#
#  At the moment, there are a few such subdirs:
#	c-as-asm	-- mini-interpreter & register hackery
#	gum		-- GUM-specific stuff
#	main		-- "main", associated startup stuff, & MISC things
#	prims		-- code for primitives that must be written in C
#	profiling	-- cost-centre profiling
#	storage		-- the storage manager(s)
#
#  We create two libraries.  One, libHSrts<tag>.a, is built separately
#  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.

#  Other sorta independent, compile-once subdirs are:

#	gmp		-- GNU multi-precision library (for Integer)

#-----------------------------------------------------------------------------

TOP=..
DoingRTS=YES
include $(TOP)/mk/boilerplate.mk

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

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) $@

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

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

SRC_HC_OPTS += -I$(GHC_INCLUDE_DIR) $(GCap) $(GC2s) $(GC1s) -O -optc-DIN_GHC_RTS=1 -I$(GHC_RUNTIME_DIR)/storage 

#
# Note: _have_ to drop the -optc prefix for the GC-type opts (e.g. -optc-DGCap), since
# -o<foo> is interpreted by mkdependC as meaning use <foo> as suffix.
#
SRC_MKDEPENDC_OPTS += -I$(GHC_INCLUDE_DIR) $(patsubst -optc%,%,$(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
{'fraction_non_alphanumeric': 0.20685714285714285, 'fraction_numerical': 0.006857142857142857, 'mean_word_length': 2.3797875764402963, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4782707', 'n_tokens_mistral': 4290, 'n_tokens_neox': 4055, 'n_words': 976}