diff --git a/lib/gyp/generator/ninja/index.js b/lib/gyp/generator/ninja/index.js index d02d360..4d63134 100644 --- a/lib/gyp/generator/ninja/index.js +++ b/lib/gyp/generator/ninja/index.js @@ -395,7 +395,11 @@ Ninja.prototype.actions = function actions() { let res = []; list.forEach((action) => { - const actionRule = action.action_name + '_' + this.index; + const safeActionName = action.action_name.replace(/\s/g, '_'); + global.action_names = (global.action_names || {}); + const counterRef = global.action_names[safeActionName] || (global.action_names[safeActionName] = {counter: 0}); + const actionRule = safeActionName + (counterRef.counter || ''); + counterRef.counter++; const base = gyp.common.cachedRelative(this.configDir, this.srcDir); const toBase = gyp.common.cachedRelative(this.srcDir, this.configDir); @@ -660,6 +664,7 @@ NinjaMain.prototype.hostVars = function hostVars(target) { main.declare('ld_host', ld); main.declare('ldxx_host', ldxx); main.declare('ar_host', ar); + }; NinjaMain.prototype.rulesAndTargets = function rulesAndTargets() {