Skip to content

Commit e71462d

Browse files
author
Dane Springmeyer
committed
error on warnings by default
1 parent b6bd13a commit e71462d

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
MODULE_NAME := $(shell node -e "console.log(require('./package.json').binary.module_name)")
22

3+
# Whether to turn compiler warnings into errors
4+
export WERROR ?= true
5+
36
default: release
47

58
node_modules:
@@ -8,11 +11,11 @@ node_modules:
811
npm install --ignore-scripts
912

1013
release: node_modules
11-
V=1 ./node_modules/.bin/node-pre-gyp configure build --loglevel=error
14+
V=1 ./node_modules/.bin/node-pre-gyp configure build --error_on_warnings=$(WERROR) --loglevel=error
1215
@echo "run 'make clean' for full rebuild"
1316

1417
debug: node_modules
15-
V=1 ./node_modules/.bin/node-pre-gyp configure build --loglevel=error --debug
18+
V=1 ./node_modules/.bin/node-pre-gyp configure build --error_on_warnings=$(WERROR) --loglevel=error --debug
1619
@echo "run 'make clean' for full rebuild"
1720

1821
coverage:

binding.gyp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{
22
'includes': [ 'common.gypi' ],
3+
'variables': {
4+
'error_on_warnings%':'true'
5+
},
36
'targets': [
47
{
58
'target_name': '<(module_name)',
@@ -11,6 +14,14 @@
1114
'ldflags': [
1215
'-Wl,-z,now',
1316
],
17+
'conditions': [
18+
['error_on_warnings != "false"', {
19+
'cflags_cc' : [ '-Werror' ],
20+
'xcode_settings': {
21+
'OTHER_CPLUSPLUSFLAGS': [ '-Werror' ]
22+
}
23+
}]
24+
],
1425
'xcode_settings': {
1526
'OTHER_LDFLAGS':[
1627
'-Wl,-bind_at_load'

0 commit comments

Comments
 (0)