summaryrefslogtreecommitdiff
path: root/chip/make
diff options
context:
space:
mode:
Diffstat (limited to 'chip/make')
-rwxr-xr-xchip/make25
1 files changed, 13 insertions, 12 deletions
diff --git a/chip/make b/chip/make
index d221dfa..439cf46 100755
--- a/chip/make
+++ b/chip/make
@@ -5,10 +5,10 @@
{-# OPTIONS_GHC -Wall #-}
{-
--- TODO: rewrite this in using shake
--- [ ] https://hackage.haskell.org/package/shake-0.17.7/docs/Development-Shake.html
--- [ ] make it optionally run the built program too, like entr
--- [ ] generate tags each time it's rebuilt
+TODO: rewrite this in using shake
+- [ ] https://hackage.haskell.org/package/shake-0.17.7/docs/Development-Shake.html
+- [ ] make it optionally run the built program too, like entr
+- [ ] generate tags each time it's rebuilt
-}
module Main where
@@ -29,9 +29,8 @@ data Notify = Notify
, wait :: IO ()
}
--- | Skip channel to model concurrency semantics
--- This ensures that we don't execute more than one command
--- at a time.
+-- | skip channel to model concurrency semantics. this ensures that we don't
+-- execute more than one command at a time.
initNotify :: IO Notify
initNotify = do
mvar <- newMVar ()
@@ -43,7 +42,7 @@ main :: IO ()
main = do
(app, act) <- parseArgs <$> getArgs
case act of
- Watch -> do
+ Rise -> do
inotify <- initINotify
Notify {..} <- initNotify
dirs <- nub . concat <$> mapM getDirs ["aero", "apex", "lore"]
@@ -64,14 +63,14 @@ say = putStrLn
nop :: SomeException -> IO ()
nop _ = pure ()
-data Action = Make | Watch
+data Action = Make | Rise
parseArgs :: [String] -> (App, Action)
-parseArgs [] = errorWithoutStackTrace "usage: chip/make <app> [watch]"
-parseArgs (name:act:_) =
+parseArgs [] = errorWithoutStackTrace "usage: chip/make [make|rise] <app>"
+parseArgs (act:name:_) =
( App (lowercase name) (capitalize name)
, case lowercase act of
- "watch" -> Watch
+ "rise" -> Rise
_ -> Make
)
parseArgs (name:_) = (App (lowercase name) (capitalize name), Make)
@@ -90,6 +89,7 @@ data App = App
ghcopts :: String
ghcopts = "-odir bild/ -hidir bild/ -Wall"
+-- | compile with ghc.
apex :: App -> IO ()
apex App {..} = callCommand $ intercalate " "
[ "ghc"
@@ -100,6 +100,7 @@ apex App {..} = callCommand $ intercalate " "
, "-o bild/" ++ name
]
+-- | compile with ghcjs.
aero :: App -> IO ()
aero App {..} = callCommand $ intercalate " "
[ "ghcjs"