don't clean ghc-inplace when cleaning stages other than 1
[ghc-hetmet.git] / ghc / compiler / Makefile
index 2b5252a..0c877ce 100644 (file)
@@ -408,7 +408,7 @@ SRC_HC_OPTS += -DGHCI -package template-haskell
 PKG_DEPENDS += template-haskell
 
 # Use threaded RTS with GHCi, so threads don't get blocked at the prompt.
-# SRC_HC_OPTS += -threaded
+SRC_HC_OPTS += -threaded
 
 ALL_DIRS += ghci
 
@@ -557,11 +557,14 @@ ifeq "$(bootstrapped)" "YES"
 utils/Binary_HC_OPTS           = -funbox-strict-fields
 endif
 
-# BinIface and Binary take ages to both compile and run if you don's use -O
+# We always optimise some low-level modules, otherwise performance of
+# a non-optimised compiler is severely affected.
 main/BinIface_HC_OPTS          += -O
 utils/Binary_HC_OPTS           += -O
 utils/FastMutInt_HC_OPTS       += -O
-
+utils/Encoding_HC_OPTS         += -O
+utils/StringBuffer_HC_OPTS     += -O
+utils/FastString_HC_OPTS       += -O
 
 # ---- Profiling ----
 #simplCore/Simplify_HC_OPTS = -auto-all
@@ -677,7 +680,11 @@ $(odir)/ghc-inplace : $(HS_PROG)
 ghc-inplace : stage1/ghc-inplace
        $(LN_S) -f $< $@
 
-CLEAN_FILES += $(odir)/ghc-inplace ghc-inplace
+ifeq "$(stage)" "1"
+CLEAN_FILES += ghc-inplace
+endif
+
+CLEAN_FILES += $(odir)/ghc-inplace
 
 #-----------------------------------------------------------------------------
 #              install
@@ -752,6 +759,9 @@ VERSION = $(ProjectVersion)
 PKG_DEPENDS += base haskell98
 PACKAGE_CPP_OPTS += -DPKG_DEPENDS='$(PKG_DEPENDS)'
 
+# Omit Main from the library, the client will want to plug their own Main in
+LIBOBJS = $(filter-out $(odir)/main/Main.o $(odir)/parser/hschooks.o, $(OBJS))
+
 # disable splitting: it won't really help with GHC, and the specialised
 # build system for ghc/compiler isn't set up to handle it.
 SplitObjs = NO