ROOT=$(shell pwd) BACKEND_ASSETS_DIR=backend/resources/public/compiled TARGET_CSS_DIR=$(BACKEND_ASSETS_DIR)/css TARGET_CSS_FILE=$(TARGET_CSS_DIR)/style.css LIVE_CSS_DIR=frontend/compiled/css LIVE_CSS_FILE=$(LIVE_CSS_DIR)/style.css TARGET_JS_DIR=$(BACKEND_ASSETS_DIR)/js TARGET_JS_FILE=$(TARGET_JS_DIR)/app.js SOURCE_ELM_FILES=$(wildcard frontend/src/*.elm) SOURCE_SASS_FILE=frontend/assets/sass/style.scss INDEX_FILE=backend/resources/public/index.html .PHONY: compile compile: $(TARGET_JS_FILE) $(TARGET_CSS_FILE) $(TARGET_JS_FILE): $(SOURCE_ELM_FILES) mkdir -p $(TARGET_JS_DIR) cd frontend && elm make src/Main.elm --output $(ROOT)/$(TARGET_JS_FILE) --optimize $(TARGET_CSS_FILE): $(SOURCE_SASS_FILE) mkdir -p $(TARGET_CSS_DIR) sassc --style compressed $(SOURCE_SASS_FILE) > $(TARGET_CSS_FILE) $(LIVE_CSS_FILE): $(SOURCE_SASS_FILE) mkdir -p $(LIVE_CSS_DIR) sassc $(SOURCE_SASS_FILE) > $(LIVE_CSS_FILE) .PHONY: compile-debug compile-debug: cd frontend && elm make src/Main.elm --output $(ROOT)/$(APP_JS) --debug sassc $(SOURCE_SASS_FILE) > $(TARGET_CSS_FILE) .PHONY: elm-live elm-live: cd frontend && \ elm-live src/Main.elm \ --pushstate \ --start-page=../$(INDEX_FILE) \ -- \ --debug \ --output=compiled/js/app.js .PHONE: sass-live sass-live: while sleep 1; do make -s $(LIVE_CSS_FILE); done