1
0
forked from GitHub/gf-core

more restrictive copying in lib/src/Make.hs to permit partial compilation of libs

This commit is contained in:
aarne
2010-04-05 20:12:02 +00:00
parent 7c7f8112c9
commit aff78019fd

View File

@@ -25,34 +25,35 @@ presApiPath = "-path=api:present"
presSymbolPath = "" -- "-path=.:abstract:present:common:romance:scandinavian" ---- presSymbolPath = "" -- "-path=.:abstract:present:common:romance:scandinavian" ----
-- the languages have long directory names and short ISO codes (3 letters) -- the languages have long directory names and short ISO codes (3 letters)
-- we also give the decodings for postprocessing linearizations, as long as grammars -- we also give the functors implied
-- don't support all flags needed; they are used in tests
langsCoding = [ langsCoding = [
(("arabic", "Ara"),""), (("arabic", "Ara"),""),
(("bulgarian","Bul"),""), (("bulgarian","Bul"),""),
(("catalan", "Cat"),""), (("catalan", "Cat"),"Romance"),
(("danish", "Dan"),""), (("danish", "Dan"),"Scand"),
(("dutch", "Dut"),""), (("dutch", "Dut"),""),
(("english", "Eng"),""), (("english", "Eng"),""),
(("finnish", "Fin"),""), (("finnish", "Fin"),""),
(("french", "Fre"),""), (("french", "Fre"),"Romance"),
(("hindi", "Hin"),"to_devanagari"), (("hindi", "Hin"),""),
(("german", "Ger"),""), (("german", "Ger"),""),
(("interlingua","Ina"),""), (("interlingua","Ina"),""),
(("italian", "Ita"),""), (("italian", "Ita"),"Romance"),
(("latin", "Lat"),""), (("latin", "Lat"),""),
(("norwegian","Nor"),""), (("norwegian","Nor"),"Scand"),
(("polish", "Pol"),""), (("polish", "Pol"),""),
(("romanian", "Ron"),""), (("romanian", "Ron"),""),
(("russian", "Rus"),""), (("russian", "Rus"),""),
(("spanish", "Spa"),""), (("spanish", "Spa"),"Romance"),
(("swedish", "Swe"),""), (("swedish", "Swe"),"Scand"),
(("thai", "Tha"),"to_thai"), (("thai", "Tha"),""),
(("turkish", "Tur"),""), (("turkish", "Tur"),""),
(("urdu", "Urd"),"") (("urdu", "Urd"),"")
] ]
implied (_,lan) = [fun | ((_,la),fun) <- langsCoding, la == lan, fun /= ""]
langs = map fst langsCoding langs = map fst langsCoding
-- languagues for which to compile Lang -- languagues for which to compile Lang
@@ -96,19 +97,23 @@ make xx = do
let optl ls = maybe ls id $ getOptLangs xx let optl ls = maybe ls id $ getOptLangs xx
ifx "lang" $ do ifx "lang" $ do
mapM_ (gfc pres [] . lang) (optl langsLang) let lans = optl langsLang
mapM_ (gfc pres presSymbolPath . symbol) (optl langsAPI) mapM_ (gfc pres [] . lang) lans
copy "*/*.gfo" dir mapM_ (gfc pres presSymbolPath . symbol) lans ---- (optl langsAPI)
copyl lans "*.gfo" dir
ifx "compat" $ do ifx "compat" $ do
mapM_ (gfc pres [] . compat) (optl langsCompat) let lans = optl langsCompat
copy "*/Compatibility*.gfo" dir mapM_ (gfc pres [] . compat) lans
copyld lans "*/Compatibility" ".gfo" dir
ifx "api" $ do ifx "api" $ do
mapM_ (gfc pres presApiPath . try) (optl langsAPI) let lans = optl langsAPI
mapM_ (gfc pres presApiPath . symbolic) (optl langsAPI) mapM_ (gfc pres presApiPath . try) lans
copy "*/*.gfo" dir mapM_ (gfc pres presApiPath . symbolic) lans
copyld lans "api" ".gfo" dir
ifx "minimal" $ do ifx "minimal" $ do
mapM_ (gfcmin presApiPath . syntax) (optl langsMinimal) let lans = optl langsMinimal
copy "api/*.gfo" "../minimal" mapM_ (gfcmin presApiPath . syntax) lans
copyld lans "api" ".gfo" "../minimal"
ifxx "pgf" $ do ifxx "pgf" $ do
run_gfc $ ["-s","--make","--name=langs","--parser=off", run_gfc $ ["-s","--make","--name=langs","--parser=off",
"--output-dir=" ++ dir] "--output-dir=" ++ dir]
@@ -116,10 +121,6 @@ make xx = do
ifxx "test" $ do ifxx "test" $ do
let ls = optl langsTest let ls = optl langsTest
gf (treeb "Lang" ls) $ unwords [dir ++ "/Lang" ++ la ++ ".gfo" | (_,la) <- ls] gf (treeb "Lang" ls) $ unwords [dir ++ "/Lang" ++ la ++ ".gfo" | (_,la) <- ls]
-- use 'make demo'
-- ifxx "demo" $ do
-- let ls = optl langsDemo
-- gf (demos "Demo" ls) $ unwords ["demo/Demo" ++ la ++ ".gf" | (_,la) <- ls]
ifxx "parse" $ do ifxx "parse" $ do
mapM_ (gfc pres [] . parse) (optl langsParse) mapM_ (gfc pres [] . parse) (optl langsParse)
copy "parse/*.gfo parse/oald/*.gfo" dir copy "parse/*.gfo parse/oald/*.gfo" dir
@@ -215,3 +216,21 @@ copy :: String -> String -> IO ()
copy from to = copy from to =
do system $ "cp " ++ from ++ " " ++ to do system $ "cp " ++ from ++ " " ++ to
return () return ()
copyl :: [(String,String)] -> String -> String -> IO ()
copyl lans from to = do
echosystem $ "cp abstract/" ++ from ++ " " ++ to
echosystem $ "cp common/" ++ from ++ " " ++ to
mapM_ (\lan -> echosystem $ "cp */*" ++ lan ++ from ++ " " ++ to)
(map snd lans ++ concatMap implied lans)
return ()
copyld :: [(String,String)] -> String -> String -> String -> IO ()
copyld lans dir from to = do
mapM_ (\lan -> echosystem $ "cp " ++ dir ++ "/*" ++ lan ++ from ++ " " ++ to)
(map snd lans ++ if (dir == "api") then [] else concatMap implied lans)
return ()
echosystem c = do
putStrLn c
system c