$DIR $OBJECT ...

This commit is contained in:
Jörn-Michael Miehe 2019-09-24 14:20:37 +02:00
parent 66731ee148
commit 7e6d46244f
3 changed files with 14 additions and 14 deletions

View file

@ -1,4 +1,4 @@
#!/bin/bash
# $1:WATCHROOT (default: ".")
# $WATCHROOT (default: ".")
g_watchroot="$(readlink -f "${1:-.}")"

View file

@ -1,7 +1,7 @@
#!/bin/bash
# process an inotify event
do_handle() { # $1:FLAGS $2:OBJECT
do_handle() { # $FLAGS $OBJECT
# extract params
local flags="$1"
shift 1
@ -19,8 +19,8 @@ do_handle() { # $1:FLAGS $2:OBJECT
do_compile "${dir}" "${object}"
}
# compile a directory
do_compile() { # $1:DIR $2:OBJECT $3:DONE
# compile an OBJECT using build instructions found in DIRectory
do_compile() { # $DIR $OBJECT $DONE
# extract params
local dir="$1"
local object="$2"
@ -28,7 +28,7 @@ do_compile() { # $1:DIR $2:OBJECT $3:DONE
# build systems
for build_system in ${g_build_systems[@]}; do
do_build_system "${build_system}" "${dir}" "${object}" \
do_build_system "${dir}" "${object}" "${build_system}" \
&& local done="1"
done
@ -44,11 +44,11 @@ do_compile() { # $1:DIR $2:OBJECT $3:DONE
}
# use given BUILD_SYSTEM to process an OBJECT from a DIRectory
do_build_system() { # $1:BUILD_SYSTEM $2:DIR $3:OBJECT
do_build_system() { # $DIR $OBJECT $BUILD_SYSTEM
# extract params
local build_system="$1"
local dir="$2"
local object="$3"
local dir="$1"
local object="$2"
local build_system="$3"
# not done yet
local result=1
@ -61,7 +61,7 @@ do_build_system() { # $1:BUILD_SYSTEM $2:DIR $3:OBJECT
if [ -r "${file}" ]; then
# actually call into build system
echo -n "Found '${file}': "
do_${build_system} "$(basename "${file}")" "${dir}" "${object}" \
do_${build_system} "${dir}" "${object}" "$(basename "${file}")" \
&& local result=0
echo ""
fi

View file

@ -7,11 +7,11 @@ g_build_systems+=(make)
g_build_systems_glob[make]="Makefile *.mk"
# compile using bare make command
do_make() { # $1:MAKEFILE $2:DIR $3:OBJECT
do_make() { # $DIR $OBJECT $MAKEFILE
# extract params
local makefile="$1"
local dir="$2"
local object="$3"
local dir="$1"
local object="$2"
local makefile="$3"
# check Makefile 'source pattern'
local srcpat="$(grep -E "^#%SRCPAT%" "${dir}/${makefile}" | tail -n 1 | sed -r "s/^#%SRCPAT%\s+//")"