[project @ 1996-07-25 20:43:49 by partain]
[ghc-hetmet.git] / ghc / compiler / Jmakefile
index ae3ed27..925f261 100644 (file)
@@ -25,14 +25,19 @@ SUBDIRS = __ghc_compiler_tests_dir
 */
 SuffixRules_flexish()
 SuffixRule_c_o()
-LitSuffixRule(.lprl,.prl) /* for makeSymbolList.prl */
+
+.SUFFIXES: .lhi
+.lhi.hi:
+       $(RM) $@
+       $(GHC_UNLIT) $< $@
+       @chmod 444 $@
 
 /* assume ALL source is in subdirectories one level below
    they don't have Jmakefiles; this Jmakefile controls everything
 */
 
 SUBDIR_LIST = \ /* here they are, colon separated (for mkdependHS) */
-utils:basicTypes:types:hsSyn:prelude:envs:rename:typecheck:deSugar:coreSyn:specialise:simplCore:stranal:stgSyn:simplStg:codeGen:nativeGen:absCSyn:main:reader:profiling:deforest:parser
+utils:basicTypes:types:hsSyn:prelude:rename:typecheck:deSugar:coreSyn:specialise:simplCore:stranal:stgSyn:simplStg:codeGen:nativeGen:absCSyn:main:reader:profiling:deforest:parser
 
 #ifdef MainIncludeDir
 MAIN_INCLUDE_DIR=MainIncludeDir
@@ -225,9 +230,7 @@ stranal/StrictAnal.lhs \
 stranal/SaLib.lhs \
 stranal/SaAbsInt.lhs \
 stranal/WwLib.lhs \
-stranal/WorkWrap.lhs \
-\
-profiling/SCCauto.lhs DEFORESTER_SRCS_LHS
+stranal/WorkWrap.lhs DEFORESTER_SRCS_LHS
 
 #define STG_SRCS_LHS \
 stgSyn/CoreToStg.lhs \
@@ -356,6 +359,28 @@ SIMPL_SRCS_LHS             \
 STG_SRCS_LHS           \
 BACKSRCS_LHS NATIVEGEN_SRCS_LHS
 
+#if GhcBuilderVersion >= 200
+#  define loop_hi(f) CAT3(f,_1_3,.hi)
+#else
+#  define loop_hi(f) CAT2(f,.hi)
+#endif
+
+DELOOP_HIs =                   \
+loop_hi(utils/Ubiq)            \
+loop_hi(absCSyn/AbsCLoop)      \
+loop_hi(basicTypes/IdLoop)     \
+loop_hi(codeGen/CgLoop1)       \
+loop_hi(codeGen/CgLoop2)       \
+loop_hi(deSugar/DsLoop)                \
+loop_hi(hsSyn/HsLoop)          \
+loop_hi(nativeGen/NcgLoop)     \
+loop_hi(prelude/PrelLoop)      \
+loop_hi(rename/RnLoop)         \
+loop_hi(simplCore/SmplLoop)    \
+loop_hi(typecheck/TcMLoop)     \
+loop_hi(typecheck/TcLoop)      \
+loop_hi(types/TyLoop)
+
 /*
 \
 */
@@ -377,9 +402,17 @@ ALLINTS=$(ALLSRCS_LHS:.lhs=.hi) $(ALLSRCS_HS:.hs=.hi)
 #endif
 
 #if GhcWithHscOptimised == YES
-#define __version_sensitive_flags -DUSE_ATTACK_PRAGMAS -fshow-pragma-name-errs -fomit-reexported-instances -fshow-import-specs
+# if GhcBuilderVersion >= 200
+#  define __version_sensitive_flags -O -fshow-import-specs
+# else
+#  define __version_sensitive_flags -O -fshow-import-specs -fomit-derived-read -fomit-reexported-instances
+# endif
 #else
-#define __version_sensitive_flags -fomit-reexported-instances
+# if GhcBuilderVersion >= 200
+#  define __version_sensitive_flags /*none*/
+# else
+#  define __version_sensitive_flags -fomit-derived-read -fomit-reexported-instances
+# endif
 #endif
 
 /* avoid use of AllProjectsHcOpts; then put in HcMaxHeapFlag "by hand" */
