$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 #!/bin/bash
# $1:WATCHROOT (default: ".") # $WATCHROOT (default: ".")
g_watchroot="$(readlink -f "${1:-.}")" g_watchroot="$(readlink -f "${1:-.}")"

View file

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

View file

@ -7,11 +7,11 @@ g_build_systems+=(make)
g_build_systems_glob[make]="Makefile *.mk" g_build_systems_glob[make]="Makefile *.mk"
# compile using bare make command # compile using bare make command
do_make() { # $1:MAKEFILE $2:DIR $3:OBJECT do_make() { # $DIR $OBJECT $MAKEFILE
# extract params # extract params
local makefile="$1" local dir="$1"
local dir="$2" local object="$2"
local object="$3" local makefile="$3"
# check Makefile 'source pattern' # check 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+//")"