summaryrefslogtreecommitdiff
path: root/tools/gyp/pylib/gyp/generator/make.py
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2013-03-24 14:29:17 +0100
committerBen Noordhuis <info@bnoordhuis.nl>2013-03-24 15:03:09 +0100
commit8632af381e7086823db764f815cbee53681d450b (patch)
tree84c752dbe7c2adb53a567087ac995383fb3e3935 /tools/gyp/pylib/gyp/generator/make.py
parent329b5388ba5a74aa3c4a7e142ba33510e4282cc1 (diff)
downloadandroid-node-v8-8632af381e7086823db764f815cbee53681d450b.tar.gz
android-node-v8-8632af381e7086823db764f815cbee53681d450b.tar.bz2
android-node-v8-8632af381e7086823db764f815cbee53681d450b.zip
tools: update gyp to r1601
Among other things, this should make it easier for people to build node.js on openbsd.
Diffstat (limited to 'tools/gyp/pylib/gyp/generator/make.py')
-rw-r--r--tools/gyp/pylib/gyp/generator/make.py52
1 files changed, 24 insertions, 28 deletions
diff --git a/tools/gyp/pylib/gyp/generator/make.py b/tools/gyp/pylib/gyp/generator/make.py
index bcc2cc619d..9806c64a8f 100644
--- a/tools/gyp/pylib/gyp/generator/make.py
+++ b/tools/gyp/pylib/gyp/generator/make.py
@@ -259,7 +259,7 @@ all_deps :=
# export LINK=g++
#
# This will allow make to invoke N linker processes as specified in -jN.
-LINK ?= %(flock)s $(builddir)/linker.lock $(CXX)
+LINK ?= %(flock)s $(builddir)/linker.lock $(CXX.target)
CC.target ?= %(CC.target)s
CFLAGS.target ?= $(CFLAGS)
@@ -395,15 +395,14 @@ command_changed = $(or $(subst $(cmd_$(1)),,$(cmd_$(call replace_spaces,$@))),\\
# $| -- order-only dependencies
prereq_changed = $(filter-out FORCE_DO_CMD,$(filter-out $|,$?))
-# Helper that executes all postbuilds, and deletes the output file when done
-# if any of the postbuilds failed.
+# Helper that executes all postbuilds until one fails.
define do_postbuilds
@E=0;\\
for p in $(POSTBUILDS); do\\
eval $$p;\\
- F=$$?;\\
- if [ $$F -ne 0 ]; then\\
- E=$$F;\\
+ E=$$?;\\
+ if [ $$E -ne 0 ]; then\\
+ break;\\
fi;\\
done;\\
if [ $$E -ne 0 ]; then\\
@@ -619,21 +618,6 @@ def QuoteSpaces(s, quote=r'\ '):
return s.replace(' ', quote)
-def InvertRelativePath(path):
- """Given a relative path like foo/bar, return the inverse relative path:
- the path from the relative path back to the origin dir.
-
- E.g. os.path.normpath(os.path.join(path, InvertRelativePath(path)))
- should always produce the empty string."""
-
- if not path:
- return path
- # Only need to handle relative paths into subdirectories for now.
- assert '..' not in path, path
- depth = len(path.split(os.path.sep))
- return os.path.sep.join(['..'] * depth)
-
-
# Map from qualified target to path to output.
target_outputs = {}
# Map from qualified target to any linkable output. A subset
@@ -1417,7 +1401,7 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD
lambda p: Sourceify(self.Absolutify(p)))
# TARGET_POSTBUILDS_$(BUILDTYPE) is added to postbuilds later on.
- gyp_to_build = InvertRelativePath(self.path)
+ gyp_to_build = gyp.common.InvertRelativePath(self.path)
target_postbuild = self.xcode_settings.GetTargetPostbuilds(
configname,
QuoteSpaces(os.path.normpath(os.path.join(gyp_to_build,
@@ -1541,7 +1525,7 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD
for link_dep in link_deps:
assert ' ' not in link_dep, (
"Spaces in alink input filenames not supported (%s)" % link_dep)
- if (self.flavor not in ('mac', 'win') and not
+ if (self.flavor not in ('mac', 'openbsd', 'win') and not
self.is_standalone_static_library):
self.WriteDoCmd([self.output_binary], link_deps, 'alink_thin',
part_of_all, postbuilds=postbuilds)
@@ -2000,7 +1984,8 @@ def GenerateOutput(target_list, target_dicts, data, params):
'flock_index': 2,
'extra_commands': SHARED_HEADER_SUN_COMMANDS,
})
- elif flavor == 'freebsd' or flavor == 'dragonflybsd':
+ elif flavor == 'freebsd':
+ # Note: OpenBSD has sysutils/flock. lockf seems to be FreeBSD specific.
header_params.update({
'flock': 'lockf',
})
@@ -2018,14 +2003,22 @@ def GenerateOutput(target_list, target_dicts, data, params):
build_file, _, _ = gyp.common.ParseQualifiedTarget(target_list[0])
make_global_settings_array = data[build_file].get('make_global_settings', [])
+ wrappers = {}
+ wrappers['LINK'] = '%s $(builddir)/linker.lock' % flock_command
+ for key, value in make_global_settings_array:
+ if key.endswith('_wrapper'):
+ wrappers[key[:-len('_wrapper')]] = '$(abspath %s)' % value
make_global_settings = ''
for key, value in make_global_settings_array:
+ if re.match('.*_wrapper', key):
+ continue
if value[0] != '$':
value = '$(abspath %s)' % value
- if key == 'LINK':
- make_global_settings += ('%s ?= %s $(builddir)/linker.lock %s\n' %
- (key, flock_command, value))
- elif key in ('CC', 'CC.host', 'CXX', 'CXX.host'):
+ wrapper = wrappers.get(key)
+ if wrapper:
+ value = '%s %s' % (wrapper, value)
+ del wrappers[key]
+ if key in ('CC', 'CC.host', 'CXX', 'CXX.host'):
make_global_settings += (
'ifneq (,$(filter $(origin %s), undefined default))\n' % key)
# Let gyp-time envvars win over global settings.
@@ -2035,6 +2028,9 @@ def GenerateOutput(target_list, target_dicts, data, params):
make_global_settings += 'endif\n'
else:
make_global_settings += '%s ?= %s\n' % (key, value)
+ # TODO(ukai): define cmd when only wrapper is specified in
+ # make_global_settings.
+
header_params['make_global_settings'] = make_global_settings
ensure_directory_exists(makefile_path)