aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorJoris2017-11-10 01:23:49 +0100
committerJoris2017-11-10 01:23:49 +0100
commit30f786e277b4ece6a09311de364082691f261ca3 (patch)
tree4604e6714baeb3d653b8fdce99725c0acecd1633 /Makefile
parent27e11b20b06f2f2dbfb56c0998a63169b4b8abc4 (diff)
Minify javascript in dist mode, compress served files with gzip
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile24
1 files changed, 13 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index c8bb7ce..8ece441 100644
--- a/Makefile
+++ b/Makefile
@@ -5,29 +5,31 @@ stop:
@tmux kill-session -t sharedCost
dist:
- @nix-shell tools.nix --command "make clean install build"
+ @nix-build -o result-server -A ghc.server
+ @nix-build -o result-client -A ghcjs.client
+ @nix-shell -p closurecompiler --command 'closure-compiler result-client/bin/client.jsexe/all.js --js_output_file public/javascript/main.js'
-clean: clean-client clean-server
-install: install-client install-server
-build: build-client build-server
+clean: clean-server clean-client
+
+build: build-server build-client cp-client
# Client
# ------
+clean-client:
+ @rm -rf dist-client
+
build-client:
@nix-shell -A shells.ghcjs --run "build-client-inside"
build-client-inside:
- @cabal --project-file=cabal-client.project --builddir=dist-client new-build all && make cp-client
+ @cabal --project-file=cabal-client.project --builddir=dist-client new-build all
cp-client:
@cp dist-client/build/x86_64-linux/ghcjs-0.2.1/client-0.0.1/c/client/build/client/client.jsexe/all.js public/javascript/main.js
-clean-client:
- @rm -rf dist-client
-
watch-client:
- @nix-shell -A shells.ghcjs --run "nodemon --watch client --watch common --ext hs --exec '(clear && make build-client-inside) || true'"
+ @nix-shell -A shells.ghcjs --run "nodemon --watch client --watch common --ext hs --exec '(clear && make build-client-inside && make cp-client) || true'"
# Server
# ------
@@ -42,8 +44,8 @@ build-server-inside:
@cabal --project-file=cabal-server.project --builddir=dist-server new-build all
run-server:
- @(killall sharedCost &>/dev/null) || :
+ @(fuser -k 3000/tcp &>/dev/null) || :
@./dist-server/build/x86_64-linux/ghc-8.0.2/server-0.0.1/c/server/build/server/server
watch-server:
- @nix-shell -A shells.ghc --run "nodemon --watch server --watch common --ext hs --exec '(clear && make build-server-inside && make run-server) || :'"
+ @nix-shell -A shells.ghc --run "nodemon --watch ./server --watch ./common --ext hs --exec '(clear && make build-server-inside && make run-server) || :'"