Fix build with Solaris sed
[ghc-hetmet.git] / utils / ghc-cabal / ghc.mk
index b4b599d..f495048 100644 (file)
@@ -21,6 +21,10 @@ CABAL_CONSTRAINT := --constraint="Cabal == $(CABAL_DOTTED_VERSION)"
 $(GHC_CABAL_INPLACE) : $(GHC_CABAL_DIR)/dist/build/tmp/ghc-cabal$(exeext) | $$(dir $$@)/.
        "$(CP)" $< $@
 
+$(GHC_CABAL_DIR)/dist/build/tmp/ghc-cabal$(exeext): $(wildcard libraries/Cabal/Distribution/*/*/*.hs)
+$(GHC_CABAL_DIR)/dist/build/tmp/ghc-cabal$(exeext): $(wildcard libraries/Cabal/Distribution/*/*.hs)
+$(GHC_CABAL_DIR)/dist/build/tmp/ghc-cabal$(exeext): $(wildcard libraries/Cabal/Distribution/*.hs)
+
 $(GHC_CABAL_DIR)/dist/build/tmp/ghc-cabal$(exeext): $(GHC_CABAL_DIR)/ghc-cabal.hs | $$(dir $$@)/. bootstrapping/.
        "$(GHC)" $(SRC_HC_OPTS) --make $(GHC_CABAL_DIR)/ghc-cabal.hs -o $@ \
               -Wall $(WERROR) \
@@ -75,9 +79,11 @@ $(GHC_CABAL_DIR)/dist-dummy-ghc/build/dummy-ghc.hs : $(GHC_CABAL_DIR)/ghc.mk $(M
 #   ( "PostfixOperators", ...
 # then it translates them into
 #   ["PostfixOperators"] ++
+# Tabs are a pain to handle portably with sed, so rather than worrying
+# about them we just use tr to remove them all before we start.
        echo 'extensions :: [String]'                                     >> $@
        echo 'extensions ='                                               >> $@
-       sed '/^xFlags/,/]/{/^  (/{s/^[^"]*"/  ["/; s/"[^"]*$$/"] ++/; p}}; d' compiler/main/DynFlags.hs >> $@
+       '$(TR)' -d '\t' < compiler/main/DynFlags.hs | '$(SED)' '/^xFlags/,/]/s/^ *( *\("[^"]*"\)[^"]*/  [\1] ++/p;d' >> $@
        echo '  []'                                                       >> $@
 
 # We don't build dummy-ghc with Cabal, so we need to pass -package