diff options
Diffstat (limited to 'make.sh')
-rwxr-xr-x | make.sh | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -12,6 +12,7 @@ set -e DEFS= +FUNCTIONS= for file in modules/**/*.inc; do name="${file#modules/}" @@ -24,12 +25,18 @@ for file in modules/**/*.inc; do rm -f -- slx-tools exit 1 fi + FUNCTIONS="${FUNCTIONS%, }"'\n ' for var in $( grep -oP '^[a-z0-9_]+\s*\(\)' "$file" | grep -oE '^[a-z0-9_]+' ); do - echo "Found $var" + if ! [[ "$var" == "$name"* ]]; then + echo "- IGNORING $var" + continue + fi + echo "+ Including $var" DEFS+="$var() { . \$BASE/$file; $var "'"$@"; }\n' + FUNCTIONS+="$var, " done done -sed "s#%DEFS%#${DEFS}#;s#^BASE=.*\$#BASE='$BASE'#" slx-tools.template > slx-tools +sed "s#%DEFS%#${DEFS}#;s#%FUNCTIONS%#${FUNCTIONS%, }#;s#^BASE=.*\$#BASE='$BASE'#" slx-tools.template > slx-tools chmod +x slx-tools |