Commit 9fc4ebc5 authored by Michael Hanus 's avatar Michael Hanus
Browse files

createmakefile removed since it is available via CPM

parent 37d1e7b2
......@@ -17,7 +17,6 @@ CASS/cass
CASS/cass_worker
cpm/src/CPM.Main
cpns/CPNSD
createmakefile/CreateMakefile
curry2js/Curry2JS
currypp/Main
currypp/ContractWrapper/cwrapper
......
......@@ -45,9 +45,6 @@ make_currydoc: | make_analysis make_CASS \
make_currypp: | make_analysis make_CASS make_currycheck make_verification
@$(MAKE) now_$@
make_optimize: | make_analysis make_CASS
@$(MAKE) now_$@
make_verification: | make_analysis make_CASS make_currycheck
@$(MAKE) now_$@
......
......@@ -31,9 +31,6 @@ Curry Port Name Server (CPNS) which is responsible for managing the
symbolic names assigned to the named sockes and ports on a local machine
(see libraries `NamedSocket` and `Ports` for more details).
`createmakefile`:
A tool to create a simple makefile for a Curry application.
`curry2js`:
A compiler for Curry into JavaScript programs used in the
generation of web user interfaces (WUIs).
......
-----------------------------------------------------------------
--- A tool to create a simple makefile for a Curry application.
---
--- @author Michael Hanus
--- @version February 2017
-----------------------------------------------------------------
module CreateMakefile where
import Distribution ( curryCompiler, installDir
, lookupModuleSourceInLoadPath, stripCurrySuffix )
import FlatCurry.Types ( Prog(..) )
import FlatCurry.Read ( readFlatCurryIntWithImports )
import List ( intercalate, union )
import Sort ( sort )
import System ( exitWith, getArgs )
main :: IO ()
main = do
args <- getArgs
case args of
["-h"] -> printUsage
["--help"] -> printUsage
["-?"] -> printUsage
[mainmod] -> createMake (stripCurrySuffix mainmod) Nothing
[mainmod,target] -> createMake (stripCurrySuffix mainmod) (Just target)
_ -> do putStrLn $ "ERROR: Illegal arguments: " ++ unwords args ++ "\n"
printUsage
exitWith 1
printUsage :: IO ()
printUsage = putStrLn $ unlines
[ "A tool to create a simple makefile for a Curry application"
, ""
, "Usage: curry createmake <main_module_name>\n"
, " or: curry createmake <main_module_name> <makefile>"
]
-- Create a simple makefile for a main module:
createMake :: String -> Maybe String -> IO ()
createMake mainmod target = do
allints <- readFlatCurryIntWithImports mainmod
let allmods = (foldl union [mainmod]
(map (\ (Prog _ imps _ _ _) -> imps) allints))
allsources <- mapIO findSourceFileInLoadPath (filter (/="Prelude") allmods)
(maybe putStr writeFile target)
(showMake mainmod (sort (map replacePakcsLib allsources)))
showMake :: String -> [String] -> String
showMake mainmod sourcefiles =
"# Makefile for main module \""++mainmod++"\":\n\n"++
"CURRYHOME="++installDir++"\n"++
"CURRYLIB=$(CURRYHOME)/lib\n\n"++
"# Source modules:\n" ++
"DEPS = " ++ intercalate " \\\n " sourcefiles ++ "\n\n" ++
".PHONY: all\n"++
"all: "++mainmod++"\n\n"++
mainmod++": $(DEPS)\n"++
"\t# create saved state for top-level function \"main\":\n"++
"\t$(CURRYHOME)/bin/"++curryCompiler++" :l "++mainmod++" :save :q\n\n"++
".PHONY: clean\n"++
"clean:\n\t$(CURRYHOME)/bin/cleancurry\n"
-- add a directory name for a Curry source file by looking up the
-- current load path (CURRYPATH):
findSourceFileInLoadPath :: String -> IO String
findSourceFileInLoadPath modname = do
mbfname <- lookupModuleSourceInLoadPath modname
maybe (error ("Curry file for module \""++modname++"\" not found!"))
(return . dropLocal . snd)
mbfname
where
dropLocal f = if take 2 f == "./" then drop 2 f else f
-- replace CURRY lib directory prefix in a filename by $(CURRYLIB):
replacePakcsLib :: String -> String
replacePakcsLib filename =
let pakcslib = installDir++"/lib"
pllength = length pakcslib
in if take pllength filename == pakcslib
then "$(CURRYLIB)" ++ drop pllength filename
else filename
# Makefile for tool "CreateMakefile"
TOOL = $(BINDIR)/$(CURRYSYSTEM)-createmake
.PHONY: all compile install clean uninstall
all: install
compile: CreateMakefile
install: compile
rm -f $(TOOL)
cd $(BINDIR) && ln -s ../currytools/createmakefile/CreateMakefile $(notdir $(TOOL))
clean:
$(CLEANCURRY)
rm -f CreateMakefile
uninstall: clean
rm -f $(TOOL)
# generate executable for CreateMakefile program
CreateMakefile: CreateMakefile.curry \
$(LIBDIR)/FlatCurry/Types.curry \
$(LIBDIR)/FlatCurry/Files.curry \
$(LIBDIR)/FlatCurry/Read.curry \
$(LIBDIR)/FilePath.curry \
$(LIBDIR)/PropertyFile.curry \
$(LIBDIR)/ReadShowTerm.curry \
$(LIBDIR)/Distribution.curry \
$(LIBDIR)/FileGoodies.curry \
$(LIBDIR)/Global.curry \
$(LIBDIR)/List.curry \
$(LIBDIR)/Maybe.curry \
$(LIBDIR)/Directory.curry \
$(LIBDIR)/IOExts.curry \
$(LIBDIR)/Time.curry \
$(LIBDIR)/Char.curry \
$(LIBDIR)/IO.curry \
$(LIBDIR)/System.curry
# create saved state for top-level function "main":
$(REPL) $(REPL_OPTS) :load CreateMakefile :save :quit
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