OSDN Git Service

[Build] Add bash script make with logging.
authorK.Ohta <whatisthis.sowhat@gmail.com>
Sun, 23 Oct 2022 15:06:14 +0000 (00:06 +0900)
committerK.Ohta <whatisthis.sowhat@gmail.com>
Sun, 23 Oct 2022 15:06:14 +0000 (00:06 +0900)
source/sample-scripts/make_with_log.sh [new file with mode: 0755]

diff --git a/source/sample-scripts/make_with_log.sh b/source/sample-scripts/make_with_log.sh
new file mode 100755 (executable)
index 0000000..c562411
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+CUR_DIR="$PWD"
+START_TIME="`date --rfc-3339=seconds`"
+
+LOG_NAME="000_make_log.${START_TIME}.log"
+
+_TIME=time 
+_MAKE=make
+_TEE=tee
+_NICE=nice
+NICEVAL=19
+
+printf "Begin ${START_TIME} \n" | ${_TEE} "${LOG_NAME}"
+printf "\n" | ${_TEE} -a "${LOG_NAME}"
+
+printf "MAKE ARGS=${@} \n\n" | ${_TEE} -a "${LOG_NAME}"
+printf "\n" | ${_TEE} -a "${LOG_NAME}"
+
+${_TIME} ${_NICE} -n ${NICEVAL} ${_MAKE} $@ 2>&1 | ${_TEE} -a "${LOG_NAME}"
+printf "\n" | ${_TEE} -a "${LOG_NAME}"
+printf "End `date --rfc-3339=seconds` .\n" | ${_TEE} -a "${LOG_NAME}"
+printf "\n" | ${_TEE} -a "${LOG_NAME}"