Commit 6e3f9759 authored by sof's avatar sof
Browse files

[project @ 2002-01-17 08:37:57 by sof]

- removed KludgedSystem; no longer needed.
- be path separator savvy.
parent 4e31cae2
{-# 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 */
------------------------------------------------------------------------
-- $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"
......
# -----------------------------------------------------------------------------
# $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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment