Commit d97a2fb2 authored by Bernd Brassel's avatar Bernd Brassel
Browse files

prophecy binary can be built with cabal

parent 2d16ba5d
......@@ -13,11 +13,12 @@ Description: This package contains the debugger for the Curry to Haskell compi
Stability: experimental
extra-source-files:
Curry/Module/*.hs.include
Data-Dir: Curry/Module/.curry
Data-Dir: prophecy/Curry/Module/.curry
Data-Files: *.fcy
*.fint
Library
hs-source-dirs: oracle
Build-Depends:
base == 4.1.*,
KiCS >= 0.9.0
......@@ -25,8 +26,8 @@ Library
Curry.Module.CEventOracle
Curry.Module.EventOracle
Curry.Module.Oracle
install-includes: coracle.h
c-sources: coracle.c
install-includes: oracle/coracle.h
c-sources: oracle/coracle.c
Executable prophecy
main-is: Main.hs
......
......@@ -2,7 +2,6 @@ module Main where
import System.FilePath
import Data.List
import Monad
import Distribution.Simple
import Distribution.Simple.Setup as SS
......@@ -69,7 +68,7 @@ runKics lbi infile outfile verb = do
["flat"]
if not (isSuffixOf "Transform.curry" infile)
then call kics ["-nomake","-o",outfile,infile]
else call kics ["-nomake","-executable","prophecy","-o",outfile,infile]
else call kics ["-v","3","-nomake","-executable","prophecy","-o",outfile,infile]
......
......@@ -61,14 +61,15 @@ compile opts = do
newOpts <- getFlatCurryFileName opts
old <- notUptodate newOpts
if old || force opts || executable opts
-- possible improvement: generate only Main.hs if up-to-date
-- possible improvement: generate only Main.hs if up-to-date
-- (but note that main module transformed differently with executable)
then process newOpts >>= makeImports
else skip newOpts >>= makeImports
process :: Options -> Safe IO (String,[String],Options)
process opts0@(Opts{filename=fn}) = do
prog <- safeReadFlat opts0 (replaceExtension fn ".fcy")
unless (executable opts0)
unless (executable opts0 && fn=="Request")
(put 1 opts0 ("processing: "++progName prog))
opts <- readExternalSpec opts0 fn
unless (null $ extData opts)
......@@ -99,7 +100,7 @@ makeImports :: (String,[String],Options) -> Safe IO Options
makeImports (name,imps,opts@(Opts{filename=fn})) = do
if (make opts)
then do
impOpts <- foldCompile imps opts{binary=Nothing}
impOpts <- foldCompile imps opts{binary=Nothing,target=Nothing}
return impOpts{done=name : done impOpts}
else return opts{done=name : done opts}
......@@ -162,8 +163,7 @@ generateHaskellFiles opts (globals,prog,interfaces,auxNames) = do
mapM (writeProgram opts) modules
return (haskellFiles opts (progName prog))
writeProgram opts (fn,unqualified,prog) = do
let filename = destination (fn/="Main.hs") (target opts) fn
writeProgram opts (filename,unqualified,prog) = do
put 3 opts ("writing "++ filename)
let printOpts = defaultPrintOptions{unqual=unqualified,
include=snd (toInclude opts),
......@@ -213,8 +213,9 @@ haskellFiles opts name = [funcHsName name]
-- if the executable flag is set in the options
-- introduce Modules CallTime/RunTimeChoice
transform typeMapping aux opts0 (Prog name imports types funcs _)
= (if executable opts then [(mainFileName,False,mainModule)] else [])
++ modules
= (if executable opts
then [(destination False Nothing mainFileName,False,mainModule)]
else []) ++ modules
where
opts = opts0{hasData=hasInternalData}
......@@ -223,7 +224,10 @@ transform typeMapping aux opts0 (Prog name imports types funcs _)
modules = [allinclusiveProg]
-- filename, flag and module definitions
allinclusiveProg = (funcHsName (filename opts),False,allinclusive)
allinclusiveProg =
(destination True (target opts) (funcHsName (filename opts)),
False,
allinclusive)
modul mName mImports mExports mTypes mInsts mFuncs =
......
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