<commit_before># -----------------------------------------------------------------------------

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

#-----------------------------------------------------------------------------
# Building hsc different ways (default is just `normal' sequential)
WAYS=$(GhcCompilerWays)

#-----------------------------------------------------------------------------
#		Set SUBDIRS

ifeq ($(IncludeTestDirsInBuild),YES)
  SUBDIRS = tests
endif

# -----------------------------------------------------------------------------
#		Set HS_PROG, LIBRARY
# Setting HS_PROG and LIBRARY causes all targets in target.mk
# (included below) to kick in.

LIBRARY=libhsp.a

#
# Note: there have been reports of people running up against the ARG_MAX limit
# when linking hsc with all its constituent object files. The likely source of 
# the problem is that the environment is a bit too big, so a workaround could
# be to do ` env PATH=$(PATH) make hsc 'to minimise the environment. (or the
# equivalent of `env' if it doesn't exist locally).
#
HS_PROG=hsc


# -----------------------------------------------------------------------------
# 		Set SRCS, LOOPS, HCS, OBJS
#
# First figure out DIRS, the source sub-directories
# Then derive SRCS by looking in them
#

DIRS = \
  utils basicTypes types hsSyn prelude rename typecheck deSugar coreSyn \
  specialise simplCore stranal stgSyn simplStg codeGen absCSyn main \
  reader profiling parser


ifeq ($(GhcWithNativeCodeGen),YES)
DIRS += nativeGen
else
SRC_HC_OPTS += -DOMIT_NATIVE_CODEGEN
endif


HS_SRCS = $(SRCS_UGNHS) \
          $(foreach dir,$(DIRS),$(wildcard $(dir)/*.lhs)) \
	  rename/ParseIface.hs rename/ParseType.hs rename/ParseUnfolding.hs

ifneq "$(Ghc2_0)" "YES"
HS_SRCS += main/LoopHack.hc 
endif

# NB: it's no good to include *.hs in the top-line wildcard, because the .hs files
#     in parser/ may not have been created at that point.


HCS      = $(patsubst %.lhs, %.hc, $(patsubst %.hs, %.hc, $(HS_SRCS)))

#
# When booting using a ghc-2.xx compiler, the loop breakers are actually written in
# Haskell, source stubs just re-exporting info from the various .hi-boot files.
# (Reason: we don't want to fiddle with the imports in the sources). We give them
# the suffix .hs, since they're special and don't fall under the umbrella of $(HS_SRCS)
# always (only when $(Ghc2_0) is equal to YES)
ifeq "$(Ghc2_0)" "YES"
MKDEPENDHS_SRCS = $(HS_SRCS)
else
LOOPS   = $(patsubst %.lhi, %.hi, $(wildcard */*.lhi))
endif
 
HS_OBJS  = \
  $(patsubst %.hc, %.o, $(HCS)) \
  parser/hsclink.o parser/hschooks.o libhsp.a


DESTDIR         = $(INSTALL_LIBRARY_DIR_GHC)

