.PHONY: all node-deps clean run TARGET=public/elm.js SOURCE=src/App.elm ELM_FILES = $(shell find src -type f -name '*.elm') NODE_BIN = ./node_modules/.bin ELM = $(NODE_BIN)/elm ELM_LIVE = $(NODE_BIN)/elm-live ELMMAKE_FLAGS = ifeq ($(DEBUG),1) ELMMAKE_FLAGS += --debug endif all: node-deps $(TARGET) node-deps: npm i $(TARGET): $(ELM_FILES) $(ELM) make $(ELMMAKE_FLAGS) $(SOURCE) --output $@ clean-deps: rm -rf elm-stuff rm -rf node_modules clean: rm -f $(TARGET) rm -rf elm-stuff/build-artifacts run: all PATH="$(NODE_BIN):$$PATH" $(ELM_LIVE) $(SOURCE) --dir public --open -- $(ELMMAKE_FLAGS) --output $(TARGET)