Created
October 3, 2016 07:03
-
-
Save pawelgalazka/fc9f4299cb641a6aee050ea51ad72144 to your computer and use it in GitHub Desktop.
Example of Makefile (for medium article)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PATH := node_modules/.bin:$(PATH) | |
SHELL := /bin/bash | |
source_files := $(wildcard lib/*.coffee) | |
build_files := $(source_files:%.coffee=build/%.js) | |
template_source := templates/*.handlebars | |
template_js := build/templates.js | |
app_bundle := build/app.js | |
spec_coffee := $(wildcard spec/*.coffee) | |
spec_js := $(spec_coffee:%.coffee=build/%.js) | |
libraries := vendor/jquery.js \ | |
node_modules/handlebars/dist/handlebars.runtime.js \ | |
node_modules/underscore/underscore.js \ | |
node_modules/backbone/backbone.js | |
.PHONY: all clean test | |
all: $(app_bundle) | |
build/%.js: %.coffee | |
coffee -co $(dir $@) $< | |
$(template_js): $(template_source) | |
mkdir -p $(dir $@) | |
handlebars $(template_source) > $@ | |
$(app_bundle): $(libraries) $(build_files) $(template_js) | |
uglifyjs -cmo $@ $^ | |
test: $(app_bundle) $(spec_js) | |
phantomjs phantom.js | |
clean: | |
rm -rf build |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Context: https://hackernoon.com/simple-build-tools-npm-scripts-vs-makefile-vs-runjs-31e578278162