SRCS_UGN      = $(wildcard parser/*.ugn)
SRCS_UGNC     = $(patsubst %.ugn, %.c, $(SRCS_UGN))
SRCS_UGNH     = $(patsubst %.ugn, %.h, $(SRCS_UGN))
SRCS_UGNHS    = $(patsubst parser/%.ugn, parser/U_%.hs, $(SRCS_UGN))
SRCS_UGN_OBJS = $(patsubst %.c, %.o, $(SRCS_UGNC))

#
# Add the generated C files to the C_SRCS, so as to let `depend'
# generate correct dependencies for them.
#
C_SRCS += $(SRCS_UGNC)

LIBOBJS = \
  $(SRCS_UGN_OBJS) parser/hslexer.o parser/hsparser.tab.o \
  parser/id.o parser/infix.o parser/syntax.o parser/type2context.o \
  parser/util.o

#
# stuff you get for free in a source distribution
# 
SRC_DIST_FILES += \
 parser/U_tree.c parser/tree.h parser/tree.c \
 parser/hsparser.tab.c parser/hsparser.tab.h \
 parser/hslexer.c

# -----------------------------------------------------------------------------
# 		Haskell compilations

# Compiler to use for building hsc
#
HC=$(WithGhcHc)

# magic from GNU make manual to convert a list of values
# into a colon-separated list
empty:=
space:= $(empty) $(empty)

SRC_HC_OPTS += \
  -cpp -fglasgow-exts -Rghc-timing \
  -I. -IcodeGen -InativeGen -Iparser \
  -i$(subst $(space),:,$(DIRS))

ifeq "$(Ghc2_0)" "NO"
SRC_HC_OPTS += -fhaskell-1.3
endif

# -syslib ghc just needed for use of PackedString.hPutPS

SRC_CC_OPTS += -Iparser -I. -I$(TOP)/includes -O

ifeq "$(Ghc2_0)" "NO"
SRC_HC_OPTS += -fomit-derived-read -fomit-reexported-instances
else
SRC_HC_OPTS += -recomp
endif

SRC_HC_OPTS += $(GhcHcOpts)

# 	Special flags for particular modules
#	The standard suffix rule for compiling a Haskell file
#	adds these flags to the command line

absCSyn/AbsCSyn_HC_OPTS 	= -fno-omit-reexported-instances
absCSyn/CStrings_HC_OPTS 	= -monly-3-regs
basicTypes/IdInfo_HC_OPTS 	= -K2m
coreSyn/AnnCoreSyn_HC_OPTS 	= -fno-omit-reexported-instances
hsSyn/HsExpr_HC_OPTS 		= -K2m
hsSyn/HsSyn_HC_OPTS 		= -fno-omit-reexported-instances
main/Main_HC_OPTS 		= -fvia-C -DPROJECTVERSION=$(GhcProjectVersion)
main/CmdLineOpts_HC_OPTS 	= -fvia-C
nativeGen/PprMach_HC_OPTS 	= -K2m
nativeGen/MachMisc_HC_OPTS 	= -K2m -fvia-C
nativeGen/MachCode_HC_OPTS 	= -H10m
parser/UgenAll_HC_OPTS 		= -fvia-C '-\#include"hspincl.h"'
parser/UgenUtil_HC_OPTS 	= -fvia-C '-\#include"hspincl.h"'
parser/U_constr_HC_OPTS 	= -fvia-C '-\#include"hspincl.h"'
parser/U_binding_HC_OPTS 	= -fvia-C '-\#include"hspincl.h"'
parser/U_pbinding_HC_OPTS 	= -fvia-C '-\#include"hspincl.h"'
parser/U_entidt_HC_OPTS 	= -fvia-C '-\#include"hspincl.h"'
parser/U_list_HC_OPTS 		= -fvia-C '-\#include"hspincl.h"'
parser/U_literal_HC_OPTS 	= -fvia-C '-\#include"hspincl.h"'
parser/U_maybe_HC_OPTS 		= -fvia-C '-\#include"hspincl.h"'
parser/U_either_HC_OPTS 	= -fvia-C '-\#include"hspincl.h"'
parser/U_qid_HC_OPTS 		= -fvia-C '-\#include"hspincl.h"'
parser/U_tree_HC_OPTS 		= -H12m -fvia-C '-\#include"hspincl.h"'
parser/U_ttype_HC_OPTS 		= -fvia-C '-\#include"hspincl.h"'
prelude/PrimOp_HC_OPTS 		= -H12m -K3m
reader/Lex_HC_OPTS		= -K2m -H16m -fvia-C
reader/ReadPrefix_HC_OPTS 	= -fvia-C '-\#include"hspincl.h"'
rename/ParseIface_HC_OPTS 	+= -Onot -H16m
rename/ParseType_HC_OPTS 	+= -Onot -H16m
rename/ParseUnfolding_HC_OPTS 	+= -Onot -H30m
ifeq "$(Ghc2_0)" "YES"
rename/ParseIface_HC_OPTS       += -fno-warn-incomplete-patterns
rename/ParseType_HC_OPTS        += -fno-warn-incomplete-patterns
rename/ParseUnfolding_HC_OPTS   += -fno-warn-incomplete-patterns
endif

ifeq "$(TARGETPLATFORM)" "hppa1.1-hp-hpux9"
rename/RnMonad_HC_OPTS 		= -fvia-C -O2 -O2-for-C
else
ifeq "$(Ghc2_0)" "NO"
rename/RnMonad_HC_OPTS 		= -fvia-C
endif
endif
rename/RnEnv_HC_OPTS 		= -fvia-C
rename/RnSource_HC_OPTS		= -H12m
rename/RnIfaces_HC_OPTS		= -H8m -fvia-C
rename/RnNames_HC_OPTS		= -H12m
rename/RnMonad_HC_OPTS		= -fvia-C
# Urk!  Really big heap for ParseUnfolding
#rename/ParseUnfolding_HC_OPTS	= -H45m		
specialise/Specialise_HC_OPTS 	= -Onot -H12m
stgSyn/StgSyn_HC_OPTS 		= -fno-omit-reexported-instances
typecheck/TcGenDeriv_HC_OPTS	= -H10m
typecheck/TcHsSyn_HC_OPTS	= -H10m
typecheck/TcExpr_HC_OPTS	= -H10m
typecheck/TcEnv_HC_OPTS		= -H10m
ifeq "$(Ghc2_0)" "NO"
typecheck/TcMonad_HC_OPTS	= -fvia-C	
endif
utils/Argv_HC_OPTS 		= -fvia-C -monly-3-regs
utils/SST_HC_OPTS 		= -fvia-C
utils/PrimPacked_HC_OPTS	= -fvia-C -monly-3-regs
utils/FastString_HC_OPTS	= -fvia-C -monly-3-regs
utils/StringBuffer_HC_OPTS	= -fvia-C
utils/Digraph_HC_OPTS		= -fglasgow-exts -fvia-C
utils/Outputable_HC_OPTS	= -monly-3-regs

# optimiser misbehaving in 0.29, occurrence analyser fails to terminate when
# compiling lib/required/Time.lhs
ifeq "$(Ghc2_0)" "NO"
simplCore/OccurAnal_HC_OPTS	= -Onot
endif

# ----------------------------------------------------------------------------
#		C compilations

SRC_C_OPTS     += -O -Iparser -I. -IcodeGen


# ----------------------------------------------------------------------------
#		Parsers

# Main parser uses Yacc/Bison
SRC_YACC_OPTS  += -d -v
<commit_msg>[project @ 1998-01-01 13:54:20 by simonm] compile simplStg/UpdAnal.lhs with -fno-strictness until the strictness analyser bug is fixed.<commit_after># -----------------------------------------------------------------------------

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

#-----------------------------------------------------------------------------
# Building hsc different ways (default is just `normal' sequential)
WAYS=$(GhcCompilerWays)

#-----------------------------------------------------------------------------
#		Set SUBDIRS

ifeq ($(IncludeTestDirsInBuild),YES)
  SUBDIRS = tests
endif

# -----------------------------------------------------------------------------
#		Set HS_PROG, LIBRARY
# Setting HS_PROG and LIBRARY causes all targets in target.mk
# (included below) to kick in.

LIBRARY=libhsp.a

#
# Note: there have been reports of people running up against the ARG_MAX limit
# when linking hsc with all its constituent object files. The likely source of 
# the problem is that the environment is a bit too big, so a workaround could
# be to do ` env PATH=$(PATH) make hsc 'to minimise the environment. (or the
# equivalent of `env' if it doesn't exist locally).
#
HS_PROG=hsc


# -----------------------------------------------------------------------------
# 		Set SRCS, LOOPS, HCS, OBJS
#
# First figure out DIRS, the source sub-directories
# Then derive SRCS by looking in them
#

DIRS = \
  utils basicTypes types hsSyn prelude rename typecheck deSugar coreSyn \
  specialise simplCore stranal stgSyn simplStg codeGen absCSyn main \
  reader profiling parser


ifeq ($(GhcWithNativeCodeGen),YES)
DIRS += nativeGen
else
SRC_HC_OPTS += -DOMIT_NATIVE_CODEGEN
endif


HS_SRCS = $(SRCS_UGNHS) \
          $(foreach dir,$(DIRS),$(wildcard $(dir)/*.lhs)) \
	  rename/ParseIface.hs rename/ParseType.hs rename/ParseUnfolding.hs

ifneq "$(Ghc2_0)" "YES"
HS_SRCS += main/LoopHack.hc 
endif

# NB: it's no good to include *.hs in the top-line wildcard, because the .hs files
#     in parser/ may not have been created at that point.


HCS      = $(patsubst %.lhs, %.hc, $(patsubst %.hs, %.hc, $(HS_SRCS)))

#
# When booting using a ghc-2.xx compiler, the loop breakers are actually written in
# Haskell, source stubs just re-exporting info from the various .hi-boot files.
# (Reason: we don't want to fiddle with the imports in the sources). We give them
# the suffix .hs, since they're special and don't fall under the umbrella of $(HS_SRCS)
# always (only when $(Ghc2_0) is equal to YES)
ifeq "$(Ghc2_0)" "YES"
MKDEPENDHS_SRCS = $(HS_SRCS)
else
LOOPS   = $(patsubst %.lhi, %.hi, $(wildcard */*.lhi))
endif
 
