mirror of
https://gitlab.com/shorewall/code.git
synced 2025-01-03 12:09:14 +01:00
Take 2 on conditional compilation.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
7215b61aa4
commit
3923092468
@ -3367,6 +3367,8 @@ shorewall_cli() {
|
|||||||
g_timestamp=
|
g_timestamp=
|
||||||
g_shorewalldir=
|
g_shorewalldir=
|
||||||
g_haveconfig=
|
g_haveconfig=
|
||||||
|
g_conditional=
|
||||||
|
g_file=
|
||||||
|
|
||||||
VERBOSE=
|
VERBOSE=
|
||||||
VERBOSITY=1
|
VERBOSITY=1
|
||||||
|
@ -399,6 +399,11 @@ compiler() {
|
|||||||
[ -f "$shorewallrc1" ] || fatal_error "Compiling for export requires a shorewallrc file"
|
[ -f "$shorewallrc1" ] || fatal_error "Compiling for export requires a shorewallrc file"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -n "$g_conditional" ] && uptodate $g_file; then
|
||||||
|
echo "$g_file is up to date -- no compilation required"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
options="--verbose=$VERBOSITY --family=$g_family --config_path=$CONFIG_PATH --shorewallrc=${shorewallrc}"
|
options="--verbose=$VERBOSITY --family=$g_family --config_path=$CONFIG_PATH --shorewallrc=${shorewallrc}"
|
||||||
[ -n "$shorewallrc1" ] && options="$options --shorewallrc1=${shorewallrc1}"
|
[ -n "$shorewallrc1" ] && options="$options --shorewallrc1=${shorewallrc1}"
|
||||||
[ -n "$STARTUP_LOG" ] && options="$options --log=$STARTUP_LOG"
|
[ -n "$STARTUP_LOG" ] && options="$options --log=$STARTUP_LOG"
|
||||||
@ -599,7 +604,6 @@ start_command() {
|
|||||||
compile_command() {
|
compile_command() {
|
||||||
local finished
|
local finished
|
||||||
finished=0
|
finished=0
|
||||||
local conditional
|
|
||||||
|
|
||||||
while [ $finished -eq 0 ]; do
|
while [ $finished -eq 0 ]; do
|
||||||
[ $# -eq 0 ] && break
|
[ $# -eq 0 ] && break
|
||||||
@ -631,7 +635,7 @@ compile_command() {
|
|||||||
option=${option#d}
|
option=${option#d}
|
||||||
;;
|
;;
|
||||||
c*)
|
c*)
|
||||||
conditional=Yes;
|
g_conditional=Yes;
|
||||||
option=${option#c}
|
option=${option#c}
|
||||||
;;
|
;;
|
||||||
T*)
|
T*)
|
||||||
@ -654,15 +658,15 @@ compile_command() {
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
file=
|
g_file=
|
||||||
|
|
||||||
case $# in
|
case $# in
|
||||||
0)
|
0)
|
||||||
[ -n "$g_export" ] && file=firewall || file=${VARDIR}/firewall
|
[ -n "$g_export" ] && g_file=firewall || g_file=${VARDIR}/firewall
|
||||||
;;
|
;;
|
||||||
1)
|
1)
|
||||||
file=$1
|
g_file=$1
|
||||||
[ -d $file ] && fatal_error "$file is a directory"
|
[ -d $g_file ] && fatal_error "$g_file is a directory"
|
||||||
;;
|
;;
|
||||||
2)
|
2)
|
||||||
[ -n "$g_shorewalldir" -a -z "$g_export" ] && usage 2
|
[ -n "$g_shorewalldir" -a -z "$g_export" ] && usage 2
|
||||||
@ -676,21 +680,16 @@ compile_command() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
g_shorewalldir=$(resolve_file $1)
|
g_shorewalldir=$(resolve_file $1)
|
||||||
file=$2
|
g_file=$2
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
usage 1
|
usage 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [ -n "$conditional" ] && uptodate $file; then
|
[ "x$g_file" = x- ] || progress_message3 "Compiling..."
|
||||||
echo "$file is up to date -- no compilation required"
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
[ "x$file" = x- ] || progress_message3 "Compiling..."
|
|
||||||
|
|
||||||
compiler $g_debugging compile $file && run_postcompile $file
|
compiler $g_debugging compile $g_file && run_postcompile $g_file
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
|
Loading…
Reference in New Issue
Block a user