Skip to content

Commit

Permalink
Trac #15624: Support "make -jN"
Browse files Browse the repository at this point in the history
This should be supported by the top-level `Makefile`:
{{{
$ make -j4
}}}

The branch on this ticket implements this for sub-`make`s. For uses of
`$MAKE` outside of `make` itself (like building the Sage documentation
or Sage library), the value of `-j` given to `make` cannot be determined
so this cannot work.

URL: http://trac.sagemath.org/15624
Reported by: jdemeyer
Ticket author(s): Jeroen Demeyer
Reviewer(s): Peter Bruin
  • Loading branch information
Release Manager authored and vbraun committed Feb 2, 2014
2 parents 2b9f096 + 43b3cd6 commit b989dff
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 28 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ logs:
mkdir -p $@

build: logs configure
cd build && \
+cd build && \
"../$(PIPE)" \
"env SAGE_PARALLEL_SPKG_BUILD='$(SAGE_PARALLEL_SPKG_BUILD)' ./install all 2>&1" \
"tee -a ../logs/install.log"
Expand Down
55 changes: 28 additions & 27 deletions build/install
Original file line number Diff line number Diff line change
Expand Up @@ -310,9 +310,10 @@ fi
# Create $SAGE_ROOT/build/Makefile starting from build/deps
###############################################################################

exec 3>Makefile
# Trac #15624: use file descriptor 5 since make uses 3 and 4
exec 5>Makefile

cat >&3 <<EOF
cat >&5 <<EOF
#==============================================================================
# This file has been automatically generated by
# $SAGE_ROOT/build/install
Expand All @@ -323,16 +324,16 @@ EOF

# Use bash as shell for the Makefile (bash obviously exists, since
# this build/install script runs under bash).
echo >&3 "SHELL = `command -v bash`"
echo >&3
echo >&5 "SHELL = `command -v bash`"
echo >&5

# If the user (or the Makefile) has set SAGE_PARALLEL_SPKG_BUILD=no,
# then turn off parallel building: disable just building multiple
# packages at the same time. Individual packages can still be built
# in parallel by specifying '-j' in $MAKE.
if [ "${SAGE_PARALLEL_SPKG_BUILD:-yes}" = no ]; then
echo ".NOTPARALLEL:" >&3
echo "" >&3
echo ".NOTPARALLEL:" >&5
echo "" >&5
fi

# Usage: newest_version $pkg
Expand All @@ -349,7 +350,7 @@ newest_version() {
fi
}

cat >&3 <<EOF
cat >&5 <<EOF
# Standard packages
ATLAS=`newest_version atlas`
BOEHM_GC=`newest_version boehm_gc`
Expand Down Expand Up @@ -445,40 +446,40 @@ INST=`echo "$SAGE_SPKG_INST" | sed 's/ /\\\\ /g'`
EOF

# $(TOOLCHAIN) variable containing prerequisites for the build
echo >&3 -n 'TOOLCHAIN ='
echo >&5 -n 'TOOLCHAIN ='
if [ "$SAGE_INSTALL_CCACHE" = yes ]; then
echo >&3 -n ' $(INST)/ccache'
echo >&5 -n ' $(INST)/ccache'
fi
if [ "$need_to_install_gcc" = yes ]; then
echo >&3 -n ' $(INST)/$(GCC)'
echo >&5 -n ' $(INST)/$(GCC)'
# Use this option for the prereq configure script, such that it
# will skip all compiler checks.
export PREREQ_OPTIONS="--disable-compiler-checks $PREREQ_OPTIONS"
fi
echo >&3
echo >&5

echo >&3 'SCRIPT_SOURCES = \'
echo >&5 'SCRIPT_SOURCES = \'
for file in "$SAGE_SRC/bin/"*; do
echo >&3 " \$(SAGE_SRC)${file#$SAGE_SRC} \\"
echo >&5 " \$(SAGE_SRC)${file#$SAGE_SRC} \\"
done
echo >&3
echo >&3 'SCRIPTS = \'
echo >&5
echo >&5 'SCRIPTS = \'
for file in "$SAGE_SRC/bin/"*; do
echo >&3 " \$(SAGE_LOCAL)${file#$SAGE_SRC} \\"
echo >&5 " \$(SAGE_LOCAL)${file#$SAGE_SRC} \\"
done
echo >&3
echo >&3 'EXTCODE_SOURCES = \'
echo >&5
echo >&5 'EXTCODE_SOURCES = \'
for file in `find "$SAGE_SRC"/ext -type f`; do
echo >&3 " \$(SAGE_SRC)${file#$SAGE_SRC} \\"
echo >&5 " \$(SAGE_SRC)${file#$SAGE_SRC} \\"
done
echo >&3
echo >&3 'EXTCODE = \'
echo >&5
echo >&5 'EXTCODE = \'
for file in `find "$SAGE_SRC"/ext -type f`; do
echo >&3 " \$(SAGE_EXTCODE)${file#$SAGE_SRC/ext} \\"
echo >&5 " \$(SAGE_EXTCODE)${file#$SAGE_SRC/ext} \\"
done
echo >&3
echo >&5

cat >&3 <<EOF
cat >&5 <<EOF
# don't just use \`install\` since we don't want to change permissions
\$(SAGE_LOCAL)/bin/%: \$(SAGE_SRC)/bin/%
cp \$< \$@
Expand All @@ -492,7 +493,7 @@ cat >&3 <<EOF
EOF

# Copy build/deps
cat >&3 <<EOF
cat >&5 <<EOF
#==============================================================================
# What follows now is a copy of
Expand All @@ -501,10 +502,10 @@ cat >&3 <<EOF
EOF

cat "$SAGE_ROOT/build/deps" >&3
cat "$SAGE_ROOT/build/deps" >&5

# Close the Makefile
exec 3>&-
exec 5>&-

###############################################################################
# Skip the rest if nothing to do (i.e., to [re]build).
Expand Down

0 comments on commit b989dff

Please sign in to comment.