aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: e432c8637866a35e5fcfd2d8ec1f51b05011363d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
all: build

clean:
	@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 'clear && make build-and-launch-server --silent' &

watch-elm:
	@./node_modules/nodemon/bin/nodemon.js -e elm --exec 'clear && 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 || true

build-elm:
	@elm make src/client/elm/Main.elm --output public/javascripts/client.js || true

build-js:
	@cp src/client/js/main.js public/javascripts/main.js || true