@@ -387,8 +420,7 @@ ALLINTS=$(ALLSRCS_LHS:.lhs=.hi) $(ALLSRCS_HS:.hs=.hi)
 #define AllProjectsHcOpts /**/
 
 HC_OPTS = -cpp HcMaxHeapFlag -fhaskell-1.3 -fglasgow-exts -DCOMPILING_GHC \
-       -fomit-derived-read \
-       -I. -i$(SUBDIR_LIST) \
+       -Rghc-timing -I. -i$(SUBDIR_LIST) \
        use_DDEBUG __version_sensitive_flags __omit_ncg_maybe __omit_deforester_flag
 
 #undef __version_sensitive_flags
@@ -416,6 +448,10 @@ HC = $(GHC) /* uses the driver herein */
 
 BuildPgmFromHaskellModules(hsc,$(ALLOBJS) parser/hsclink.o parser/hschooks.o,,libhsp.a)
 
+parser/hschooks.o : parser/hschooks.c
+       $(RM) $@
+       $(HC) -c -o $@ $(HCFLAGS) parser/hschooks.c
+
 #if DoInstallGHCSystem == YES
 MakeDirectories(install, $(INSTLIBDIR_GHC))
 InstallBinaryTarget(hsc,$(INSTLIBDIR_GHC))
@@ -471,39 +507,9 @@ HaskellCompileWithExtraFlags_Recursive(module,isuf,o,-c,extra_flags)
 
 /* OK, here we go: */
 
-utils/Ubiq.hi : utils/Ubiq.lhi
-       $(GHC_UNLIT) utils/Ubiq.lhi utils/Ubiq.hi
-
-absCSyn/AbsCLoop.hi : absCSyn/AbsCLoop.lhi
-       $(GHC_UNLIT) absCSyn/AbsCLoop.lhi absCSyn/AbsCLoop.hi
-basicTypes/IdLoop.hi : basicTypes/IdLoop.lhi
-       $(GHC_UNLIT) basicTypes/IdLoop.lhi basicTypes/IdLoop.hi
-codeGen/CgLoop1.hi : codeGen/CgLoop1.lhi
-       $(GHC_UNLIT) codeGen/CgLoop1.lhi codeGen/CgLoop1.hi
-codeGen/CgLoop2.hi : codeGen/CgLoop2.lhi
-       $(GHC_UNLIT) codeGen/CgLoop2.lhi codeGen/CgLoop2.hi
-deSugar/DsLoop.hi : deSugar/DsLoop.lhi
-       $(GHC_UNLIT) deSugar/DsLoop.lhi deSugar/DsLoop.hi
-hsSyn/HsLoop.hi : hsSyn/HsLoop.lhi
-       $(GHC_UNLIT) hsSyn/HsLoop.lhi hsSyn/HsLoop.hi
-nativeGen/NcgLoop.hi : nativeGen/NcgLoop.lhi
-       $(GHC_UNLIT) nativeGen/NcgLoop.lhi nativeGen/NcgLoop.hi
-prelude/PrelLoop.hi : prelude/PrelLoop.lhi
-       $(GHC_UNLIT) prelude/PrelLoop.lhi prelude/PrelLoop.hi
-rename/RnLoop.hi : rename/RnLoop.lhi
-       $(GHC_UNLIT) rename/RnLoop.lhi rename/RnLoop.hi
-simplCore/SmplLoop.hi : simplCore/SmplLoop.lhi
-       $(GHC_UNLIT) simplCore/SmplLoop.lhi simplCore/SmplLoop.hi
-typecheck/TcMLoop.hi : typecheck/TcMLoop.lhi
-       $(GHC_UNLIT) typecheck/TcMLoop.lhi typecheck/TcMLoop.hi
-typecheck/TcLoop.hi : typecheck/TcLoop.lhi
-       $(GHC_UNLIT) typecheck/TcLoop.lhi typecheck/TcLoop.hi
-types/TyLoop.hi : types/TyLoop.lhi
-       $(GHC_UNLIT) types/TyLoop.lhi types/TyLoop.hi
-
 rename/ParseIface.hs : rename/ParseIface.y
        $(RM) rename/ParseIface.hs rename/ParseIface.hinfo
-       happy -i rename/ParseIface.hinfo rename/ParseIface.y
+       happy -g rename/ParseIface.y
        @chmod 444 rename/ParseIface.hs
 
 compile(absCSyn/AbsCUtils,lhs,)
