build: add ninja support to Makefile

This commit is contained in:
Ben Noordhuis 2012-09-04 16:03:01 +02:00
parent d3135e0f57
commit 7b6d3cea2c
2 changed files with 30 additions and 11 deletions

View File

@ -2,6 +2,7 @@
BUILDTYPE ?= Release
PYTHON ?= python
NINJA ?= ninja
DESTDIR ?=
SIGN ?=
@ -22,23 +23,35 @@ endif
# to check for changes.
.PHONY: node node_g
ifeq ($(USE_NINJA),1)
node: config.gypi
$(NINJA) -C out/Release/
ln -fs out/Release/node node
node_g: config.gypi
$(NINJA) -C out/Debug/
ln -fs out/Debug/node $@
else
node: config.gypi out/Makefile
$(MAKE) -C out BUILDTYPE=Release V=$(V)
ln -fs out/Release/node node
node_g: config.gypi out/Makefile
$(MAKE) -C out BUILDTYPE=Debug V=$(V)
ln -fs out/Debug/node node_g
ln -fs out/Debug/node $@
endif
out/Makefile: common.gypi deps/uv/uv.gyp deps/http_parser/http_parser.gyp deps/zlib/zlib.gyp deps/v8/build/common.gypi deps/v8/tools/gyp/v8.gyp node.gyp config.gypi
ifeq ($(USE_NINJA),1)
touch out/Makefile
$(PYTHON) tools/gyp_node -f ninja
else
$(PYTHON) tools/gyp_node -f make
endif
config.gypi: configure
./configure
out/Debug/node:
$(MAKE) -C out BUILDTYPE=Debug V=$(V)
out/Makefile: common.gypi deps/uv/uv.gyp deps/http_parser/http_parser.gyp deps/zlib/zlib.gyp deps/v8/build/common.gypi deps/v8/tools/gyp/v8.gyp node.gyp config.gypi
$(PYTHON) tools/gyp_node -f make
install: all
$(PYTHON) tools/install.py $@ $(DESTDIR)

14
configure vendored
View File

@ -167,7 +167,7 @@ parser.add_option("--with-arm-float-abi",
parser.add_option("--ninja",
action="store_true",
dest="ninja_build",
dest="use_ninja",
help="Generate files for the ninja build system")
(options, args) = parser.parse_args()
@ -459,10 +459,16 @@ def write(filename, data):
write('config.gypi', "# Do not edit. Generated by the configure script.\n" +
pprint.pformat(output, indent=2) + "\n")
write('config.mk', "# Do not edit. Generated by the configure script.\n" +
("BUILDTYPE=%s\n" % ('Debug' if options.debug else 'Release')))
config = {
'BUILDTYPE': 'Debug' if options.debug else 'Release',
'USE_NINJA': str(int(options.use_ninja or 0)),
}
config = '\n'.join(map('='.join, config.iteritems())) + '\n'
if options.ninja_build:
write('config.mk',
'# Do not edit. Generated by the configure script.\n' + config)
if options.use_ninja:
gyp_args = ['-f', 'ninja']
elif os.name == 'nt':
gyp_args = ['-f', 'msvs', '-G', 'msvs_version=2010']