mirror of
https://github.com/ldericher/autodoc.git
synced 2025-12-06 15:43:01 +00:00
fine logging including make output
This commit is contained in:
parent
7e6d46244f
commit
91e186b7e2
4 changed files with 26 additions and 9 deletions
|
|
@ -14,6 +14,7 @@ declare -A g_build_systems_glob
|
|||
#
|
||||
|
||||
source "${g_lib}/globals"
|
||||
source "${g_lib}/logging"
|
||||
source "${g_lib}/plugins/"*".sh"
|
||||
source "${g_lib}/handle_inotify"
|
||||
|
||||
|
|
|
|||
|
|
@ -15,8 +15,9 @@ do_handle() { # $FLAGS $OBJECT
|
|||
fi
|
||||
|
||||
# start using toolchain
|
||||
echo -n "'${object}': '${flags}' in '${dir}'. "
|
||||
logline_append "'${object}': '${flags}' in '${dir}'."
|
||||
do_compile "${dir}" "${object}"
|
||||
logline_flush
|
||||
}
|
||||
|
||||
# compile an OBJECT using build instructions found in DIRectory
|
||||
|
|
@ -39,7 +40,7 @@ do_compile() { # $DIR $OBJECT $DONE
|
|||
|
||||
elif [ "${done}" == "0" ]; then
|
||||
# hit $g_watchroot
|
||||
echo "No build instructions found!"
|
||||
logline_append "Not a source file."
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
@ -60,10 +61,9 @@ do_build_system() { # $DIR $OBJECT $BUILD_SYSTEM
|
|||
# check file readability
|
||||
if [ -r "${file}" ]; then
|
||||
# actually call into build system
|
||||
echo -n "Found '${file}': "
|
||||
logline_append "Found '${file}':"
|
||||
do_${build_system} "${dir}" "${object}" "$(basename "${file}")" \
|
||||
&& local result=0
|
||||
echo ""
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
|
|
|||
12
build/usr/local/lib/autodoc/logging
Normal file
12
build/usr/local/lib/autodoc/logging
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
g_logline=""
|
||||
|
||||
logline_append() { # $STRING
|
||||
g_logline="${g_logline}${1} "
|
||||
}
|
||||
|
||||
logline_flush() {
|
||||
echo "${g_logline}"
|
||||
g_logline=""
|
||||
}
|
||||
|
|
@ -17,7 +17,7 @@ do_make() { # $DIR $OBJECT $MAKEFILE
|
|||
local srcpat="$(grep -E "^#%SRCPAT%" "${dir}/${makefile}" | tail -n 1 | sed -r "s/^#%SRCPAT%\s+//")"
|
||||
|
||||
if [ -z "${srcpat}" ]; then
|
||||
echo -n "Empty source pattern, check '#%SRCPAT%' annotation! "
|
||||
logline_append "Empty source pattern, check '#%SRCPAT%' annotation!"
|
||||
return 1
|
||||
|
||||
elif [[ "${object}" =~ ${srcpat} ]]; then
|
||||
|
|
@ -25,15 +25,19 @@ do_make() { # $DIR $OBJECT $MAKEFILE
|
|||
local target="$(grep -E "^autodoc:" "${dir}/${makefile}" | sed -r "s/:.*$//")"
|
||||
|
||||
if [ -z "${target}" ]; then
|
||||
echo "Running 'make'. "
|
||||
logline_append "Running 'make'!"
|
||||
else
|
||||
echo "Making '${target}'. "
|
||||
logline_append "Making '${target}'!"
|
||||
fi
|
||||
|
||||
make --no-print-directory -C "${dir}" -f "${makefile}" -j ${target}
|
||||
# actually run "make" and save (truncated) output
|
||||
local makelog="$(make --no-print-directory -C "${dir}" -f "${makefile}" -j ${target})"
|
||||
logline_append "$(echo "${makelog}" | head -n 10 | sed 's/$/;/g' | tr '\n' ' ' | sed 's/ *$//')"
|
||||
|
||||
logline_append "Done."
|
||||
|
||||
else
|
||||
echo -n "SRCPAT '${srcpat}' mismatch. "
|
||||
logline_append "SRCPAT '${srcpat}' mismatch."
|
||||
return 1
|
||||
fi
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue