forked from kubark42/node-opencv
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
101 lines (79 loc) · 2.87 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
VERSION := $(shell node -e "console.log(require('./package.json').version)")
test:
npm test
.PHONY: test
smoke:
npm install --build-from-source
node smoke/smoketest.js
npm test
.PHONY: smoke
release:
@echo "Tagging release $(VERSION)"
@git tag -m "$(VERSION)" v$(VERSION)
@echo "Pushing tags to GitHub"
@git push --tags
@echo "Switching to osx-binaries branch"
@git checkout osx-binaries
@echo "Merging master into osx-binaries"
@git merge --no-ff --commit -m "Merge master into osx-binaries [publish binary]" master
@echo "Pushing osx-binaries"
@git push
@echo "Switching to master branch"
@git checkout master
@echo "Publishing to NPM"
@npm publish
.PHONY: release
travis-build:
docker build -t peterbraden/node-opencv-ubuntu-12-04 -f test/Dockerfile-ubuntu-12-04 .
docker build -t peterbraden/node-opencv-ubuntu-14-04 -f test/Dockerfile-ubuntu-14-04 .
.PHONY: travis-build
# Below build, coverage and clean tasks were partly lifted from https://github.com/geo-data/node-mapserv/blob/e99b23a44d910d444f5a45d144859758f820e1d1/Makefile
# @author danschultzer
# The location of the `istanbul` JS code coverage framework. Try and get a
# globally installed version, falling back to a local install.
ISTANBUL := $(shell which istanbul)
ifeq ($(ISTANBUL),)
ISTANBUL = ./node_modules/.bin/istanbul/lib/cli.js
endif
# The location of the `node-pre-gyp` module builder. Try and get a globally
# installed version, falling back to a local install.
NODE_PRE_GYP = $(shell which node-pre-gyp)
ifeq ($(NODE_GYP),)
NODE_PRE_GYP = ./node_modules/.bin/node-pre-gyp
endif
NODE := $(shell which node)
test_deps = build \
./test/*.js \
./lib/*.js \
$(NODE)
build: build/Debug/opencv.node
build/Debug/opencv.node:
$(NODE_PRE_GYP) --verbose --debug rebuild
# Perform the code coverage
cover: coverage/index.html
coverage/index.html: coverage/node-opencv.info
genhtml --output-directory coverage coverage/node-opencv.info
@echo "\033[0;32mPoint your browser at \`coverage/index.html\`\033[m\017"
coverage/node-opencv.info: coverage/bindings.info
lcov --test-name node-opencv \
--add-tracefile coverage/lcov.info \
--add-tracefile coverage/bindings.info \
--output-file coverage/node-opencv.info
coverage/bindings.info: coverage/addon.info
lcov --extract coverage/addon.info '*opencv/src/*' --output-file coverage/bindings.info
coverage/addon.info: coverage/lcov.info
lcov --capture --base-directory build/ --directory . --output-file coverage/addon.info
# This generates the JS lcov info as well as gcov `*.gcda` files:
coverage/lcov.info: $(test_deps) $(ISTANBUL)
NODE_OPENCV_DEBUG=true $(NODE) --nouse_idle_notification --expose-gc \
$(ISTANBUL) cover --report lcovonly -- test/unit.js
$(NODE_PRE_GYP):
npm install node-pre-gyp
$(ISTANBUL): package.json
npm install istanbul
@touch $(ISTANBUL)
# Clean up any generated files
clean: $(NODE_PRE_GYP)
$(NODE_PRE_GYP) clean
rm -rf coverage
rm -rf build