Skip to content

Instantly share code, notes, and snippets.

@hagino3000
Last active December 12, 2015 02:48
Show Gist options
  • Save hagino3000/4701545 to your computer and use it in GitHub Desktop.
Save hagino3000/4701545 to your computer and use it in GitHub Desktop.
makefile for JavaScrpt project
SRC_DIR = src
.PHONY: test
FILES = ${SRC_DIR}/api.js ${SRC_DIR}/trap.js ${SRC_DIR}/typechecker.js ${SRC_DIR}/all.js
CONCAT_FILE = struct.js
MINIFY_FILE = struct.min.js
default_target: all
TARGET = clean concat minify
all: $(TARGET)
setup_build_environment:
npm install
clean:
-rm -f ${CONCAT_FILE}
-rm -f ${MINIFY_FILE}
concat: clean ${FILES}
@echo "** Start concat source files"
node build/concat.js > ${CONCAT_FILE}
check: concat
@echo "** Start check source files by jshint"
node build/check.js < ${CONCAT_FILE}
minify: check
@echo "** Start minify concat file"
./node_modules/uglify-js/bin/uglifyjs --unsafe < ${CONCAT_FILE} > ${MINIFY_FILE}
@echo "Created ${MINIFY_FILE}"
test:
@echo "** Start tests"
node --harmony ./node_modules/jasmine-node/bin/jasmine-node test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment