From ff9ba99e722e48c2349111b1b1e08d8bb83ee62c Mon Sep 17 00:00:00 2001 From: krasimir Date: Thu, 30 Apr 2009 07:57:56 +0000 Subject: [PATCH] added new Makefile in the top directory which calls Cabal for compilation --- Makefile | 24 ++++++++++++++++++++++++ lib/resource/Make.hs | 22 ++++++++-------------- lib/resource/Makefile | 2 +- next-lib/src/Make.hs | 22 ++++++++-------------- next-lib/src/Makefile | 6 +++--- 5 files changed, 44 insertions(+), 32 deletions(-) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..aa8b511ee --- /dev/null +++ b/Makefile @@ -0,0 +1,24 @@ +.PHONY: all gf install doc clean sdist lib + +all: gf lib + +dist/setup-config: + runghc Setup.lhs configure + +gf: dist/setup-config + runghc Setup.lhs build + +install: + runghc Setup.lhs install + +doc: + runghc Setup.lhs haddock + +clean: + runghc Setup.lhs clean + +sdist: + runghc Setup.lhs sdist + +lib: + $(MAKE) -C lib/resource clean all diff --git a/lib/resource/Make.hs b/lib/resource/Make.hs index 973e6def1..eff24eb06 100644 --- a/lib/resource/Make.hs +++ b/lib/resource/Make.hs @@ -19,7 +19,7 @@ import System.Exit -- With no argument, lang and api are done, in this order. -- See 'make' below for what is done by which command. -default_gfc = "../../bin/gfc" +default_gf = "../../dist/build/gf/gf" presApiPath = "-path=api:present" @@ -175,21 +175,15 @@ unlexer abstr ls = where unlex lla = maybe "" id $ lookup lla langsCoding --- | Runs the gfc executable with the given arguments. +-- | Runs the gf executable in compile mode with the given arguments. run_gfc :: [String] -> IO () run_gfc args = - do p <- liftM (fromMaybe default_gfc) $ findExecutable "gfc" - env <- getEnvironment - case lookup "GF_LIB_PATH" env of - Nothing -> putStrLn "$GF_LIB_PATH is not set." - Just _ -> - do let args' = filter (not . null) args ++ ["+RTS"] ++ rts_flags ++ ["-RTS"] - cmd = p ++ " " ++ unwords (map showArg args') - putStrLn $ "Running: " ++ cmd - e <- system cmd - case e of - ExitSuccess -> return () - ExitFailure i -> putStrLn $ "gfc exited with exit code: " ++ show i + do let args' = ["-batch","-gf-lib-path=../"] ++ filter (not . null) args ++ ["+RTS"] ++ rts_flags ++ ["-RTS"] + putStrLn $ "Running: " ++ default_gf ++ " " ++ unwords (map showArg args') + e <- rawSystem default_gf args' + case e of + ExitSuccess -> return () + ExitFailure i -> putStrLn $ "gf exited with exit code: " ++ show i where rts_flags = ["-K100M"] showArg arg = "'" ++ arg ++ "'" diff --git a/lib/resource/Makefile b/lib/resource/Makefile index c5cd520d0..7c7d1900f 100644 --- a/lib/resource/Makefile +++ b/lib/resource/Makefile @@ -23,7 +23,7 @@ math: $(RUNMAKE) math compat: - gfc */Compatibility*.gf + gf -batch */Compatibility*.gf cp -p */Compatibility*.gfo ../alltenses/ cp -p */Compatibility*.gfo ../present/ # $(RUNMAKE) present compat diff --git a/next-lib/src/Make.hs b/next-lib/src/Make.hs index 679a99851..63f50afc2 100644 --- a/next-lib/src/Make.hs +++ b/next-lib/src/Make.hs @@ -19,7 +19,7 @@ import System.Exit -- With no argument, lang and api are done, in this order. -- See 'make' below for what is done by which command. -default_gfc = "../../bin/gfc" +default_gf = "../../dist/build/gf/gf" presApiPath = "-path=api:present" presSymbolPath = "-path=.:abstract:present:common:romance:scandinavian" ---- @@ -195,21 +195,15 @@ unlexer abstr ls = where unlex lla = maybe "" id $ lookup lla langsCoding --- | Runs the gfc executable with the given arguments. +-- | Runs the gf executable in compile mode with the given arguments. run_gfc :: [String] -> IO () run_gfc args = - do p <- liftM (fromMaybe default_gfc) $ findExecutable "gfc" - env <- getEnvironment - case lookup "GF_LIB_PATH" env of - Nothing -> putStrLn "$GF_LIB_PATH is not set." - Just _ -> - do let args' = filter (not . null) args ++ ["+RTS"] ++ rts_flags ++ ["-RTS"] - cmd = p ++ " " ++ unwords (map showArg args') - putStrLn $ "Running: " ++ cmd - e <- system cmd - case e of - ExitSuccess -> return () - ExitFailure i -> putStrLn $ "gfc exited with exit code: " ++ show i + do let args' = ["-batch","-gf-lib-path=."] ++ filter (not . null) args ++ ["+RTS"] ++ rts_flags ++ ["-RTS"] + putStrLn $ "Running: " ++ default_gf ++ " " ++ unwords (map showArg args') + e <- rawSystem default_gf args' + case e of + ExitSuccess -> return () + ExitFailure i -> putStrLn $ "gf exited with exit code: " ++ show i where rts_flags = ["-K100M"] showArg arg = "'" ++ arg ++ "'" diff --git a/next-lib/src/Makefile b/next-lib/src/Makefile index 673cb732b..998b11329 100644 --- a/next-lib/src/Makefile +++ b/next-lib/src/Makefile @@ -25,15 +25,15 @@ compat: $(RUNMAKE) present compat prelude: - gfc prelude/*.gf + gf -batch prelude/*.gf cp -p prelude/*.gfo ../prelude constructX: - gfc common/ConstructX.gf + gf -batch common/ConstructX.gf cp -p common/ConstructX.gfo ../prelude MakeStructural: - gfc */MakeStructural*.gf + gf -batch */MakeStructural*.gf cp -p */MakeStructural*.gfo ../present cp -p */MakeStructural*.gfo ../alltenses