| 1 |
# |
| 2 |
# This Source Code Form is subject to the terms of the Mozilla Public |
| 3 |
# License, v. 2.0. If a copy of the MPL was not distributed with this |
| 4 |
# file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 5 |
# |
| 6 |
# Copyright (c) 2016, Joyent, Inc. |
| 7 |
# |
| 8 |
|
| 9 |
# |
| 10 |
# Tools |
| 11 |
# |
| 12 |
NPM_EXEC := $(shell which npm) |
| 13 |
NPM := npm |
| 14 |
TAP := ./node_modules/.bin/tape |
| 15 |
JSON := ./node_modules/.bin/json |
| 16 |
|
| 17 |
# |
| 18 |
# Makefile.defs defines variables used as part of the build process. |
| 19 |
# |
| 20 |
include ./tools/mk/Makefile.defs |
| 21 |
|
| 22 |
# |
| 23 |
# Configuration used by Makefile.defs and Makefile.targ to generate |
| 24 |
# "check" and "docs" targets. |
| 25 |
# |
| 26 |
DOC_FILES = index.md |
| 27 |
JSON_FILES = package.json |
| 28 |
JS_FILES := $(shell find lib test -name '*.js') |
| 29 |
JSL_FILES_NODE = $(JS_FILES) |
| 30 |
JSSTYLE_FILES = $(JS_FILES) |
| 31 |
|
| 32 |
JSL_CONF_NODE = tools/jsl.node.conf |
| 33 |
JSSTYLE_FLAGS = -f tools/jsstyle.conf |
| 34 |
|
| 35 |
include ./tools/mk/Makefile.defs |
| 36 |
include ./tools/mk/Makefile.node_deps.defs |
| 37 |
|
| 38 |
# |
| 39 |
# Repo-specific targets |
| 40 |
# |
| 41 |
.PHONY: all |
| 42 |
all: $(SMF_MANIFESTS) | $(TAP) $(REPO_DEPS) |
| 43 |
$(NPM) rebuild |
| 44 |
|
| 45 |
$(TAP): | $(NPM_EXEC) |
| 46 |
$(NPM) install |
| 47 |
$(JSON): | $(NPM_EXEC) |
| 48 |
$(NPM) install |
| 49 |
|
| 50 |
CLEAN_FILES += $(TAP) ./node_modules/tap |
| 51 |
|
| 52 |
.PHONY: test |
| 53 |
test: $(TAP) |
| 54 |
TAP=1 $(TAP) test/*.test.js |
| 55 |
|
| 56 |
.PHONY: coverage |
| 57 |
coverage: all |
| 58 |
$(NPM_EXEC) install istanbul && \ |
| 59 |
./node_modules/.bin/istanbul cover \ |
| 60 |
$(TAP) test/*.test.js |
| 61 |
|
| 62 |
include ./tools/mk/Makefile.deps |
| 63 |
include ./tools/mk/Makefile.node_deps.targ |
| 64 |
include ./tools/mk/Makefile.targ |