1SOURCE = src/buflist.h src/cas.cc src/cas.h src/commandbase.cc  \
2         src/commandlist.h src/commandoptions.h src/commands.cc \
3         src/commands.h src/constants.cc src/control.cc         \
4         src/cookie.cc src/cookie.h src/couchbase_impl.cc       \
5         src/couchbase_impl.h src/exception.cc src/exception.h  \
6         src/logger.h src/namemap.cc src/namemap.h              \
7         src/options.cc src/options.h src/uv-plugin-all.c       \
8         src/valueformat.cc src/valueformat.h
9
10all: binding $(SOURCE)
11	@node-gyp build
12
13binding: binding.gyp
14	@node-gyp configure
15
16clean:
17	@node-gyp clean
18	rm -rf jsdoc
19	rm -f cbmock.js
20
21install:
22	@npm install
23
24node_modules:
25	@npm install
26
27checkdeps:
28	node ./node_modules/npm-check/lib/cli.js -s
29
30test: node_modules
31	./node_modules/mocha/bin/mocha test/*.test.js
32fasttest: node_modules
33	./node_modules/mocha/bin/mocha test/*.test.js -ig "(slow)"
34
35lint: node_modules
36	./node_modules/jshint/bin/jshint lib/*.js
37
38cover: node_modules
39	node ./node_modules/istanbul/lib/cli.js cover ./node_modules/mocha/bin/_mocha -- test/*.test.js
40fastcover: node_modules
41	node ./node_modules/istanbul/lib/cli.js cover ./node_modules/mocha/bin/_mocha -- test/*.test.js -ig "(slow)"
42
43check: checkdeps test lint cover
44
45docs: node_modules
46	node ./node_modules/jsdoc/jsdoc.js -c .jsdoc
47
48browser: lib/mock.js lib/viewQuery.js
49	browserify -r "./lib/mock.js:cbmock" > cbmock.js
50
51prebuilds:
52	node ./node_modules/prebuild/bin.js
53
54reformat:
55	@astyle --mode=c \
56               --quiet \
57               --style=1tbs \
58               --indent=spaces=4 \
59               --indent-namespaces \
60               --indent-col1-comments \
61               --max-instatement-indent=78 \
62               --pad-oper \
63               --pad-header \
64               --add-brackets \
65               --unpad-paren \
66               --align-pointer=name \
67               io/*.c io/*.h io/util/hexdump.c \
68               src/*.cc \
69               src/*.h
70
71.PHONY: all test clean docs browser prebuilds
72