Skip to content

Instantly share code, notes, and snippets.

@wmakley
Last active December 15, 2016 19:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wmakley/c19e6e86f6c8f383ee15f9fc103102e2 to your computer and use it in GitHub Desktop.
Save wmakley/c19e6e86f6c8f383ee15f9fc103102e2 to your computer and use it in GitHub Desktop.
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
clean:
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