diff --git a/ghc/docs/users_guide/utils.sgml b/ghc/docs/users_guide/utils.sgml index 8b97c19f1501477685086a48004d29747614d9a7..633a7796ded133380a1e1f5e19d49fd9ea2cc83b 100644 --- a/ghc/docs/users_guide/utils.sgml +++ b/ghc/docs/users_guide/utils.sgml @@ -214,16 +214,6 @@ tags: </listitem> </varlistentry> - <varlistentry> - <term><literal>-s FILE</literal> or - <literal>--support=FILE</literal></term> - <listitem> - <para>Basename of the C file and C header - (with <literal>.c</literal>, <literal>.h</literal> - suffixes removed).</para> - </listitem> - </varlistentry> - <varlistentry> <term><literal>--help</literal></term> <listitem> @@ -240,22 +230,22 @@ tags: </variablelist> <para>The input file should end with .hsc. Output files by - default get names with the <literal>*.hsc</literal> pattern + default get names with the <literal>.hsc</literal> suffix replaced:</para> <informaltable> <tgroup cols=2> <tbody> <row> - <entry><literal>*.hs</literal></entry> + <entry><literal>.hs</literal></entry> <entry>Haskell file</entry> </row> <row> - <entry><literal>Hs*.h</literal></entry> + <entry><literal>_hsc.h</literal></entry> <entry>C header</entry> </row> <row> - <entry><literal>Hs*.c</literal></entry> + <entry><literal>_hsc.c</literal></entry> <entry>C file</entry> </row> </tbody> diff --git a/ghc/lib/std/Makefile b/ghc/lib/std/Makefile index a34ea3c929104e9de6d767748cf3c4a7a3f3e6fc..ccb63f66da109816ec679109643c648587de3bd4 100644 --- a/ghc/lib/std/Makefile +++ b/ghc/lib/std/Makefile @@ -92,9 +92,9 @@ endif CLEAN_FILES += PrelGHC.hi $(foreach way, $(WAYS), PrelGHC.$(way)_hi) CLEAN_FILES += \ - $(patsubst %.hsc, %.hs, $(HSC_SRCS)) \ - $(patsubst %.hsc, Hs%.c, $(HSC_SRCS)) \ - $(patsubst %.hsc, Hs%.h, $(HSC_SRCS)) + $(patsubst %.hsc, %.hs, $(HSC_SRCS)) \ + $(patsubst %.hsc, %_hsc.c, $(HSC_SRCS)) \ + $(patsubst %.hsc, %_hsc.h, $(HSC_SRCS)) #----------------------------------------------------------------------------- # Installation; need to install .hi files as well as libraries diff --git a/ghc/utils/hsc2hs/Main.hs b/ghc/utils/hsc2hs/Main.hs index 6c046306192c2588fb80684ba380be4235a32795..b888f3344c08d7f3d5bb756de44c7f3cf92cbb51 100644 --- a/ghc/utils/hsc2hs/Main.hs +++ b/ghc/utils/hsc2hs/Main.hs @@ -1,5 +1,5 @@ ------------------------------------------------------------------------ --- $Id: Main.hs,v 1.28 2001/03/29 08:03:21 qrczak Exp $ +-- $Id: Main.hs,v 1.29 2001/03/29 17:56:18 qrczak 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. @@ -32,7 +32,6 @@ data Flag | Include String | Define String (Maybe String) | Output String - | Support String include :: String -> Flag include s@('\"':_) = Include s @@ -53,11 +52,10 @@ options = [ Option "I" [] (ReqArg (CompFlag . ("-I"++)) "DIR") "passed to the C compiler", Option "L" ["lflag"] (ReqArg LinkFlag "FLAG") "flag to pass to the linker", - Option "" ["no-compile"] (NoArg NoCompile) "stop after writing *_make.c", + Option "" ["no-compile"] (NoArg NoCompile) "stop after writing *_hsc_make.c", Option "i" ["include"] (ReqArg include "FILE") "as if placed in the source", Option "D" ["define"] (ReqArg define "NAME[=VALUE]") "as if placed in the source", Option "o" ["output"] (ReqArg Output "FILE") "name of main output file", - Option "s" ["support"] (ReqArg Support "FILE") "basename of support output files (with .h, .c removed)", Option "" ["help"] (NoArg Help) "display this help and exit", Option "" ["version"] (NoArg Version) "output version information and exit"] @@ -415,35 +413,30 @@ splitExt name = output :: [Flag] -> String -> [Token] -> IO () output flags name toks = do - let (dir, file) = splitName name - (base, ext) = splitExt file - (outName, outDir, outBase) <- case [f | Output f <- flags] of [] | not (null ext) && last ext == 'c' -> return (dir++base++init ext, dir, base) | ext == ".hs" -> return (dir++base++"_out.hs", dir, base) | otherwise -> return (dir++base++".hs", dir, base) + where + (dir, file) = splitName name + (base, ext) = splitExt file [f] -> let - (dir', file') = splitName f - (base', _) = splitExt file' - in return (f, dir', base') + (dir, file) = splitName f + (base, _) = splitExt file + in return (f, dir, base) _ -> onlyOne "output file" - supportDirBase <- case [f | Support f <- flags] of - [] -> return (outDir++"Hs"++outBase) - [f] -> return f - _ -> onlyOne "support file" - - let cProgName = outDir++outBase++"_make.c" - oProgName = outDir++outBase++"_make.o" - progName = outDir++outBase++"_make" - outHName = supportDirBase++".h" - outCName = supportDirBase++".c" + let cProgName = outDir++outBase++"_hsc_make.c" + oProgName = outDir++outBase++"_hsc_make.o" + progName = outDir++outBase++"_hsc_make" + outHName = outDir++outBase++"_hsc.h" + outCName = outDir++outBase++"_hsc.c" let execProgName - | null dir = "./"++progName - | otherwise = progName + | null outDir = "./"++progName + | otherwise = progName let specials = [(pos, key, arg) | Special pos key arg <- toks] diff --git a/mk/suffix.mk b/mk/suffix.mk index 94b04565bc03f7b2445c58457e48fa0b872297a7..1cff9c8231b9b2a7c6fe3681483ebb5d97322fc6 100644 --- a/mk/suffix.mk +++ b/mk/suffix.mk @@ -112,7 +112,7 @@ endif # BootingViaC #----------------------------------------------------------------------------- # hsc2hs Suffix Rules # -Hs%.c Hs%.h %.hs : %.hsc +%_hsc.c %_hsc.h %.hs : %.hsc $(HSC2HS) $< #-----------------------------------------------------------------------------