Improve the makefile

This commit is contained in:
Correl Roush 2018-04-02 10:17:49 -04:00
parent 2c5a347467
commit 00e19eff2d
3 changed files with 32 additions and 6 deletions

View file

@ -1,7 +1,21 @@
all: elm
.PHONY: all elm elm-test riichi riichi-test test clean
all: elm riichi
elm:
$(MAKE) $(MAKE_FLAGS) --directory priv
elm-test:
riichi:
rebar3 compile
elm-test:
$(MAKE) test $(MAKE_FLAGS) --directory priv
test: elm-test
rebar3 eunit
clean:
$(MAKE) clean $(MAKE_FLAGS) --directory priv

View file

@ -1,12 +1,19 @@
.PHONY: all node-deps clean run
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
current_dir := $(notdir $(patsubst %/,%,$(dir $(mkfile_path))))
TARGET = js/riichi.js
SOURCE = src/Riichi.elm
CSS = css/riichi.css
CSS_SOURCE = src/Stylesheets.elm
ELM_FILES = $(shell find . -type f -name '*.elm')
PATH := ./node_modules/.bin:$(PATH)
NODE_PATH := $(abspath ./node_modules/.bin)
ELM-MAKE := $(NODE_PATH)/elm-make
ELM-REACTOR := $(NODE_PATH)/elm-reactor
ELM-TEST := $(NODE_PATH)/elm-test
ELM-CSS := $(NODE_PATH)/elm-css
ELMMAKE_FLAGS = --yes --warn
@ -20,18 +27,22 @@ node-deps:
npm i
$(TARGET): $(ELM_FILES)
elm-make $(ELMMAKE_FLAGS) src/Riichi.elm --output=$@
$(ELM-MAKE) $(ELMMAKE_FLAGS) src/Riichi.elm --output=$@
$(CSS): $(CSS_SOURCE)
elm-css $(CSS_SOURCE) -o css
@PATH=$(NODE_PATH):$(PATH) $(ELM-CSS) $(CSS_SOURCE) -o css
clean-deps:
rm -rf elm-stuff
rm -rf node_modules
test:
@PATH=$(NODE_PATH):$(PATH) $(ELM-TEST)
clean:
rm -f $(TARGET) $(CSS)
rm -rf elm-stuff/build-artifacts
run: all
elm-reactor
$(ELM-REACTOR)

View file

@ -3,6 +3,7 @@
"version": "1.0.0",
"dependencies": {
"elm": "0.18",
"elm-css": "0.6.1"
"elm-css": "0.6.1",
"elm-test": "^0.18.9"
}
}