aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorJoris2016-07-02 16:26:12 +0200
committerJoris2016-07-02 16:26:12 +0200
commita04ec905da2c6a8640162a0d397e184ea1a8bc78 (patch)
treef77f0a6012d0a2cb2eb0316273d5d13e83815f43 /Makefile
parentba33dfef23d070bfff92d6322808507c1b7d2814 (diff)
downloadbudget-a04ec905da2c6a8640162a0d397e184ea1a8bc78.tar.gz
budget-a04ec905da2c6a8640162a0d397e184ea1a8bc78.tar.bz2
budget-a04ec905da2c6a8640162a0d397e184ea1a8bc78.zip
Use nix to fetch dev tools
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile52
1 files changed, 52 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..0f393fd
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,52 @@
+all: install build
+
+clean:
+ @echo "Cleaning…"
+ @cabal clean > /dev/null
+ @rm -r elm-stuff >/dev/null 2>&1 || true
+ @rm -r node_modules >/dev/null 2>&1 || true
+
+install:
+ cabal2nix --shell . > sharedCost.nix
+ nix-shell sharedCost.nix -I ~ --command 'cabal configure'
+ elm package install
+ npm install
+
+# Watch
+# -----
+
+watch: watch-server watch-elm watch-js
+
+watch-server:
+ ./node_modules/nodemon/bin/nodemon.js -e hs,conf --exec 'make build-and-launch-server --silent'
+
+watch-elm:
+ ./node_modules/nodemon/bin/nodemon.js -e elm --exec 'make build-elm --silent'
+
+watch-js:
+ ./node_modules/nodemon/bin/nodemon.js --watch src/client/js --exec 'make build-js --silent'
+
+# Build and launch
+# ----------------
+
+build-and-launch-server: build-server kill-server launch-server
+
+launch-server:
+ ./dist/build/sharedCost/sharedCost &
+
+kill-server:
+ pkill sharedCost || true
+
+# Build
+# -----
+
+build: build-server build-elm build-js
+
+build-server:
+ cabal build
+
+build-elm:
+ elm make src/client/elm/Main.elm --output public/javascripts/client.js
+
+build-js:
+ cp src/client/js/main.js public/javascripts/main.js