diff --git a/.gitignore b/.gitignore index 27e22ef6183f61..d8b381203b6a00 100644 --- a/.gitignore +++ b/.gitignore @@ -69,6 +69,7 @@ ipch/ /config.mk /config.gypi +/config.status /config_fips.gypi *-nodegyp* /gyp-mac-tool diff --git a/Makefile b/Makefile index 55e4c52e7d6ebd..802cccbce6aa6d 100644 --- a/Makefile +++ b/Makefile @@ -114,7 +114,12 @@ out/Makefile: common.gypi deps/uv/uv.gyp deps/http_parser/http_parser.gyp \ $(PYTHON) tools/gyp_node.py -f make config.gypi: configure - $(error Missing or stale $@, please run ./$<) + @if [ -x config.status ]; then \ + ./config.status; \ + else \ + echo Missing or stale $@, please run ./$<; \ + exit 1; \ + fi .PHONY: install install: all ## Installs node into $PREFIX (default=/usr/local). diff --git a/configure b/configure index efb92701e2606f..3a9ab42414569e 100755 --- a/configure +++ b/configure @@ -28,6 +28,7 @@ if sys.version_info[0] != 2 or sys.version_info[1] not in (6, 7): import errno import optparse import os +import pipes import pprint import re import shlex @@ -38,6 +39,8 @@ import string # If not run from node/, cd to node/. os.chdir(os.path.dirname(__file__) or '.') +original_argv = sys.argv[1:] + # gcc and g++ as defaults matches what GYP's Makefile generator does, # except on OS X. CC = os.environ.get('CC', 'cc' if sys.platform == 'darwin' else 'gcc') @@ -1530,6 +1533,10 @@ pprint.pprint(output, indent=2) write('config.gypi', do_not_edit + pprint.pformat(output, indent=2) + '\n') +write('config.status', '#!/bin/sh\nset -x\nexec ./configure ' + + ' '.join([pipes.quote(arg) for arg in original_argv]) + '\n') +os.chmod('config.status', 0775) + config = { 'BUILDTYPE': 'Debug' if options.debug else 'Release', 'PYTHON': sys.executable,