# -----------------------------------------------------------------------------
-# $Id: Makefile,v 1.210 2002/02/12 15:17:13 simonmar Exp $
+# $Id: Makefile,v 1.211 2002/02/13 20:14:42 sof Exp $
TOP = ..
# into main/ (where it'll be compiled and linked with the compiler)
# (the Haskell-side code is ifdefed into main/SysTools.lhs)
-ifneq "$(bootstrapped)" "YES"
+ifeq "$(bootstrapped)/$(ghc_502_at_least)" "NO/NO"
SRC_CC_OPTS += -I$(GHC_LIB_DIR)/std/cbits
SRC_MKDEPENDC_OPTS += -I$(GHC_LIB_DIR)/std/cbits
ALL_SRCS += main/rawSystem.c
main/rawSystem.c : $(FPTOOLS_TOP)/hslibs/lang/cbits/rawSystem.c
- $(CP) $< main
+ $(CP) $< main/
else
EXCLUDED_SRCS = main/rawSystem.c
endif
-- use the line below when we can be sure of compiling with GHC >=
-- 5.02, and remove the implementation of rawSystem at the end of this
-- file
-#if __GLASGOW_HASKELL__ >= 503
+# if __GLASGOW_HASKELL__ >= 503
import GHC.IOBase
-#else
+# else
import PrelIOBase -- this can be removed when SystemExts is used
-#endif
-import CError ( throwErrnoIfMinus1 ) -- as can this
--- import SystemExts ( rawSystem )
+# endif
+import SystemExts ( rawSystem )
#else
+import CError ( throwErrnoIfMinus1 ) -- as can this
import System ( system )
#endif
}
#if defined(mingw32_TARGET_OS)
-foreign import stdcall "GetTempPathA" getTempPath :: Int -> CString -> IO Int32
+foreign import stdcall "GetTempPathA" unsafe getTempPath :: Int -> CString -> IO Int32
#endif
\end{code}
return (Just (reverse (dropList "/bin/ghc.exe" (reverse (unDosifyPath s)))))
-foreign import stdcall "GetModuleFileNameA" getModuleFileName :: Addr -> CString -> Int -> IO Int32
+foreign import stdcall "GetModuleFileNameA" unsafe getModuleFileName :: Addr -> CString -> Int -> IO Int32
#else
getExecDir :: IO (Maybe String) = do return Nothing
#endif
#ifdef mingw32_TARGET_OS
-foreign import "_getpid" getProcessID :: IO Int -- relies on Int == Int32 on Windows
+foreign import "_getpid" unsafe getProcessID :: IO Int -- relies on Int == Int32 on Windows
#else
getProcessID :: IO Int
getProcessID = Posix.getProcessID
#endif
+#if defined(mingw32_TARGET_OS) && (__GLASGOW_HASKELL__ <= 408)
rawSystem :: String -> IO ExitCode
-#if __GLASGOW_HASKELL__ > 408
rawSystem "" = ioException (IOError Nothing InvalidArgument "rawSystem" "null command" Nothing)
rawSystem cmd =
withCString cmd $ \s -> do
n -> return (ExitFailure n)
foreign import ccall "rawSystemCmd" unsafe primRawSystem :: CString -> IO Int
-#else
-rawSystem = System.system
#endif