[project @ 1997-07-31 00:05:10 by sof]
[ghc-hetmet.git] / ghc / compiler / Makefile
index bf652aa..a60d835 100644 (file)
@@ -49,13 +49,7 @@ ifeq ($(GhcWithDeforester),YES)
 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,8 +57,11 @@ 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 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.
@@ -79,9 +76,7 @@ HCS      = $(patsubst %.lhs, %.hc, $(patsubst %.hs, %.hc, $(HS_SRCS)))
 # 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
@@ -133,20 +128,18 @@ SRC_HC_OPTS += \
 
 # -syslib ghc just needed for use of PackedString.hPutPS
 
-
-SRC_CC_OPTS += -Iparser -I.
+SRC_CC_OPTS += -Iparser -I. -I$(TOP)/includes -O
 
 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
 endif
 
 ifeq ($(GhcWithDeforester),NO)
-ifeq "$(Ghc2_0)" "NO"
+ ifeq "$(Ghc2_0)" "NO"
   SRC_MKDEPENDHS_OPTS += -DOMIT_DEFORESTER
-endif
+ endif
 SRC_HC_OPTS += -DOMIT_DEFORESTER
 endif
 
@@ -161,7 +154,7 @@ 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/CmdLineOpts_HC_OPTS       = -fvia-C
 nativeGen/PprMach_HC_OPTS      = -K2m
 nativeGen/MachMisc_HC_OPTS     = -K2m -fvia-C
@@ -184,23 +177,37 @@ 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
+rename/ParseIface_HC_OPTS      += -Onot -H16m
+rename/ParseType_HC_OPTS       += -Onot -H16m
+rename/ParseUnfolding_HC_OPTS  += -Onot -H16m
+ifeq "$(Ghc2_0)" "YES"
+rename/ParseIface_HC_OPTS       += -fno-warn-incomplete-patterns -fno-warn-overlapped-patterns
+rename/ParseType_HC_OPTS        += -fno-warn-incomplete-patterns -fno-warn-overlapped-patterns
+rename/ParseUnfolding_HC_OPTS   += -fno-warn-incomplete-patterns -fno-warn-overlapped-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/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
 utils/SST_HC_OPTS              = -fvia-C
 utils/PrimPacked_HC_OPTS       = -fvia-C -monly-3-regs
@@ -268,41 +275,27 @@ CLEAN_FILES += hsp
 #
 # 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))
+ifeq "$(Ghc2_0)" "NO"
+hi-boot :: $(LOOPS)
 
-else
 %.hi : %.lhi
        $(RM) $@
        $(UNLIT) $<  $@ || ( $(RM) $@ && exit 1 )
        @chmod 444 $@
-endif
 
 boot :: hi-boot
+else
+# hi-boot not needed when using 2.04+ as HC, defining it here
+# to be consistent across setting of Ghc2_0
+hi-boot :
+       @echo "Done."
+endif
 
 #-----------------------------------------------------------------------------
 #              Linking
 
 SRC_LD_OPTS += -no-link-chk
 
-# Build-specific
-#SRC_LD_OPTS += "-pgml time gcc -B/projects/unsupported/gnu/sparc-sunos5/bin/g"
-
-
 #-----------------------------------------------------------------------------
 #              install
 
@@ -331,7 +324,11 @@ depend :: $(LOOPS) $(SRCS_UGNHS) rename/ParseIface.hs rename/ParseUnfolding.hs r
 
 
 ifeq "$(GhcWithHscBuiltViaC)" "YES"
-SRC_MKDEPENDHS_OPTS += -o .hc
+ifeq "$(Ghc2_0)" "NO"
+SRC_MKDEPENDHS_OPTS += -o hc
+else
+SRC_MKDEPENDHS_OPTS += -optdep-o -optdephc
+endif
 # When booting from .hc, (hackily) remove the suffix rule for 
 # .l?hs -> .o, so that the .hc -> .o is used instead.
 %.$(way_)o : %.lhs