forked from Blizzard/node-rdkafka
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
82 lines (63 loc) · 2.07 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
NODE-GYP ?= node_modules/.bin/node-gyp
PYTHON ?= python
NODE ?= node
CPPLINT ?= cpplint.py
BUILDTYPE ?= Release
TESTS = "test/**/*.js"
E2E_TESTS = $(wildcard e2e/*.spec.js)
TEST_REPORTER =
TEST_OUTPUT =
CONFIG_OUTPUTS = \
build/bindings.target.mk \
build/Makefile \
build/binding.Makefile build/config.gypi
CPPLINT_FILES = $(wildcard src/*.cc src/*.h)
CPPLINT_FILTER = -legal/copyright
JSLINT_FILES = $(wildcard lib/**/*.js test/**/*.js)
PACKAGE = $(shell node -pe 'require("./package.json").name.split("/")[1]')
VERSION = $(shell node -pe 'require("./package.json").version')
GYPBUILDARGS=
ifeq ($(BUILDTYPE),Debug)
GYPBUILDARGS=--debug
endif
.PHONY: all clean lint test lib docs e2e ghpages
all: lint lib test e2e
lint: cpplint jslint
cpplint:
@$(PYTHON) $(CPPLINT) --filter=$(CPPLINT_FILTER) $(CPPLINT_FILES)
jslint: node_modules/.dirstamp
@./node_modules/.bin/jshint $(JSLINT_FILES)
lib: node_modules/.dirstamp $(CONFIG_OUTPUTS)
@$(NODE-GYP) build $(GYPBUILDARGS)
node_modules/.dirstamp: package.json
@npm update --loglevel warn
@touch $@
$(CONFIG_OUTPUTS): node_modules/.dirstamp binding.gyp
@$(NODE-GYP) configure
test: node_modules/.dirstamp
@./node_modules/.bin/mocha $(TEST_REPORTER) $(TESTS) $(TEST_OUTPUT)
e2e: $(E2E_TESTS)
@$(NODE) e2e/consumer.spec.js && $(NODE) e2e/producer.spec.js && $(NODE) e2e/both.spec.js
define release
NEXT_VERSION=$(shell node -pe 'require("semver").inc("$(VERSION)", "$(1)")')
node -e "\
var j = require('./package.json');\
j.version = \"$$NEXT_VERSION\";\
var s = JSON.stringify(j, null, 2);\
require('fs').writeFileSync('./package.json', s);" && \
git commit -m "release $$NEXT_VERSION" -- package.json && \
git tag "$$NEXT_VERSION" -m "release $$NEXT_VERSION"
endef
docs: node_modules/.dirstamp
@rm -rf docs
@./node_modules/jsdoc/jsdoc.js --destination docs \
--recurse -R ./README.md \
-t "./node_modules/toolkit-jsdoc/" \
--tutorials examples ./lib
gh-pages: node_modules/.dirstamp
@./make_docs.sh
release-patch:
@$(call release,patch)
clean: node_modules/.dirstamp
@rm -f deps/librdkafka/config.h
@$(NODE-GYP) clean