[project @ 2001-11-06 11:05:22 by simonmar]
authorsimonmar <unknown>
Tue, 6 Nov 2001 11:05:23 +0000 (11:05 +0000)
committersimonmar <unknown>
Tue, 6 Nov 2001 11:05:23 +0000 (11:05 +0000)
Make compilation of javaGen conditional on $(GhcWithJavaGen) in the
same way as the ILX and native backends.

ghc/compiler/Makefile
ghc/compiler/main/CodeOutput.lhs

index 001c99b..a03cfb6 100644 (file)
@@ -1,5 +1,5 @@
 # -----------------------------------------------------------------------------
-# $Id: Makefile,v 1.196 2001/11/03 01:44:04 sof Exp $
+# $Id: Makefile,v 1.197 2001/11/06 11:05:22 simonmar Exp $
 
 TOP = ..
 include $(TOP)/mk/boilerplate.mk
@@ -90,7 +90,7 @@ CLEAN_FILES += $(CONFIG_HS)
 DIRS = \
   utils basicTypes types hsSyn prelude rename typecheck deSugar coreSyn \
   specialise simplCore stranal stgSyn simplStg codeGen absCSyn main \
-  profiling parser usageSP cprAnalysis javaGen compMan
+  profiling parser usageSP cprAnalysis compMan
 
 ifeq ($(GhcWithNativeCodeGen),YES)
 DIRS += nativeGen
@@ -103,6 +103,11 @@ DIRS += ilxGen
 SRC_HC_OPTS += -DILX
 endif
 
+ifeq ($(GhcWithJavaGen),YES)
+DIRS += javaGen
+SRC_HC_OPTS += -DJAVA
+endif
+
 #
 # Canonicalize the GHC version number - assume it is has the form x.yy.[z] or 
 # x.yy[.date] where date = yyyymmdd
index 4f569c7..95401ce 100644 (file)
@@ -17,8 +17,10 @@ import AsmCodeGen    ( nativeCodeGen )
 import IlxGen          ( ilxGen )
 #endif
 
+#ifdef JAVA
 import JavaGen         ( javaGen )
 import qualified PrintJava
+#endif
 
 import DriverState     ( v_HCHeader )
 import TyCon           ( TyCon )
@@ -73,8 +75,13 @@ codeOutput dflags mod_name tycons core_binds stg_binds
                               >> return stub_names
              HscC           -> outputC dflags filenm flat_abstractC stub_names
                               >> return stub_names
-             HscJava        -> outputJava dflags filenm mod_name tycons core_binds
+             HscJava        -> 
+#ifdef JAVA
+                              outputJava dflags filenm mod_name tycons core_binds
                               >> return stub_names
+#else
+                               panic "Java support not compiled into this ghc"
+#endif
             HscILX         -> 
 #ifdef ILX
                               outputIlx dflags filenm mod_name tycons stg_binds
@@ -147,6 +154,7 @@ outputAsm dflags filenm flat_absC
 %************************************************************************
 
 \begin{code}
+#ifdef JAVA
 outputJava dflags filenm mod tycons core_binds
   = doOutput filenm (\ f -> printForUser f alwaysQualify pp_java)
        -- User style printing for now to keep indentation
@@ -155,6 +163,7 @@ outputJava dflags filenm mod tycons core_binds
        -- Make sure we have up to date dead-var information
     java_code = javaGen mod [{- Should be imports-}] tycons occ_anal_binds
     pp_java   = PrintJava.compilationUnit java_code
+#endif
 \end{code}