X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2FMakefile;h=0bb394c3854a4219865657074072740f12b97ec1;hb=33939049908879995854acac39c3c85e250d1f9a;hp=ab85305970e40a4f7dfc6d5c7636629310e9d82c;hpb=3d37e764cac9ae910762cc4a0707a7c77fc0a008;p=ghc-hetmet.git diff --git a/ghc/compiler/Makefile b/ghc/compiler/Makefile index ab85305..0bb394c 100644 --- a/ghc/compiler/Makefile +++ b/ghc/compiler/Makefile @@ -1,11 +1,12 @@ # ----------------------------------------------------------------------------- +# $Id: Makefile,v 1.38 1998/04/16 10:04:12 sof Exp $ TOP = .. include $(TOP)/mk/boilerplate.mk #----------------------------------------------------------------------------- # Building hsc different ways (default is just `normal' sequential) -override WAYS=$(GhcCompilerWays) +WAYS=$(GhcCompilerWays) #----------------------------------------------------------------------------- # Set SUBDIRS @@ -32,6 +33,13 @@ HS_PROG=hsc # ----------------------------------------------------------------------------- +# Compilation history for Patrick + +# Make the sources first, because that's what the compilation history needs +$(HS_PROG) :: $(HS_SRCS) + + +# ----------------------------------------------------------------------------- # Set SRCS, LOOPS, HCS, OBJS # # First figure out DIRS, the source sub-directories @@ -44,18 +52,8 @@ 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 - SRC_MKDEPENDHS_OPTS += -DOMIT_NATIVE_CODEGEN - else - DIRS += nativeGen - endif +DIRS += nativeGen else SRC_HC_OPTS += -DOMIT_NATIVE_CODEGEN endif @@ -63,35 +61,20 @@ endif HS_SRCS = $(SRCS_UGNHS) \ $(foreach dir,$(DIRS),$(wildcard $(dir)/*.lhs)) \ - rename/ParseIface.hs rename/ParseType.hs rename/ParseUnfolding.hs \ - main/LoopHack.hc + rename/ParseIface.hs # 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" -LOOPS_HS = $(wildcard */*Loop*.hs) -MKDEPENDHS_SRCS = $(HS_SRCS) -#HS_SRCS += $(LOOPS_HS) -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) +DESTDIR = $(INSTALL_LIBRARY_DIR_GHC) SRCS_UGN = $(wildcard parser/*.ugn) SRCS_UGNC = $(patsubst %.ugn, %.c, $(SRCS_UGN)) @@ -114,7 +97,6 @@ LIBOBJS = \ # 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 @@ -122,49 +104,47 @@ SRC_DIST_FILES += rename/ParseIface.hs \ # ----------------------------------------------------------------------------- # 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) - -SRC_HC_OPTS += \ - -cpp -fhaskell-1.3 \ - -fglasgow-exts -DCOMPILING_GHC -Rghc-timing -I. -IcodeGen \ - -InativeGen -Iparser $(foreach dir,$(DIRS),-i$(dir)) - -# -syslib ghc just needed for use of PackedString.hPutPS - - -SRC_CC_OPTS += -Iparser -I. - -ifeq "$(Ghc2_0)" "NO" -SRC_HC_OPTS += -fomit-derived-read -fomit-reexported-instances else -# Recompilation checking - unconditionally so (ToDo: move to mk/config.mk.in) -SRC_HC_OPTS += -recomp +HC=$(GHC_DRIVER_DIR)/ghc endif -ifeq ($(GhcWithDeforester),NO) -ifeq "$(Ghc2_0)" "NO" - SRC_MKDEPENDHS_OPTS += -DOMIT_DEFORESTER -endif -SRC_HC_OPTS += -DOMIT_DEFORESTER -endif +# magic from GNU make manual to convert a list of values +# into a colon-separated list +empty:= +space:= $(empty) $(empty) -SRC_HC_OPTS += $(GhcHcOpts) +SRC_HC_OPTS += \ + -cpp -fglasgow-exts -Rghc-timing \ + -I. -IcodeGen -InativeGen -Iparser \ + -i$(subst $(space),:,$(DIRS)) + +SRC_CC_OPTS += -Iparser -I. -I$(TOP)/includes -O + +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 +absCSyn/CStrings_HC_OPTS = -monly-3-regs + +# 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/Main_HC_OPTS = -fvia-C -DPROJECTVERSION=$(GhcProjectVersion) +main/MkIface_HC_OPTS = -DPROJECTVERSION=$(GhcProjectVersionInt) 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"' @@ -176,44 +156,49 @@ 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 -fvia-C -ifeq "$(Ghc2_0)" "NO" -reader/Lex_HC_OPTS += -fomit-derived-read -endif -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 -DPROJECTVERSION=$(GhcProjectVersionInt) + +# 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 -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/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/TcGenDeriv_HC_OPTS = -H10m -typecheck/TcExpr_HC_OPTS = -H10m + +# Was 10m for 2.10 +typecheck/TcHsSyn_HC_OPTS = -H15m + +# Was 10m for 2.10 +typecheck/TcExpr_HC_OPTS = -H15m + typecheck/TcEnv_HC_OPTS = -H10m -ifeq "$(Ghc2_0)" "NO" -typecheck/TcMonad_HC_OPTS = -fvia-C -endif -utils/Argv_HC_OPTS = -fvia-C +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 -utils/StringBuffer_HC_OPTS = -fvia-C +utils/FastString_HC_OPTS = -fvia-C -monly-3-regs +utils/StringBuffer_HC_OPTS = -fvia-C -fno-prune-tydecls utils/Digraph_HC_OPTS = -fglasgow-exts -fvia-C +utils/Outputable_HC_OPTS = -monly-3-regs +# 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 @@ -222,10 +207,12 @@ 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). @@ -245,16 +232,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 @@ -265,50 +242,12 @@ 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 (0.2x) or .hi-boot (2.xx) files -# -ifeq ($(Ghc2_0),YES) - -BOOT_HI_STEMS = $(basename $(wildcard */*.hi-boot)) - -hi-boot :: - @for n in $(BOOT_HI_STEMS); \ - do \ - echo Creating $$n.hi ; \ - $(RM) $$n.hi ; \ - $(CP) $$n.hi-boot $$n.hi || ( $(RM) $$n.hi && exit 1 ) ; \ - done -# -# Have the collector *Loop.hs interface files be generated just after having -# created the .hi's from the .hi-boot's. - -hi-boot :: $(patsubst %.hs,%.hi,$(LOOPS_HS)) - -else -%.hi : %.lhi - $(RM) $@ - $(UNLIT) $< $@ || ( $(RM) $@ && exit 1 ) - @chmod 444 $@ -endif - -boot :: hi-boot #----------------------------------------------------------------------------- # Linking SRC_LD_OPTS += -no-link-chk -# Build-specific -#SRC_LD_OPTS += "-pgml time gcc -B/projects/unsupported/gnu/sparc-sunos5/bin/g" - - #----------------------------------------------------------------------------- # install @@ -321,31 +260,10 @@ 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 - - -ifeq "$(GhcWithHscBuiltViaC)" "YES" -SRC_MKDEPENDHS_OPTS += -o .hc -# When booting from .hc, (hackily) remove the suffix rule for -# .l?hs -> .o, so that the .hc -> .o is used instead. -%.$(way_)o : %.lhs -%.$(way_)o : %.hs -else - SRCS_MKDEPENDHS = $(SRCS_HC) # should add $(LOOPS) ? -endif - +depend :: $(LOOPS) $(SRCS_UGNHS) rename/ParseIface.hs #----------------------------------------------------------------------------- # clean @@ -360,10 +278,11 @@ 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