Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move pieces around so the Makefile run is in Start, not System.Make
- Loading branch information
1 parent
dd74553
commit b135af3
Showing
6 changed files
with
42 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
|
||
module Main(main) where | ||
|
||
import Development.Make.Main(main) | ||
import Start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
|
||
module Start(main) where | ||
|
||
import Development.Make.All | ||
import System.Environment | ||
import Development.Shake | ||
import qualified System.Directory as IO | ||
import System.Console.GetOpt | ||
|
||
|
||
main :: IO () | ||
main = do | ||
args <- getArgs | ||
withArgs ("--no-time":args) $ | ||
shakeArgsWith shakeOptions flags $ \opts targets -> do | ||
makefile <- case reverse [x | UseMakefile x <- opts] of | ||
x:_ -> return x | ||
_ -> findMakefile | ||
fmap Just $ runMakefile makefile targets | ||
|
||
|
||
data Flag = UseMakefile FilePath | ||
|
||
flags = [Option "f" ["file","makefile"] (ReqArg (Right . UseMakefile) "FILE") "Read FILE as a makefile."] | ||
|
||
|
||
findMakefile :: IO FilePath | ||
findMakefile = do | ||
b <- IO.doesFileExist "makefile" | ||
if b then return "makefile" else do | ||
b <- IO.doesFileExist "Makefile" | ||
if b then return "Makefile" else | ||
error "Could not find either `makefile' or `Makefile'" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters