From 27e11b20b06f2f2dbfb56c0998a63169b4b8abc4 Mon Sep 17 00:00:00 2001 From: Joris Date: Wed, 8 Nov 2017 23:47:26 +0100 Subject: Use a better project structure --- Makefile | 57 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 28 insertions(+), 29 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 5d695f2..c8bb7ce 100644 --- a/Makefile +++ b/Makefile @@ -1,50 +1,49 @@ start: - @nix-shell --command "tmuxinator local" + @nix-shell tools.nix --command "tmuxinator local" stop: @tmux kill-session -t sharedCost dist: - @nix-shell --command "make clean install build" + @nix-shell tools.nix --command "make clean install build" -clean: clean-server clean-client -install: install-server install-client -build: build-server build-client +clean: clean-client clean-server +install: install-client install-server +build: build-client build-server -# Server +# Client # ------ -clean-server: - @cabal clean +build-client: + @nix-shell -A shells.ghcjs --run "build-client-inside" -install-server: - @cabal2nix --shell . > sharedCost.nix +build-client-inside: + @cabal --project-file=cabal-client.project --builddir=dist-client new-build all && make cp-client -build-server: - @nix-shell sharedCost.nix --command "cabal build" +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 -launch-server: - @killall sharedCost || : - @cabal run sharedCost +clean-client: + @rm -rf dist-client -watch-server: - @nodemon --watch src/server -e hs,conf --exec '(clear && make build-server && make launch-server) || :' +watch-client: + @nix-shell -A shells.ghcjs --run "nodemon --watch client --watch common --ext hs --exec '(clear && make build-client-inside) || true'" -# Client +# Server # ------ -clean-client: - @rm -rf reflex-platform +clean-server: + @rm -rf dist-server -install-client: - @git clone https://github.com/reflex-frp/reflex-platform 2>/dev/null || : - @cd reflex-platform && ./try-reflex --command exit >/dev/null +build-server: + @nix-shell -A shells.ghc --run "make build-server-inside" -build-client-inside: - @cd src/client && ghcjs -Wall -Werror --make Main && mv Main.jsexe/all.js ../../public/javascript/main.js +build-server-inside: + @cabal --project-file=cabal-server.project --builddir=dist-server new-build all -build-client: - @./reflex-platform/try-reflex --command "make build-client-inside" +run-server: + @(killall sharedCost &>/dev/null) || : + @./dist-server/build/x86_64-linux/ghc-8.0.2/server-0.0.1/c/server/build/server/server -watch-client: - @./reflex-platform/try-reflex --command "nodemon --watch src/client -e hs --exec '(clear && make build-client-inside) || true'" +watch-server: + @nix-shell -A shells.ghc --run "nodemon --watch server --watch common --ext hs --exec '(clear && make build-server-inside && make run-server) || :'" -- cgit v1.2.3