summaryrefslogtreecommitdiff
path: root/chip/make
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2019-08-29 06:21:18 -0700
committerBen Sima <ben@bsima.me>2019-08-29 06:26:16 -0700
commitea1b81977d6c4d60e6c0764477a11dcb232c7b9d (patch)
tree3547f90bf80605e4dcdef3d9a20fa3e288dc76df /chip/make
parent88072d6dc58aa95a83c7ffda8f7c1373b74cd375 (diff)
reorder args to chip/make
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"