@@ -517,7 +523,7 @@ compile(absCSyn/AbsCSyn,lhs,if_ghc(-fno-omit-reexported-instances))
 compile(hsSyn/HsBinds,lhs,)
 compile(hsSyn/HsCore,lhs,)
 compile(hsSyn/HsDecls,lhs,)
-compile(hsSyn/HsExpr,lhs,)
+compile(hsSyn/HsExpr,lhs,if_ghc(-K2m))
 compile(hsSyn/HsImpExp,lhs,)
 compile(hsSyn/HsLit,lhs,)
 compile(hsSyn/HsMatches,lhs,)
@@ -591,7 +597,7 @@ compile(nativeGen/AsmRegAlloc,lhs,-I$(COMPINFO_DIR))
 compile(nativeGen/MachCode,lhs,-I$(NATIVEGEN_DIR))
 compile(nativeGen/MachMisc,lhs,-I$(NATIVEGEN_DIR))
 compile(nativeGen/MachRegs,lhs,-I$(NATIVEGEN_DIR))
-compile(nativeGen/PprMach,lhs,-I$(NATIVEGEN_DIR))
+compile(nativeGen/PprMach,lhs,-I$(NATIVEGEN_DIR) if_ghc(-K2m))
 compile(nativeGen/RegAllocInfo,lhs,-I$(NATIVEGEN_DIR))
 compile(nativeGen/Stix,lhs,)
 compile(nativeGen/StixInfo,lhs,)
@@ -608,7 +614,6 @@ compile(prelude/PrimOp,lhs,-K3m -H10m)
 compile(prelude/TysPrim,lhs,)
 compile(prelude/TysWiredIn,lhs,)
 
-compile(profiling/SCCauto,lhs,)
 compile(profiling/SCCfinal,lhs,)
 compile(profiling/CostCentre,lhs,)
 
@@ -617,13 +622,13 @@ compile(reader/PrefixToHs,lhs,)
 compile(reader/ReadPrefix,lhs,if_ghc(-fvia-C -I$(COMPINFO_DIR) -Iparser '-#include"hspincl.h"'))
 compile(reader/RdrHsSyn,lhs,)
 
-compile(rename/ParseIface,hs,)
+compile(rename/ParseIface,hs,-Onot) /* sigh */
 compile(rename/ParseUtils,lhs,)
 compile(rename/RnHsSyn,lhs,)
-compile(rename/RnMonad,lhs,)
+compile(rename/RnMonad,lhs,if_ghc(-fvia-C))
 compile(rename/Rename,lhs,)
 compile(rename/RnNames,lhs,)
-compile(rename/RnSource,lhs,)
+compile(rename/RnSource,lhs,-H12m)
 compile(rename/RnBinds,lhs,)
 compile(rename/RnExpr,lhs,)
 compile(rename/RnIfaces,lhs,)
@@ -672,7 +677,7 @@ compile(deforest/Deforest,lhs,)
 compile(deforest/TreelessForm,lhs,)
 #endif
 
-compile(specialise/Specialise,lhs,)
+compile(specialise/Specialise,lhs,-H12m if_ghc(-Onot)) /* -Onot for compile-space reasons */
 compile(specialise/SpecEnv,lhs,)
 compile(specialise/SpecUtils,lhs,)
 
@@ -702,13 +707,13 @@ compile(typecheck/TcInstDcls,lhs,)
 compile(typecheck/TcInstUtil,lhs,)
 compile(typecheck/TcMatches,lhs,)
 compile(typecheck/TcModule,lhs,)
-compile(typecheck/TcMonad,lhs,)
+compile(typecheck/TcMonad,lhs,if_ghc(-fvia-C))
 compile(typecheck/TcKind,lhs,)
 compile(typecheck/TcType,lhs,)
 compile(typecheck/TcEnv,lhs,)
 compile(typecheck/TcMonoType,lhs,)
 compile(typecheck/TcPat,lhs,)
-compile(typecheck/TcPragmas,lhs,)
+/*compile(typecheck/TcPragmas,lhs,)*/
 compile(typecheck/TcSimplify,lhs,)
 compile(typecheck/TcTyClsDecls,lhs,)
 compile(typecheck/TcTyDecls,lhs,)
@@ -716,7 +721,7 @@ compile(typecheck/Unify,lhs,)
 
 compile(types/Class,lhs,)
 compile(types/Kind,lhs,)
