diff options
| author | aarne <aarne@chalmers.se> | 2010-04-12 20:10:48 +0000 |
|---|---|---|
| committer | aarne <aarne@chalmers.se> | 2010-04-12 20:10:48 +0000 |
| commit | 0b224424a6ea4bbcd68830599e863d3e0b922424 (patch) | |
| tree | b57ad36db94cc15cc66bdbfc0e2ec65932934cb5 /examples/phrasebook/Compile.hs | |
| parent | 24d2acf097b029abf1cba87d3debc6488534c88f (diff) | |
a module to compile Phrasebook in different lang combinations
Diffstat (limited to 'examples/phrasebook/Compile.hs')
| -rw-r--r-- | examples/phrasebook/Compile.hs | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/examples/phrasebook/Compile.hs b/examples/phrasebook/Compile.hs new file mode 100644 index 000000000..9f8dd391f --- /dev/null +++ b/examples/phrasebook/Compile.hs @@ -0,0 +1,38 @@ +import List +import System + +-- (c) Aarne Ranta 2010 under GNU LGPL + +-- Compile files into pgf, in chosen combinations. + +-- Usage: runghc Compile (-make | -link)? Eng Fre Fin ... +-- The -make option links all pgf files to one in the end +-- The -link option only links, without first compiling +-- Arguments whose length are 3 characters are prefixed with mainmodu. +-- Other arguments are passed literally. + +-- Thus, for instance, to produce an English-Swedish-Romanian phrasebook with English +-- disambiguation, the command is +-- +-- runghc Compile -link Eng Swe Ron DisambPhrasebookEng + + +-- change this to apply to another project; alternatively, just use full file names +mainmodu = "Phrasebook" + +main = do + (opts,langs) <- getArgs >>= return . partition ((=='-') . head) + let modus = [mkFile la | la <- langs] + putStrLn $ unwords modus + if notElem "-link" opts + then mapM_ compileOne modus >> return () + else return () + case opts of + _ | elem "-make" opts || elem "makeonly" opts -> do + system $ "gf -make " ++ unwords (map (++ ".pgf") modus) + return () + _ -> return () + +compileOne modu = system $ "gf -make -name=" ++ modu ++ " " ++ modu ++ ".gf" + +mkFile la = if length la == 3 then mainmodu ++ la else la |