HS_OBJS  = \
  $(patsubst %.hc, %.o, $(HCS)) \
  parser/hsclink.o parser/hschooks.o libhsp.a


DESTDIR         = $(INSTALL_LIBRARY_DIR_GHC)

SRCS_UGN      = $(wildcard parser/*.ugn)
SRCS_UGNC     = $(patsubst %.ugn, %.c, $(SRCS_UGN))
SRCS_UGNH     = $(patsubst %.ugn, %.h, $(SRCS_UGN))
SRCS_UGNHS    = $(patsubst parser/%.ugn, parser/U_%.hs, $(SRCS_UGN))
SRCS_UGN_OBJS = $(patsubst %.c, %.o, $(SRCS_UGNC))

#
# Add the generated C files to the C_SRCS, so as to let `depend'
# generate correct dependencies for them.
#
C_SRCS += $(SRCS_UGNC)

LIBOBJS = \
  $(SRCS_UGN_OBJS) parser/hslexer.o parser/hsparser.tab.o \
  parser/id.o parser/infix.o parser/syntax.o parser/type2context.o \
  parser/util.o

#
# stuff you get for free in a source distribution
# 
SRC_DIST_FILES += \
 parser/U_tree.c parser/tree.h parser/tree.c \
 parser/hsparser.tab.c parser/hsparser.tab.h \
 parser/hslexer.c

# -----------------------------------------------------------------------------
# 		Haskell compilations

# Compiler to use for building hsc
#
HC=$(WithGhcHc)

# magic from GNU make manual to convert a list of values
# into a colon-separated list
empty:=
space:= $(empty) $(empty)

SRC_HC_OPTS += \
  -cpp -fglasgow-exts -Rghc-timing \
  -I. -IcodeGen -InativeGen -Iparser \
  -i$(subst $(space),:,$(DIRS))

ifeq "$(Ghc2_0)" "NO"
SRC_HC_OPTS += -fhaskell-1.3
endif

# -syslib ghc just needed for use of PackedString.hPutPS

SRC_CC_OPTS += -Iparser -I. -I$(TOP)/includes -O

ifeq "$(Ghc2_0)" "NO"
SRC_HC_OPTS += -fomit-derived-read -fomit-reexported-instances
else
SRC_HC_OPTS += -recomp
endif

SRC_HC_OPTS += $(GhcHcOpts)

# 	Special flags for particular modules
#	The standard suffix rule for compiling a Haskell file
#	adds these flags to the command line

absCSyn/AbsCSyn_HC_OPTS 	= -fno-omit-reexported-instances
absCSyn/CStrings_HC_OPTS 	= -monly-3-regs
basicTypes/IdInfo_HC_OPTS 	= -K2m
coreSyn/AnnCoreSyn_HC_OPTS 	= -fno-omit-reexported-instances
hsSyn/HsExpr_HC_OPTS 		= -K2m
hsSyn/HsSyn_HC_OPTS 		= -fno-omit-reexported-instances
main/Main_HC_OPTS 		= -fvia-C -DPROJECTVERSION=$(GhcProjectVersion)
main/CmdLineOpts_HC_OPTS 	= -fvia-C
nativeGen/PprMach_HC_OPTS 	= -K2m
nativeGen/MachMisc_HC_OPTS 	= -K2m -fvia-C
nativeGen/MachCode_HC_OPTS 	= -H10m
parser/UgenAll_HC_OPTS 		= -fvia-C '-\#include"hspincl.h"'
parser/UgenUtil_HC_OPTS 	= -fvia-C '-\#include"hspincl.h"'
parser/U_constr_HC_OPTS 	= -fvia-C '-\#include"hspincl.h"'
parser/U_binding_HC_OPTS 	= -fvia-C '-\#include"hspincl.h"'
parser/U_pbinding_HC_OPTS 	= -fvia-C '-\#include"hspincl.h"'
parser/U_entidt_HC_OPTS 	= -fvia-C '-\#include"hspincl.h"'
parser/U_list_HC_OPTS 		= -fvia-C '-\#include"hspincl.h"'
parser/U_literal_HC_OPTS 	= -fvia-C '-\#include"hspincl.h"'
parser/U_maybe_HC_OPTS 		= -fvia-C '-\#include"hspincl.h"'
parser/U_either_HC_OPTS 	= -fvia-C '-\#include"hspincl.h"'
parser/U_qid_HC_OPTS 		= -fvia-C '-\#include"hspincl.h"'
parser/U_tree_HC_OPTS 		= -H12m -fvia-C '-\#include"hspincl.h"'
parser/U_ttype_HC_OPTS 		= -fvia-C '-\#include"hspincl.h"'
prelude/PrimOp_HC_OPTS 		= -H12m -K3m
reader/Lex_HC_OPTS		= -K2m -H16m -fvia-C
reader/ReadPrefix_HC_OPTS 	= -fvia-C '-\#include"hspincl.h"'
rename/ParseIface_HC_OPTS 	+= -Onot -H16m
rename/ParseType_HC_OPTS 	+= -Onot -H16m
rename/ParseUnfolding_HC_OPTS 	+= -Onot -H30m
ifeq "$(Ghc2_0)" "YES"
rename/ParseIface_HC_OPTS       += -fno-warn-incomplete-patterns
rename/ParseType_HC_OPTS        += -fno-warn-incomplete-patterns
rename/ParseUnfolding_HC_OPTS   += -fno-warn-incomplete-patterns
endif

ifeq "$(TARGETPLATFORM)" "hppa1.1-hp-hpux9"
rename/RnMonad_HC_OPTS 		= -fvia-C -O2 -O2-for-C
else
ifeq "$(Ghc2_0)" "NO"
rename/RnMonad_HC_OPTS 		= -fvia-C
endif
endif
rename/RnEnv_HC_OPTS 		= -fvia-C
rename/RnSource_HC_OPTS		= -H12m
rename/RnIfaces_HC_OPTS		= -H8m -fvia-C
rename/RnNames_HC_OPTS		= -H12m
rename/RnMonad_HC_OPTS		= -fvia-C
# Urk!  Really big heap for ParseUnfolding
#rename/ParseUnfolding_HC_OPTS	= -H45m		
specialise/Specialise_HC_OPTS 	= -Onot -H12m
stgSyn/StgSyn_HC_OPTS 		= -fno-omit-reexported-instances
typecheck/TcGenDeriv_HC_OPTS	= -H10m
typecheck/TcHsSyn_HC_OPTS	= -H10m
typecheck/TcExpr_HC_OPTS	= -H10m
typecheck/TcEnv_HC_OPTS		= -H10m
ifeq "$(Ghc2_0)" "NO"
typecheck/TcMonad_HC_OPTS	= -fvia-C	
endif
utils/Argv_HC_OPTS 		= -fvia-C -monly-3-regs
utils/SST_HC_OPTS 		= -fvia-C
utils/PrimPacked_HC_OPTS	= -fvia-C -monly-3-regs
utils/FastString_HC_OPTS	= -fvia-C -monly-3-regs
utils/StringBuffer_HC_OPTS	= -fvia-C
utils/Digraph_HC_OPTS		= -fglasgow-exts -fvia-C
utils/Outputable_HC_OPTS	= -monly-3-regs

# optimiser misbehaving in 0.29, occurrence analyser fails to terminate when
# compiling lib/required/Time.lhs
ifeq "$(Ghc2_0)" "NO"
simplCore/OccurAnal_HC_OPTS	= -Onot
endif

# Strictness analyser misbehaving in 2.10, fails to terminate on
# UpdAnal.lhs due to weird recursive datatype.  Bug was exposed by a
# separate bugfix to the fixpoint finder.
simplStg/UpdAnal_HC_OPTS	= -fno-strictness

# ----------------------------------------------------------------------------
#		C compilations

SRC_C_OPTS     += -O -Iparser -I. -IcodeGen


# ----------------------------------------------------------------------------
#		Parsers

# Main parser uses Yacc/Bison
SRC_YACC_OPTS  += -d -v

{'fraction_non_alphanumeric': 0.1992706433967179, 'fraction_numerical': 0.010484501172180255, 'mean_word_length': 2.746523542327397, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6573324', 'n_tokens_mistral': 6419, 'n_tokens_neox': 6090, 'n_words': 1315}