Skip to content

Instantly share code, notes, and snippets.

Last active Dec 15, 2016
What would you like to do?
Example Makefile for Elm with multiple targets
# Assumes 'elm' is in your PATH, and there is a directory called 'src' containing
# your Elm source code in the same directory as this file.
ELM = elm
OUTPUT = ../assets/javascripts/elm # For Rails asset pipeline, but could be anything
SRCS = MyApp.elm MyOtherApp.elm
TARGETS = $(SRCS:.elm=.js)
ELM_STUFF = elm-stuff/exact-dependencies.json
all: $(TARGETS)
%.js: src/%.elm $(ELM_STUFF)
$(ELM) make $< --output $(OUTPUT)/$@
$(ELM_STUFF): elm-package.json
$(ELM) package install
echo "Removing build artifacts..."
rm -rf ./elm-stuff/build-artifacts
rm -rf ./elm-linter/build-artifacts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment