Revision 9122
Added by Aaron Marcuse-Kubitza about 11 years ago
lib/sh/make.sh | ||
---|---|---|
14 | 14 |
alias remaking='test "$remake"' |
15 | 15 |
|
16 | 16 |
# usage: set_make_vars; check_target_exists |
17 |
alias check_target_exists='remaking || require_exists "$target" || return 0' |
|
17 |
alias check_target_exists='remaking || require_not_exists "$target" || return 0'
|
|
18 | 18 |
alias check_fake_target_exists='remaking || declare if_not_exists=1' |
19 | 19 |
# defer check until to_file |
20 | 20 |
|
lib/sh/util.sh | ||
---|---|---|
349 | 349 |
top_script="$0" # outermost script |
350 | 350 |
top_dir="$(dirname "$top_script")" |
351 | 351 |
|
352 |
require_exists() # usage: require_exists file || return 0
|
|
352 |
require_not_exists() # usage: require_not_exists file || return 0
|
|
353 | 353 |
{ test ! -e "$1" || type=info die "file "$1" already exists, skipping"; } |
354 | 354 |
|
355 | 355 |
# auto-removes a command's output file on error (like make's .DELETE_ON_ERROR) |
... | ... | |
357 | 357 |
{ |
358 | 358 |
echo_func |
359 | 359 |
: "${stdout?}"; echo_vars stdout |
360 |
test ! "$if_not_exists" || require_exists "$stdout" || return 0 |
|
360 |
test ! "$if_not_exists" || require_not_exists "$stdout" || return 0
|
|
361 | 361 |
"$@" >"$stdout" || { save_e; log_e; rm "$stdout"; rethrow; } |
362 | 362 |
} |
363 | 363 |
alias to_file='to_file ' # last space alias-expands next word |
Also available in: Unified diff
lib/sh/util.sh: renamed require_exists() to require_not_exists() because the command actually checks if the file doesn't exist