1+ # NOTE: this file should be located in the top-level application directory.
2+
13.PHONY : help
24
35help :
@@ -26,14 +28,20 @@ help:
2628# ############
2729# VARIABLES #
2830
29- # Determine the Makefile's path :
31+ # Determine the Makefile filename :
3032THIS_FILE := $(lastword $(MAKEFILE_LIST ) )
3133
34+ # Determine the absolute path of the Makefile (see http://blog.jgc.org/2007/01/what-makefile-am-i-in.html):
35+ THIS_DIR := $(dir $(CURDIR ) /$(word $(words $(MAKEFILE_LIST ) ) ,$(MAKEFILE_LIST ) ) )
36+
37+ # Remove the trailing slash:
38+ THIS_DIR := $(patsubst % /,% ,$(THIS_DIR ) )
39+
3240GREP ?= grep
3341NPM ?= npm
3442NODE ?= node
3543NODE_ENV ?= test
36- NODE_MODULES ?= . /node_modules
44+ NODE_MODULES ?= $( THIS_DIR ) /node_modules
3745TRAVIS ?= false
3846
3947KERNEL ?= $(shell uname -s)
@@ -52,13 +60,13 @@ NOTES ?= 'TODO|FIXME|WARNING|HACK|NOTE|OPTIMIZE'
5260# TAPE #
5361
5462TAPE ?= $(NODE_MODULES ) /.bin/tape
55- TAP_REPORTER ?= $(NODE_MODULES ) /.bin/tap-spec
63+ TAP_REPORTER ?= $(NODE_MODULES ) /.bin/tap-spec
5664TAP_SUMMARY ?= $(NODE_MODULES ) /.bin/tap-summary
5765
5866
5967# ISTANBUL #
6068
61- REPORTS_DIR ?= . /reports
69+ REPORTS_DIR ?= $( THIS_DIR ) /reports
6270ISTANBUL ?= $(NODE_MODULES ) /.bin/istanbul
6371ISTANBUL_OUT ?= $(REPORTS_DIR ) /coverage
6472ISTANBUL_REPORT ?= lcov
@@ -80,12 +88,7 @@ BROWSERIFY_PROXYQUIRE ?= $(NODE_MODULES)/proxyquire-universal
8088# TESTLING #
8189
8290TESTLING ?= $(NODE_MODULES ) /.bin/testling
83- TESTLING_DIR ?= ./
84-
85-
86- # TRAVIS #
87-
88- TRAVIS_CI ?= ./tools/ci/travis.sh
91+ TESTLING_DIR ?= $(THIS_DIR ) /
8992
9093
9194# JSHINT #
@@ -96,7 +99,7 @@ JSHINT_REPORTER ?= $(NODE_MODULES)/jshint-stylish
9699
97100# FILES #
98101
99- SOURCE_DIR ?= .
102+ SOURCE_DIR ?= $( THIS_DIR )
100103TESTS_DIR ?= test
101104EXAMPLES_DIR ?= examples
102105
@@ -111,7 +114,7 @@ ifeq ($(KERNEL), Darwin)
111114 -name '*.js' \
112115 -regex "$(SOURCES_FILTER)" \
113116 -not -name 'test*.js' \
114- -not -path ' $(NODE_MODULES)/*' \
117+ -not -path " $(NODE_MODULES)/*" \
115118 -not -path "**/$(EXAMPLES_DIR)/*" \
116119 -not -path "$(REPORTS_DIR)/*" \
117120 )
134137 -regextype posix-extended \
135138 -regex "$(SOURCES_FILTER)" \
136139 -not -name 'test*.js' \
137- -not -path ' $(NODE_MODULES)/*' \
140+ -not -path " $(NODE_MODULES)/*" \
138141 -not -path "**/$(EXAMPLES_DIR)/*" \
139142 -not -path "$(REPORTS_DIR)/*" \
140143 )
@@ -168,9 +171,9 @@ endif
168171notes :
169172 $(GREP ) -Ern $(NOTES ) $(SOURCE_DIR ) \
170173 --exclude-dir " $( NODE_MODULES) /*" \
171- --exclude $(THIS_FILE ) \
172- --exclude ' . /.*' \
173- --exclude ' $(REPORTS_DIR)/*' \
174+ --exclude " $( THIS_FILE) " \
175+ --exclude " $( THIS_DIR ) /.*" \
176+ --exclude " $( REPORTS_DIR) /*" \
174177 --exclude TODO.md
175178
176179
@@ -292,9 +295,8 @@ view-istanbul-report:
292295.PHONY : test-ci test-ci-browsers
293296.PHONY : coverage coverage-codecov
294297
295- test-ci : node_modules
296- chmod 755 $(TRAVIS_CI )
297- $(TRAVIS_CI )
298+ # test-ci: test-local test-ci-browsers
299+ test-ci : test-local
298300
299301test-ci-browsers : node_modules
300302 xvfb-run make -f $(THIS_FILE ) test-browsers
@@ -315,7 +317,7 @@ lint: lint-jshint
315317lint-jshint : node_modules
316318 $(JSHINT ) \
317319 --reporter $(JSHINT_REPORTER ) \
318- . /
320+ $( SOURCE_DIR ) /
319321
320322
321323# NODE #
0 commit comments