-compile(types/PprType,lhs,)
+compile(types/PprType,lhs,if_ghc26(-Onot)) /* avoid a 0.26 bug */
 compile(types/TyCon,lhs,)
 compile(types/TyVar,lhs,)
 compile(types/Usage,lhs,)
@@ -747,12 +752,10 @@ objs:: $(ALLOBJS)
 /* *** parser ************************************************* */
 
 YACC_OPTS = -d
-CC_OPTS = -Iparser -I. -I$(COMPINFO_DIR) -DUGEN_DEBUG=1 /*-DHSP_DEBUG=1*/ -g
+CC_OPTS = -Iparser -I. -I$(COMPINFO_DIR) /*-DUGEN_DEBUG=1*/ /*-DHSP_DEBUG=1*/
 
 /* add to these on the command line with, e.g., EXTRA_YACC_OPTS=-v */
 
-XCOMM D_DEBUG = -DDEBUG
-
 CPP_DEFINES = $(D_DEBUG)
 
 HSP_SRCS_C =    parser/constr.c                \
@@ -813,26 +816,31 @@ UgenNeededHere(all depend)
 NormalLibraryTarget(hsp,$(HSP_OBJS_O))
 
 /* We need the hsp program for hstags to work! */
-BuildPgmFromCFiles(hsp,parser/printtree.o parser/main.o,,libhsp.a)
+/* BuildPgmFromCFiles(hsp,parser/printtree.o parser/main.o,,libhsp.a) */
 
 #if DoInstallGHCSystem == YES
-MakeDirectories(install, $(INSTLIBDIR_GHC))
-InstallBinaryTarget(hsp,$(INSTLIBDIR_GHC))
+/* MakeDirectories(install, $(INSTLIBDIR_GHC)) */
+/* InstallBinaryTarget(hsp,$(INSTLIBDIR_GHC)) */
 #endif /* DoInstall... */
 
-YaccRunWithExpectMsg(parser/hsparser,14,0)
-
-UgenTarget(parser/constr)
-UgenTarget(parser/binding)
-UgenTarget(parser/pbinding)
-UgenTarget(parser/entidt)
-UgenTarget(parser/list)
-UgenTarget(parser/literal)
-UgenTarget(parser/maybe)
-UgenTarget(parser/either)
-UgenTarget(parser/qid)
-UgenTarget(parser/tree)
-UgenTarget(parser/ttype)
+YaccRunWithExpectMsg(parser/hsparser,12,0)
+
+parser/hslexer.o : parser/hslexer.c parser/hsparser.tab.h
+       $(RM) $@
+       $(CC) $(CFLAGS) -c $<
+       @if [ \( $(@D) != '.' \) -a \( $(@D) != './' \) ] ; then echo mv $(@F) $@ ; mv $(@F) $@ ; else exit 0 ; fi
+
+UgenTarget(parser,constr)
+UgenTarget(parser,binding)
+UgenTarget(parser,pbinding)
+UgenTarget(parser,entidt)
+UgenTarget(parser,list)
+UgenTarget(parser,literal)
+UgenTarget(parser,maybe)
+UgenTarget(parser,either)
+UgenTarget(parser,qid)
+UgenTarget(parser,tree)
+UgenTarget(parser,ttype)
 
 UGENS_C = parser/constr.c      \
        parser/binding.c        \
@@ -875,6 +883,11 @@ compile(parser/U_ttype,hs,$(PARSER_HS_OPTS) '-#include"hspincl.h"')
 
 DEPSRCS = $(ALLSRCS_LHS) $(ALLSRCS_HS)
 
+#if GhcBuilderVersion < 200
+/* this will go away soon enough... (once 1.3 is settled in) */
+MKDEPENDHS = mkdependHS-1.2
+#endif
+
 #if GhcWithHscBuiltViaC == NO
 MKDEPENDHS_OPTS= -I$(MAIN_INCLUDE_DIR) -I$(COMPINFO_DIR) -x HsVersions.h
 #else /* booting from .hc */
@@ -884,6 +897,7 @@ MKDEPENDHS_OPTS= -o .hc -I$(MAIN_INCLUDE_DIR) -I$(COMPINFO_DIR)  -x HsVersions.h
 #if HaskellCompilerType != HC_USE_HC_FILES
     /* otherwise, the dependencies jeopardize our .hc files --
        which are all we have! */
+depend :: $(DELOOP_HIs)
 HaskellDependTarget( $(DEPSRCS) )
 #endif