[project @ 2002-01-17 08:37:57 by sof]
authorsof <unknown>
Thu, 17 Jan 2002 08:38:00 +0000 (08:38 +0000)
committersof <unknown>
Thu, 17 Jan 2002 08:38:00 +0000 (08:38 +0000)
- removed KludgedSystem; no longer needed.
- be path separator savvy.

ghc/utils/hsc2hs/KludgedSystem.hs [deleted file]
ghc/utils/hsc2hs/Main.hs
ghc/utils/hsc2hs/Makefile

diff --git a/ghc/utils/hsc2hs/KludgedSystem.hs b/ghc/utils/hsc2hs/KludgedSystem.hs
deleted file mode 100644 (file)
index 66e900c..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-{-# OPTIONS -cpp -fglasgow-exts #-}
------------------------------------------------------------------------------
--- $Id: KludgedSystem.hs,v 1.8 2001/07/04 09:18:38 sewardj Exp $
-
--- system that works feasibly under Windows (i.e. passes the command line to sh,
--- because system() under Windows doesn't look at SHELL, and always uses CMD.EXE)
-
-module KludgedSystem (system, defaultCompiler, progNameSuffix) where
-
-#include "../../includes/config.h"
-
-import Config
-
-#ifndef mingw32_TARGET_OS
-
-import System (system)
-
-defaultCompiler :: String
-defaultCompiler = cGCC
-progNameSuffix = ""
-
-#else
-
-import qualified System
-import System    (ExitCode)
-import IO        (bracket_)
-import Directory (removeFile)
-
-system :: String -> IO ExitCode
-system cmd = do
-    pid <- getProcessID
-    let tmp = cDEFAULT_TMPDIR++"/sh"++show pid
-    writeFile tmp (cmd++"\n")
-    bracket_ (return tmp) removeFile $ System.system ("sh - "++tmp)
-
-foreign import "_getpid" unsafe getProcessID :: IO Int
-
-defaultCompiler :: String
-defaultCompiler = cGCC ++ " -mno-cygwin"
-progNameSuffix = ".exe"
-
-#endif /* mingw32_TARGET_OS */
index b81589e..92aad1f 100644 (file)
@@ -1,5 +1,5 @@
 ------------------------------------------------------------------------
--- $Id: Main.hs,v 1.34 2001/09/12 11:52:58 rrt Exp $
+-- $Id: Main.hs,v 1.35 2002/01/17 08:37:57 sof Exp $
 --
 -- Program for converting .hsc files to .hs files, by converting the
 -- file into a C program which is run to generate the Haskell source.
@@ -10,8 +10,8 @@
 -- See the documentation in the Users' Guide for more details.
 
 import GetOpt
-import System        (getProgName, getArgs, ExitCode(..), exitWith, exitFailure)
-import KludgedSystem
+import Config
+import System        (getProgName, getArgs, ExitCode(..), exitWith, exitFailure, system)
 import Directory     (removeFile)
 import Monad         (MonadPlus(..), liftM, liftM2, when, unless)
 import Char          (isAlpha, isAlphaNum, isSpace, isDigit, toUpper, intToDigit, ord)
@@ -449,7 +449,7 @@ output flags name toks = do
         outCName     = outDir++outBase++"_hsc.c"
 
     let execProgName
-            | null outDir = "./"++progName
+            | null outDir = '.':pathSep:progName
             | otherwise   = progName
     
     let specials = [(pos, key, arg) | Special pos key arg <- toks]
@@ -468,7 +468,7 @@ output flags name toks = do
         _   -> onlyOne "compiler"
     
     linker <- case [l | Linker l <- flags] of
-        []  -> return defaultCompiler
+        []  -> return cGCC
         [l] -> return l
         _   -> onlyOne "linker"
     
index c8b2bd7..be10d54 100644 (file)
@@ -1,5 +1,5 @@
 # -----------------------------------------------------------------------------
-# $Id: Makefile,v 1.27 2001/12/26 23:08:07 sof Exp $
+# $Id: Makefile,v 1.28 2002/01/17 08:38:00 sof Exp $
 
 TOP=../..
 include $(TOP)/mk/boilerplate.mk
@@ -86,6 +86,12 @@ $(CONFIG_HS) : $(FPTOOLS_TOP)/mk/config.mk Makefile
        @echo "module Config where" >>$(CONFIG_HS)
        @echo "cDEFAULT_TMPDIR       = \"$(DEFAULT_TMPDIR)\"" >> $(CONFIG_HS)
        @echo "cGCC                  = \"$(WhatGccIsCalled)\"" >> $(CONFIG_HS)
+       @echo "progNameSuffix        = \"$(exeext)\"" >> $(CONFIG_HS)
+ifneq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
+       @echo "pathSep               = '/'" >> $(CONFIG_HS)
+else
+       @echo "pathSep               = '\\\\\\'" >> $(CONFIG_HS)
+endif
        @echo done.
 
 CLEAN_FILES += $(CONFIG_HS)