allow running naked

This commit is contained in:
2023-08-23 11:08:10 +03:00
parent 9c16b1af53
commit bfac4aadc6
2 changed files with 6 additions and 3 deletions

View File

@@ -72,6 +72,9 @@ _subcommand() {
echo foo # NOTE: Bakefile gets sourced when read!
somevar=value
if [ -z "$BAKEFILE" ]; then
echo This part is run if the file is sourced and not run in Bake
fi
```

6
bake
View File

@@ -1,5 +1,5 @@
#!/bin/bash
## VERSION 22.6.10
## VERSION 23.8.23
## BASH-MAKE ==========================================================
## Utility to mimick some of GNU Make behavior, but run in a single
## bash shell. This executable can be used as the Bakefile, too,
@@ -12,13 +12,13 @@ set -e
# In standalone mode, this script also contains targets
STANDALONE=${STANDALONE:-false}
if [[ $STANDALONE = true ]]; then
BAKEFILE=$0
export BAKEFILE=$0
else
if [[ -z "$BAKEFILE" ]]; then
# BAKEFILE not set externally
for BAKEDEFAULT in Bakefile bakefile /dev/null; do
if [[ -f ./$BAKEDEFAULT ]]; then
BAKEFILE=./$BAKEDEFAULT
export BAKEFILE=./$BAKEDEFAULT
break
fi
done