From a8662bc772618931ce3cf95454b2b1bd11307a3a Mon Sep 17 00:00:00 2001 From: Michal Nazarewicz Date: Tue, 16 Mar 2021 00:28:41 +0100 Subject: [PATCH] [shell] Replace make alias with a shell script MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Replace ‘make’ alias with a shell script which in addition to making sure the command is run through nice also adds ‘--jobs’ argument. --- bin/make | 13 +++++++++++++ sh/shellrc | 1 - 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100755 bin/make diff --git a/bin/make b/bin/make new file mode 100755 index 0000000..3bd7fed --- /dev/null +++ b/bin/make @@ -0,0 +1,13 @@ +#!/bin/sh + +jobs= +if [ -z "$MAKEFLAGS" ] && jobs=$(grep -c ^processor /proc/cpuinfo); then + jobs=--jobs=$((jobs + jobs / 2)) +fi + +nice= +if [ "$(nice)" -le 0 ]; then + nice=nice +fi + +exec $nice /usr/bin/make $jobs "$@" diff --git a/sh/shellrc b/sh/shellrc index 40ef0f9..e78c33a 100644 --- a/sh/shellrc +++ b/sh/shellrc @@ -102,7 +102,6 @@ l () { } alias rmd=rmdir -alias make='nice make' if [ -x /usr/bin/ncal ]; then ncal() { -- 2.11.4.GIT