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
27test: node_modules
28	./node_modules/mocha/bin/mocha test/*.test.js
29fasttest: node_modules
30	./node_modules/mocha/bin/mocha test/*.test.js -ig "(slow)"
31
32lint: node_modules
33	./node_modules/jshint/bin/jshint lib/*.js
34
35cover: node_modules
36	node ./node_modules/istanbul/lib/cli.js cover ./node_modules/mocha/bin/_mocha -- test/*.test.js
37fastcover: node_modules
38	node ./node_modules/istanbul/lib/cli.js cover ./node_modules/mocha/bin/_mocha -- test/*.test.js -ig "(slow)"
39
40check: test lint cover
41
42docs: node_modules
43	node ./node_modules/jsdoc/jsdoc.js -c .jsdoc
44
45browser: lib/mock.js lib/viewQuery.js
46	browserify -r "./lib/mock.js:cbmock" > cbmock.js
47
48prebuilds:
49	node ./node_modules/prebuild/bin.js
50
51reformat:
52	@astyle --mode=c \
53               --quiet \
54               --style=1tbs \
55               --indent=spaces=4 \
56               --indent-namespaces \
57               --indent-col1-comments \
58               --max-instatement-indent=78 \
59               --pad-oper \
60               --pad-header \
61               --add-brackets \
62               --unpad-paren \
63               --align-pointer=name \
64               io/*.c io/*.h io/util/hexdump.c \
65               src/*.cc \
66               src/*.h
67
68.PHONY: all test clean docs browser prebuilds
69