Skip to content

Commit 4c4c704

Browse files
committed
Makefile: run build and tests in parallel by default
1 parent eee0373 commit 4c4c704

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

Makefile

+4-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
# You should have received a copy of the GNU General Public License
1616
# along with csdiff. If not, see <http://www.gnu.org/licenses/>.
1717

18+
NUM_CPU ?= $(shell getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1)
19+
1820
CMAKE ?= cmake
19-
CTEST ?= ctest
21+
CTEST ?= ctest -j$(NUM_CPU)
2022

2123
CMAKE_BUILD_TYPE ?= RelWithDebInfo
2224

@@ -25,7 +27,7 @@ CMAKE_BUILD_TYPE ?= RelWithDebInfo
2527
all: version.cc
2628
mkdir -p csdiff_build
2729
cd csdiff_build && $(CMAKE) -D 'CMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE)' ..
28-
$(MAKE) -C csdiff_build
30+
$(MAKE) -C csdiff_build -j$(NUM_CPU)
2931

3032
fast: version.cc
3133
$(MAKE) -sC csdiff_build

make-srpm.sh

+1-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
SELF="$0"
2121

2222
PKG="csdiff"
23-
: ${MAKEOPTS=-j9}
2423

2524
die() {
2625
echo "$SELF: error: $1" >&2
@@ -61,9 +60,7 @@ cd "$TMP" >/dev/null || die "mktemp failed"
6160
# clone the repository
6261
git clone "$REPO" "$PKG" || die "git clone failed"
6362
cd "$PKG" || die "git clone failed"
64-
65-
make $MAKEOPTS distcheck CTEST="ctest $MAKEOPTS" \
66-
|| die "'make distcheck' has failed"
63+
make distcheck || die "'make distcheck' has failed"
6764

6865
SRC_TAR="${NV}.tar"
6966
SRC="${SRC_TAR}.xz"

0 commit comments

Comments
 (0)