@@ -13,6 +13,7 @@ module BNFC.Backend.FSharp (makeFSharp) where
1313import System.FilePath (pathSeparator , (</>) )
1414
1515import BNFC.Backend.Base (MkFiles , mkfile )
16+ import BNFC.Backend.Common.Makefile
1617import BNFC.Backend.FSharp.CFtoFSharpAbs
1718import BNFC.Backend.FSharp.CFtoFsLex
1819import BNFC.Backend.FSharp.CFtoFSharpPrinter
@@ -22,6 +23,7 @@ import BNFC.Backend.FSharp.CFtoFSharpTest (fsharpTestfile)
2223import BNFC.Backend.FSharp.CFtoFsYacc
2324import qualified BNFC.Backend.XML as XML
2425import BNFC.CF
26+ import BNFC.PrettyPrint
2527import BNFC.Options
2628import BNFC.Utils
2729
@@ -93,11 +95,32 @@ makeFSharp opts cf = do
9395 mkfile (tFile opts) comment $ fsharpTestfile absMod lexMod parMod prMod showMod tFileMod cf
9496 mkfile (utilFile opts) comment $ utilM (utilFileM opts)
9597 mkfile (fsprojFile opts) XML. comment $ fsprojM opts
98+ mkMakefile opts $ makefile opts
9699 -- case xml opts of
97100 -- 2 -> makeXML opts True cf
98101 -- 1 -> makeXML opts False cf
99102 -- _ -> return ()
100103
104+ makefile :: SharedOptions -> String -> Doc
105+ makefile opts basename = vcat
106+ [
107+ mkRule " clean" []
108+ [ " -rm -fr bin obj " ]
109+ ,mkRule " distclean" [" clean" ]
110+ [ " -rm -f " ++ unwords [ mkFile withLang " Lex" " *" opts,
111+ mkFile withLang " Par" " *" opts,
112+ mkFile withLang " Layout" " *" opts,
113+ mkFile withLang " Skel" " *" opts,
114+ mkFile withLang " Print" " *" opts,
115+ mkFile withLang " Show" " *" opts,
116+ mkFile withLang " Test" " *" opts,
117+ mkFile withLang " Abs" " *" opts,
118+ mkFile withLang " Test" " " opts,
119+ mkFile withLang " " " fsproj" opts,
120+ utilFile opts,
121+ basename ]]
122+ ]
123+
101124comment :: String -> String
102125comment x = unwords [ " (*" , x, " *)" ]
103126
0 commit comments