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

make completing again

parent 358945ae
......@@ -19,6 +19,8 @@ THIS = ../kics/
ORACLE = $(SRC)oracle/
CPNS = cpns/
WWW = www/
CURRYSUB = .curry/
KICSSUB = $(CURRYSUB).kics/
########################################################
## calls to compilers
......@@ -45,19 +47,22 @@ $(BIN)generate: $(SRC)InstallDir.hs $(SRC)Generate.hs $(SRC)CurryToHaskell.hs $(
$(GHC) $(SRC)Generate.hs -o $(BIN)generate
$(BIN)generate $(SRC)
$(SRC)AutoGenerated1.hs: $(BIN)generate
$(SRC)AutoGenerated2.hs: $(BIN)generate
$(SRC)$(KICSSUB)AutoGenerated1.hs: $(BIN)generate
$(SRC)$(KICSSUB)AutoGenerated2.hs: $(BIN)generate
$(SRC)InstallDir.hs: prerequisites
@echo "module InstallDir where" > $(SRC)InstallDir.hs.tmp
@echo "installDir = \""`pwd`"\"" >> $(SRC)InstallDir.hs.tmp
@echo "ghc_call= \""$(GHCBIN)"\"" >> $(SRC)InstallDir.hs.tmp
@echo "cymake_call= \""$(CYMAKEBIN)"\"" >> $(SRC)InstallDir.hs.tmp
@if cmp -s $(SRC)InstallDir.hs.tmp $(SRC)InstallDir.hs; then \
echo "InstallDir.hs up to date"; rm $(SRC)InstallDir.hs.tmp; \
else \
echo "replacing InstallDir.hs"; mv $(SRC)InstallDir.hs.tmp $(SRC)InstallDir.hs; \
fi
@echo "#!/bin/sh" > $(BIN)parsecurry
@echo $(CYMAKEBIN) $$\@ >> $(BIN)parsecurry
@chmod +x $(BIN)parsecurry
prerequisites:
ifeq (,$(findstring ghc,$(GHCBIN)))
......@@ -78,11 +83,11 @@ $(BIN)makeExternalInterface: $(SRC)InstallDir.hs $(BIN)kicslib
$(KGHC) $(SRC)MakeExternalInterface -o $(BIN)makeExternalInterface
$(BIN)kicsi: $(BIN)kicslib $(SRC)CurryToHaskell.hs $(SRC)kicsi.hs $(SRC)PreTrans.hs
ifeq (,$(filter readline%,$(shell $(GHCBIN)-pkg list readline)))
@echo no readline package found
ifeq (,$(filter readline% editline%,$(shell $(GHCBIN)-pkg list readline)))
@echo neither readline nor editline package found
cp $(SRC)NoReadline.make $(SRC)MyReadline.hs
else
@echo readline package found
@echo readline or editline package found
cp $(SRC)WithReadline.make $(SRC)MyReadline.hs
endif
$(KGHC) $(SRC)kicsi -o $(BIN)kicsi
......@@ -95,7 +100,9 @@ runtime: $(SRC)InstallDir.hs
$(GHC) -fno-cse $(SRC)Curry.hs
.PHONY: libs
libs: $(BIN)kics $(SRC)AutoGenerated1.hs $(SRC)AutoGenerated2.hs runtime $(BIN)makeacy
libs: $(BIN)kics $(SRC)$(KICSSUB)AutoGenerated1.hs $(SRC)$(KICSSUB)AutoGenerated2.hs \
runtime $(BIN)makeacy
$(KICS) $(LIB)All_Libraries
cd $(LIB); ../../bin/makeacy All_Libraries
......@@ -179,5 +186,5 @@ $(DOC)UserManual.html: $(DOC)UserManual.text
pandoc -s --toc UserManual.text -o UserManual.html
$(BIN)makeacy: $(TOOLS)MakeAcy.curry
$(BIN)makeacy: $(TOOLS)MakeAcy.curry $(BIN)kics
$(KICS) -executable -o $(BIN)makeacy -userlibpath $(ORACLE):$(TOOLS) MakeAcy
......@@ -101,6 +101,11 @@ data Options = Opts{ cm :: ChoiceMode,
data ConsUse = DataDef | InstanceDef | FunctionDef deriving (Eq,Show)
cymake_call :: String
cymake_call = unpath [installDir,"bin","parsecurry"]
libpath :: Options -> [String]
libpath opts@Opts{userlibpath=up,kicspath=kp}
= up ++ [unpath [kp,"src","lib",""]]
......@@ -403,7 +408,9 @@ put i Opts{verbosity=j} s | i>j = return ()
readExternalSpec :: Options -> String -> Safe IO Options
readExternalSpec opts p = do
specs <- safeIO $ findFileInPath (externalSpecName p) (libpath opts)
specs <- safeIO $ findFileInPath
(externalSpecName (p `withoutSubdir` currySubdir))
(libpath opts)
if null specs
then return opts
else do
......
......@@ -115,13 +115,13 @@ callFrontend opts@(Opts{filename=givenFile}) = do
unless (null foundSources) (if debug opts
then prophecy opts
else cymake opts)
return opts{filename=if debug opts then dbgModName givenFile else givenFile}
return (if debug opts then opts{filename=dbgModName givenFile} else opts)
getFlatCurryFileName opts@(Opts{filename=basename}) = do
let lib = libpath opts
foundFiles <- safeIO (findFileInPath (replaceExtension basename ".fcy") lib)
foundFile <- warning basename (toPathList lib) foundFiles
let foundBasename = take (length foundFile-4) foundFile
let foundBasename = dropExtensions foundFile
return (opts{filename=foundBasename})
notUptodate opts@(Opts{filename=foundBasename}) = do
......
......@@ -84,7 +84,7 @@ writeKicsFile filename contents = do
onExistingFileDo :: (String -> IO a) -> String -> IO a
onExistingFileDo act fn = do
let filename = fn --(fn `withoutSubdir` kicsSubdir) `withoutSubdir` currySubdir
let filename = fn --(fn `withoutSubdir` kicsSubdir)
putStrLn $ "check " ++ filename
ex <- doesFileExist filename
if ex then act filename
......
......@@ -15,7 +15,7 @@ main = do
else do
safe (startCompilation opts) >>=
maybe (error "error during compilaton") (\_ -> return ())
let call = ghcCall opts{filename="Main.hs"}
let call = ghcCall opts{filename=inKicsSubdir "Main.hs"}
if executable opts
then do
putStrLn ("compiling executable "++target opts)
......
......@@ -95,12 +95,8 @@ getRcVar var = getRcVars [var] >>= return . head
getRcVars :: [String] -> IO [Maybe String]
getRcVars vars = do
rcs <- rcFileContents
return (map (flip myLookup (map (\ (a,b)->(map toLower a,b)) rcs))
return (map (flip lookup (map (\ (a,b)->(map toLower a,b)) rcs))
(map (map toLower) vars))
where
myLookup k = maybe Nothing (\x->if null x then Nothing else Just x) . lookup k
-----------------------------------------------------------
--- finding files in correspondence to compiler load path
......@@ -178,14 +174,13 @@ getLoadPathForFile file = do
let fileDir = dirName file
if curryCompiler == "pakcs" || curryCompiler == "kics" then
do currypath <- getEnviron "CURRYPATH"
maybe (rcErr "Libraries" [])
(\llib -> return (addCurrySubdirs
(fileDir :
let llib = maybe [] splitPath mblib
return (addCurrySubdirs (fileDir :
(if null currypath
then []
else splitPath currypath) ++
splitPath llib ++ syslib)))
mblib
llib ++ syslib))
else error "Distribution.getLoadPathForFile: unknown curryCompiler"
where
addCurrySubdirs = concatMap (\d->[d,addCurrySubdir d])
......@@ -292,11 +287,8 @@ callFrontendWithParams target params progname = do
if isPakcs then
do return (installDir++"/bin/parsecurry")
else
do [mpath,mcall] <- getRcVars ["Frontend","FrontendCall"]
cycall <- maybe (rcErr "frontend call" "") return mcall
cypath <- maybe (rcErr "frontend path" "") return mpath
path <- getLoadPath
return (cypath++"/bin/"++cycall++concatMap (" -i"++) path)
do path <- maybe getLoadPath return (fullPath params)
return (installDir++"/bin/parsecurry"++concatMap (" -i"++) path)
showFrontendTarget FCY = "--flat"
showFrontendTarget FINT = "--flat"
......
......@@ -16,9 +16,6 @@ curryCompilerMinorVersion _ = 9854
installDir :: Result C_String
installDir _ = toCurry (ID.installDir)
frontendCall :: Result C_String
frontendCall _ = toCurry (ID.cymake_call)
curryRuntime :: Result C_String
curryRuntime _ = toCurry "ghc"
......
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