Skip to content

Instantly share code, notes, and snippets.

@npryce
Last active Aug 29, 2015
Embed
What would you like to do?
Makefile to bootstrap and build a Purescript project
npm_bin:=$(shell npm bin)
psc=$(npm_bin)/psc
bower=$(npm_bin)/bower
outdir=target
all: $(outdir)/js/HelloWorld.js
$(outdir)/js/HelloWorld.js: src/HelloWorld.purs
$(outdir)/js/HelloWorld.js: pscflags=--main=$*
$(outdir)/js/%.js: psclibsrc=$(shell find bower_components/*/src '*.purs')
$(outdir)/js/%.js: $(psc) $(outdir)/bower.installed $(psclibsrc)
@mkdir -p $(dir $@)
$(psc) $(filter %.purs,$^) --output=$@ --module=$* $(pscflags)
$(psc):
npm install purescript@0.6.10
$(bower):
npm install bower@1.4.1
$(outdir)/bower.installed: $(bower) bower.json
$(bower) install
@mkdir -p $(dir $@)
touch $@
clean:
rm -rf $(outdir)/js
clean-libs:
rm -rf $(outdir) bower_components
clean-everything: clean-libs
rm -rf node_modules
.PHONY: all clean clean-libs clean-everything
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment