X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2FMakefile;h=a89de686032cc544c4ac0665f58064cc455a5438;hb=438596897ebbe25a07e1c82085cfbc5bdb00f09e;hp=af8efc06d95412fd227c06d74c5fa639de56c852;hpb=d5c8ed9758e4bb20406b9b9b2cc0533b38340a6e;p=ghc-hetmet.git diff --git a/ghc/compiler/Makefile b/ghc/compiler/Makefile index af8efc0..a89de68 100644 --- a/ghc/compiler/Makefile +++ b/ghc/compiler/Makefile @@ -1,5 +1,5 @@ # ----------------------------------------------------------------------------- -# $Id: Makefile,v 1.11 1997/03/19 20:44:52 simonpj Exp $ +# $Id: Makefile,v 1.46 1998/12/02 13:17:15 simonm Exp $ TOP = .. include $(TOP)/mk/boilerplate.mk @@ -21,7 +21,22 @@ endif # (included below) to kick in. LIBRARY=libhsp.a -HS_PROG=hsc + +# +# 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$(_way) + + +# ----------------------------------------------------------------------------- +# Compilation history for Patrick + +# Make the sources first, because that's what the compilation history needs +$(HS_PROG) :: $(HS_SRCS) # ----------------------------------------------------------------------------- @@ -37,39 +52,36 @@ DIRS = \ reader profiling parser -ifeq ($(GhcWithDeforester),YES) - DIRS += deforest -endif - ifeq ($(GhcWithNativeCodeGen),YES) - ifeq ($(GhcWithHscBuiltViaC),YES) - # If building via C, we *assume* that it is the distributed C files, - # which do not have a native-code generator in them - else - DIRS += nativeGen - endif +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 \ - main/LoopHack.hc + $(foreach dir,$(DIRS),$(wildcard $(dir)/*.lhs)) + +ifneq "$(GhcWithHscBuiltViaC)" "YES" +HS_SRCS += rename/ParseIface.hs +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. -LOOPS = $(patsubst %.lhi, %.hi, $(wildcard */*.lhi)) -HCS = $(patsubst %.lhs, %.hc, $(patsubst %.hs, %.hc, $(HS_SRCS))) +HCS = $(patsubst %.lhs, %.hc, $(patsubst %.hs, %.hc, $(HS_SRCS))) + +# ParseIface.hs ain't part of HS_SRCS when this is on.. +ifeq "$(GhcWithHscBuiltViaC)" "YES" +HCS += rename/ParseIface.hc +endif HS_OBJS = \ $(patsubst %.hc, %.o, $(HCS)) \ parser/hsclink.o parser/hschooks.o libhsp.a -DESTDIR = $(INSTALL_LIBRARY_DIR_GHC) +DESTDIR = $(INSTALL_LIBRARY_DIR_GHC) SRCS_UGN = $(wildcard parser/*.ugn) SRCS_UGNC = $(patsubst %.ugn, %.c, $(SRCS_UGN)) @@ -86,57 +98,64 @@ 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 + parser/util.o parser/ctypes.o -# # stuff you get for free in a source distribution # -SRC_DIST_FILES += rename/ParseIface.hs \ - rename/ParseType.hs rename/ParseUnfolding.hs \ - parser/U_tree.c parser/tree.h parser/tree.c \ - parser/hsparser.tab.c parser/hsparser.tab.h \ - parser/hslexer.c +# SRC_DIST_FILES += rename/ParseIface.hs \ +# 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 # +# Compiler to use for building hsc, use the build tree +# driver when booting. +# +ifneq "$(GhcWithHscBuiltViaC)" "YES" HC=$(WithGhcHc) +else +HC=$(GHC_DRIVER_DIR)/ghc +endif -SRC_HC_OPTS += \ - -cpp -fhaskell-1.3 -syslib ghc \ - -fglasgow-exts -DCOMPILING_GHC -Rghc-timing -I. -IcodeGen \ - -InativeGen -Iparser $(foreach dir,$(DIRS),-i$(dir)) - -# -syslib ghc just needed for utils/CharSeq.lhs use of PackedString.hPutPS - +# magic from GNU make manual to convert a list of values +# into a colon-separated list +empty:= +space:= $(empty) $(empty) -SRC_CC_OPTS += -Iparser -I. +SRC_HC_OPTS += \ + -cpp -fglasgow-exts -Rghc-timing \ + -I. -IcodeGen -InativeGen -Iparser \ + -i$(subst $(space),:,$(DIRS)) -ifneq ($(Ghc2_0),NO) - SRC_HC_OPTS += -fomit-derived-read -fomit-reexported-instances -endif +SRC_CC_OPTS += -Iparser -I. -I$(TOP)/includes -O -ifeq ($(GhcWithDeforester),NO) - SRC_HC_OPTS += -DOMIT_DEFORESTER -endif - -SRC_HC_OPTS += $(GhcHcOpts) +SRC_HC_OPTS += -recomp $(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 +# Was 6m with 2.10 +absCSyn/PprAbsC_HC_OPTS = -H10m + 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 +main/Constants_HC_OPTS = -DHscIfaceFileVersion=$(HscIfaceFileVersion) + +ifneq "$(GhcWithHscBuiltViaC)" "YES" +ifeq "$(GhcReportCompiles)" "YES" +main/Main_HC_OPTS += -syslib misc -DREPORT_TO_MOTHERLODE +endif +endif + 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"' @@ -148,35 +167,73 @@ 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 = -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 = -K3m -reader/Lex_HC_OPTS = -K2m -H16m -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 -H16m +prelude/PrimOp_HC_OPTS = -H12m -K3m +reader/Lex_HC_OPTS = -K2m -H16m -fvia-C + +# Heap was 6m with 2.10 +reader/ReadPrefix_HC_OPTS = -fvia-C '-\#include"hspincl.h"' -H10m + +rename/ParseIface_HC_OPTS += -Onot -H30m -fno-warn-incomplete-patterns +rename/ParseIface_HAPPY_OPTS += -g + ifeq "$(TARGETPLATFORM)" "hppa1.1-hp-hpux9" rename/RnMonad_HC_OPTS = -fvia-C -O2 -O2-for-C -else -rename/RnMonad_HC_OPTS = -fvia-C endif + rename/RnEnv_HC_OPTS = -fvia-C rename/RnSource_HC_OPTS = -H12m rename/RnIfaces_HC_OPTS = -H8m -fvia-C +rename/RnExpr_HC_OPTS = -H10m rename/RnNames_HC_OPTS = -H12m +rename/RnMonad_HC_OPTS = -fvia-C specialise/Specialise_HC_OPTS = -Onot -H12m -stgSyn/StgSyn_HC_OPTS = -fno-omit-reexported-instances -typecheck/TcMonad_HC_OPTS = -fvia-C +simplCore/Simplify_HC_OPTS = -H15m typecheck/TcGenDeriv_HC_OPTS = -H10m -typecheck/TcExpr_HC_OPTS = -H10m + +# tmp, -- SDM +specialise/Specialise_HC_OPTS += -fno-prune-tydecls + +# Was 10m for 2.10 +typecheck/TcHsSyn_HC_OPTS = -H15m + + +# Was 10m for 2.10 +typecheck/TcExpr_HC_OPTS = -H15m +typecheck/TcBinds_HC_OPTS = -H10m + +typecheck/TcEnv_HC_OPTS = -H10m utils/Argv_HC_OPTS = -fvia-C -utils/CharSeq_HC_OPTS = -fvia-C utils/SST_HC_OPTS = -fvia-C -utils/PrimPacked_HC_OPTS = -fvia-C -monly-3-regs utils/FastString_HC_OPTS = -fvia-C -utils/StringBuffer_HC_OPTS = -fvia-C +utils/StringBuffer_HC_OPTS = -fvia-C -fno-prune-tydecls +utils/Digraph_HC_OPTS = -fglasgow-exts -fvia-C +utils/DirUtils_HC_OPTS = -fvia-C + +ifeq "$(alpha_HOST_ARCH)" "1" +# "stbu" bug in alpha native code generator... +basicTypes/Unique_HC_OPTS = -fvia-C +endif + +# flags for PrimPacked: +# +# -monly-3-regs +# because it contains a 'ccall strlen', which gets inlined by +# gcc, causing a lack of registers. +# +# -optC-funfolding-interface-threshold10 +# To stop the definition of 'strLength', which calls strlen, getting +# into the interface file and spreading the -monly-3-regs virus. +# We need -optC here because the driver before 3.02 didn't understand +# the -funfolding flags. +utils/PrimPacked_HC_OPTS = -fvia-C -monly-3-regs -optC-funfolding-interface-threshold10 + +# 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 @@ -185,19 +242,21 @@ SRC_C_OPTS += -O -Iparser -I. -IcodeGen # ---------------------------------------------------------------------------- -# Parsers +# Parsers/lexers # Main parser uses Yacc/Bison SRC_YACC_OPTS += -d -v +# Suppress the generation of a default rule +SRC_FLEX_OPTS += -s # # Want to keep the intermediate (included in src distribs). # -.PRECIOUS: parser/%.tab.c parser/hslexer.c +.PRECIOUS: %.tab.c %.tab.h parser/hslexer.c parser/hschooks.o : parser/hschooks.c @$(RM) $@ - $(HC) -c -o $@ $(HCFLAGS) parser/hschooks.c + $(HC) -c -o $@ -I$(GHC_INCLUDE_DIR) $(HC_OPTS) parser/hschooks.c # Interface-file parser uses Happy @@ -208,16 +267,6 @@ rename/ParseIface.hs : rename/ParseIface.y $(HAPPY) $(HAPPY_OPTS) -g rename/ParseIface.y @chmod 444 rename/ParseIface.hs -rename/ParseType.hs : rename/ParseType.y - @$(RM) rename/ParseType.hs rename/ParseType.hinfo - $(HAPPY) $(HAPPY_OPTS) -g rename/ParseType.y - @chmod 444 rename/ParseType.hs - -rename/ParseUnfolding.hs : rename/ParseUnfolding.y - @$(RM) rename/ParseUnfolding.hs rename/ParseUnfolding.hinfo - $(HAPPY) $(HAPPY_OPTS) -g rename/ParseUnfolding.y - @chmod 444 rename/ParseUnfolding.hs - #---------------------------------------------------------------------- # # Building the stand-alone parser @@ -228,35 +277,17 @@ hsp: parser/printtree.o parser/main.o libhsp.a $(CC) -o $@ $(CC_OPTS) $^ CLEAN_FILES += hsp -#----------------------------------------------------------------------------- -# Interface files - -# LoopHack.lhc is an SLPJ addition to fix a profiling problem. See comments -# inside it. (compilation is handled by the suffix rules). - -# -# Building the loop breakers from .lhi files -# -ifeq ($(Ghc2_0),YES) - %.hi : %_1_3.lhi - $(RM) $@ - $(UNLIT) $< $@ || ( $(RM) $@ && exit 1 ) - @chmod 444 $@ -else - %.hi : %.lhi - $(RM) $@ - $(UNLIT) $< $@ || ( $(RM) $@ && exit 1 ) - @chmod 444 $@ -endif #----------------------------------------------------------------------------- # Linking SRC_LD_OPTS += -no-link-chk -# Build-specific -#SRC_LD_OPTS += "-pgml time gcc -B/projects/unsupported/gnu/sparc-sunos5/bin/g" - +ifneq "$(GhcWithHscBuiltViaC)" "YES" +ifeq "$(GhcReportCompiles)" "YES" +SRC_LD_OPTS += -syslib misc -syslib exts +endif +endif #----------------------------------------------------------------------------- # install @@ -270,35 +301,15 @@ INSTALL_LIBEXECS += hsc hsp #----------------------------------------------------------------------------- # depend -# If we're using a 1.2 compiler to compile the compiler, need the old mkdepend stuff -# -# ToDo: define sep MKDEPENDHS_1.2 variable so that it can be readily overridden -# in a build.mk file. -# -ifeq ($(Ghc2_0),NO) -MKDEPENDHS = $(MKDEPENDHS_1_2) -endif - # # Before doing `make depend', need to build all derived Haskell source files # -depend :: $(LOOPS) $(SRCS_UGNHS) rename/ParseIface.hs rename/ParseUnfolding.hs rename/ParseType.hs +depend :: $(LOOPS) $(SRCS_UGNHS) -ifeq ($(GhcWithDeforester),NO) - SRC_MKDEPENDHS_OPTS += -DOMIT_DEFORESTER +ifneq "$(GhcWithHscBuiltViaC)" "YES" +depend :: rename/ParseIface.hs endif -ifeq ($(Ghc2_0),YES) -SRC_MKDEPENDHS_OPTS += $(SRC_HC_OPTS) -endif - -ifeq ($(GhcWithHscBuiltViaC),YES) - SRC_MKDEPENDHS_OPTS += -o .hc -else - SRCS_MKDEPENDHS = $(SRCS_HC) # should add $(LOOPS) ? -endif - - #----------------------------------------------------------------------------- # clean @@ -312,16 +323,18 @@ MAINTAINER_CLEAN_FILES += $(wildcard */*.hc) #----------------------------------------------------------------------------- -# TAGS +# TAGS setup SRC_HSTAGS_OPTS += -fglasgow-exts -cpp - +TAGS_HS_SRCS=$(foreach dir,$(DIRS),$(wildcard $(dir)/*.lhs)) +TAGS_C_SRCS=$(strip $(foreach f,$(foreach dir,$(DIRS),$(wildcard $(dir)/*.c)),$(shell if [ -w $(f) ]; then echo $(f); else echo ''; fi))) #----------------------------------------------------------------------------- # Include target-rule boilerplate include $(TOP)/mk/target.mk + # # Special extra dependencies for yukky ugen stuff #