Make on SMP systems

Quentin Spencer qspencer at ieee.org
Wed Mar 23 14:56:18 UTC 2005


I am in the process of repackaging a SRPM provided by an upstream 
developer, and I found the following code in the %build section of the 
script:

if [ -x /usr/bin/getconf ] ; then
  NCPU=$(/usr/bin/getconf _NPROCESSORS_ONLN)
  if [ $NCPU -eq 0 ] ; then
    NCPU=1
  fi
else 
  NCPU=1
fi
(make -k -j $NCPU; exit 0)
make

Now, I assume that all of this can be taken care of with the following 
command:

make %{?_smp_mflags}

However, I'm wondering if there's any good reason for the double make 
command in the first case. It appears that it was written with the 
expectation of needing to clean up from build failures from the first 
multithreaded make. I assumed that make would be able to appropriately 
deal with these type of things, so the second command would not be 
necessary. However, are there any circumstances under which it could 
fail, such as an incorrectly written Makefile? I don't have access to an 
SMP machine, and I suspect that even if I did, such errors would be 
erratic and hard to find.

-Quentin




More information about the fedora-extras-list mailing list