mirror of
https://github.com/ldericher/autodoc.git
synced 2025-12-06 15:43:01 +00:00
minor bugfixes, Makefile name parameter for do_make
This commit is contained in:
parent
e782a6f5ea
commit
ac0d9d08b5
1 changed files with 15 additions and 15 deletions
|
|
@ -4,27 +4,28 @@
|
||||||
g_watchroot="$(readlink -f "${1:-.}")"
|
g_watchroot="$(readlink -f "${1:-.}")"
|
||||||
|
|
||||||
# compile using bare make command
|
# compile using bare make command
|
||||||
do_make() { # $1:DIR $2:OBJECT
|
do_make() { # $1:DIR $2:MAKEFILE $3:OBJECT
|
||||||
# extract params
|
# extract params
|
||||||
local dir="$1"
|
local dir="$1"
|
||||||
local object="$2"
|
local makefile="$2"
|
||||||
|
local object="$3"
|
||||||
|
|
||||||
# extract Makefile 'source pattern'
|
# extract Makefile 'source pattern'
|
||||||
local srcpat="$(grep -E "^#@SRCPAT" "${dir}/Makefile" | tail -n 1 | sed -r "s/^#@SRCPAT\s+//")"
|
local srcpat="$(grep -E "^#@SRCPAT" "${dir}/${makefile}" | tail -n 1 | sed -r "s/^#@SRCPAT\s+//")"
|
||||||
|
|
||||||
if [ -z "${srcpat}" ]; then
|
if [ -z "${srcpat}" ]; then
|
||||||
echo "Empty source pattern! Makefile needs '#@SRCPAT' annotation!"
|
echo "Empty source pattern, check '#@SRCPAT' annotation!"
|
||||||
|
|
||||||
elif [[ "${object}" =~ ${srcpat} ]]; then
|
elif [[ "${object}" =~ ${srcpat} ]]; then
|
||||||
# check for autodoc target
|
# check for autodoc target
|
||||||
local target="$(grep -E "^autodoc:" "${dir}/Makefile" | sed -r "s/:.*$//")"
|
local target="$(grep -E "^autodoc:" "${dir}/${makefile}" | sed -r "s/:.*$//")"
|
||||||
local target="${target:-all}"
|
# local target="${target:-all}" # fallback target: all
|
||||||
|
|
||||||
echo "SRCPAT OK, building '${target}'."
|
echo "Making '${target}'."
|
||||||
make --no-print-directory -C "${dir}" -j "${target}"
|
make --no-print-directory -C "${dir}" -j ${target}
|
||||||
|
|
||||||
else
|
else
|
||||||
echo "SRCPAT mismatch '${srcpat}'."
|
echo "SRCPAT '${srcpat}' mismatch."
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -39,16 +40,15 @@ do_compile() { # $1:DIR $2:OBJECT $3:DONE
|
||||||
|
|
||||||
if [ -r "${dir}/Makefile" ]; then
|
if [ -r "${dir}/Makefile" ]; then
|
||||||
# Makefile found
|
# Makefile found
|
||||||
echo -n "Using '${dir}/Makefile'. "
|
echo -n "Found '${dir}/Makefile'. "
|
||||||
do_make "${dir}" "${object}"
|
do_make "${dir}" "Makefile" "${object}"
|
||||||
local done="1"
|
local done="1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# search parent dir for more build instructions
|
|
||||||
if [ "${dir}" != "${g_watchroot}" ]; then
|
|
||||||
# never leave $g_watchroot
|
# never leave $g_watchroot
|
||||||
local dir="$(dirname "${dir}")"
|
if [ "${dir}" != "${g_watchroot}" ]; then
|
||||||
do_compile "${dir}" "${object}" "${done}"
|
# search parent dir for more build instructions
|
||||||
|
do_compile "$(dirname "${dir}")" "${object}" "${done}"
|
||||||
|
|
||||||
elif [ "${done}" == "0" ]; then
|
elif [ "${done}" == "0" ]; then
|
||||||
# hit $g_watchroot
|
# hit $g_watchroot
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue