Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
build: add ninja support to Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
bnoordhuis committed Sep 4, 2012
1 parent d3135e0 commit 7b6d3ce
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 11 deletions.
27 changes: 20 additions & 7 deletions Makefile
Expand Up @@ -2,6 +2,7 @@

BUILDTYPE ?= Release
PYTHON ?= python
NINJA ?= ninja
DESTDIR ?=
SIGN ?=

Expand All @@ -22,22 +23,34 @@ 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

config.gypi: configure
./configure

out/Debug/node:
$(MAKE) -C out BUILDTYPE=Debug V=$(V)
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

install: all
$(PYTHON) tools/install.py $@ $(DESTDIR)
Expand Down
14 changes: 10 additions & 4 deletions configure
Expand Up @@ -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()
Expand Down Expand Up @@ -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'

write('config.mk',
'# Do not edit. Generated by the configure script.\n' + config)

if options.ninja_build:
if options.use_ninja:
gyp_args = ['-f', 'ninja']
elif os.name == 'nt':
gyp_args = ['-f', 'msvs', '-G', 'msvs_version=2010']
Expand Down

0 comments on commit 7b6d3ce

Please sign in to comment.