<p>Stefan Sperling <strong>merged</strong> this change.</p><p><a href="https://gerrit.osmocom.org/9731">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">default to number of CPUs for parallel make jobs<br><br>The previous default behaviour was to always run 'make -j8', which<br>can cause C++ build failures on machines which are low on memory.<br>"Low" being a relative measure; I've seen failures with 4GB of RAM.<br><br>Rather than assuming a beefy 8-core box, try to detect the number<br>of available CPU cores with nproc(1) from GNU coreutils and set<br>the number of parallel make jobs to the number of CPU cores.<br><br>If this command is not available, default to a safe choice: -j1<br>Note that installing ccache will speed up repeated builds a lot<br>more than -jX ever will, so falling back to -j1 isn't very bad.<br><br>Change-Id: I61c3ea1b3cb5b64eecb08ad6c390594f70cdf785<br>---<br>M Makefile<br>1 file changed, 5 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/Makefile b/Makefile</span><br><span>index fcd6601..a12a504 100644</span><br><span>--- a/Makefile</span><br><span>+++ b/Makefile</span><br><span>@@ -1,6 +1,10 @@</span><br><span> SUBDIRS=bsc bsc-nat bts ggsn_tests hlr lapdm mgw msc pcu selftest sgsn sip sysinfo</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-PARALLEL_MAKE ?= -j8</span><br><span style="color: hsl(120, 100%, 40%);">+NPROC=$(shell nproc 2>/dev/null)</span><br><span style="color: hsl(120, 100%, 40%);">+ifeq ($(NPROC),)</span><br><span style="color: hsl(120, 100%, 40%);">+NPROC=1</span><br><span style="color: hsl(120, 100%, 40%);">+endif</span><br><span style="color: hsl(120, 100%, 40%);">+PARALLEL_MAKE ?= -j$(NPROC)</span><br><span> </span><br><span> # This master makefile allows you to do things like</span><br><span> #   make clean      (remove all generated binary, c++ and symlinks)</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/9731">change 9731</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/9731"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-ttcn3-hacks </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I61c3ea1b3cb5b64eecb08ad6c390594f70cdf785 </div>
<div style="display:none"> Gerrit-Change-Number: 9731 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Stefan Sperling <ssperling@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Harald Welte <laforge@gnumonks.org> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: Stefan Sperling <ssperling@sysmocom.de> </div>