diff --git a/README b/README index d8a0916..2d7ea52 100755 --- a/README +++ b/README @@ -1,10 +1,11 @@ --- README -A tool to run embedded scripts. +Run embedded scripts. -Bootstrap with ./shake bake.l +Bootstrap with ./awake bake.l then compile further with ./bake, -install by running ./install.sh + +or JUST install by running ./install.sh (has --help) --- @@ -17,12 +18,11 @@ of @STOP. All @BAKE ... @STOP statements must become before any @BAKE ... EOLs. It expands some macros, - @FILENAME @FILE @NAME - filename + @FILE - filename @SHORT - filename without suffix (abc.x.txt \-> abc.x) @SHORT:N - removes N suffixes, so (a.b.c 2 -> a) @ARGS - other arguments to the program - @ARGS:N - Provides the Nth argument, starting from -0 + @ARGS:N - Provides the Nth argument, starting from 0 @ARGS:N+ - All arguments at and after Nth @RECURS - the full path name to the executable @LINE - line number at the selected @BAKE @@ -31,10 +31,10 @@ All macros can be exempted by prefixing them with a backslash, which'll be subtracted in the expansion. commands may be spanned over several lines with a leading backslash. --h --help | Help message +-h --help | Help message -n --dry-run | don't execute or remove anything --c --color | disables color --l --list | lists available Bake blocks +-c --color | disables color +-l --list | lists available Bake blocks -s --select | selects Nth Bake block -x --expunge | Removes the file specified in the expunge block @@ -59,6 +59,16 @@ Changelog Bake was created on 2023/09/13, and complete as of 2024/03/02. +2024-03-02 + +Initial relaase + +2024-04-04 + +Expunge & color. + +2024-04 - 2024-08 - 3 Tags of bump -> minor fixes and improvements + 2024-09-27 Lex. As adviced by the original creator, I learned and implemented @@ -75,3 +85,23 @@ to the BSDs. cd /dir/of/file; awake file See --help + +2025-01-04 + +Introducing some breaking changes. +Remove @FILENAME @NAME, and @FILE_NAME (heyo) leaving only @FILE. +Upgraded ./install.sh to have options. + +s/@(FILE_?NAME|NAME)/@FILE/g + +I'm finished with tool for the rest of time and have put zero effort +into it this time. If I use it and it breaks, I'll fix it or replace +it with something better. + +Anonson, the original creator made a ebuild for Gentoo a few months +ago, and I will link it here when I receive that link from him. I may +one day dare to package Bake as a deb. I would likely have to rename +bake to ebake, which is somehow worse than the original name of eMake. + +ebuild: +debian: (perhaps forever) diff --git a/awake b/awake index d951b4e..1d308d2 100755 --- a/awake +++ b/awake @@ -69,7 +69,7 @@ BEGIN { if (list) { print bakenum": "$0 } else if (select == bakenum) { - gsub(/\$@|@(FILE_NAME|FILENAME|FILE|NAME)/, filename) + gsub(/\$@|@FILE/, filename) gsub(/\$\*|@SHORT/, shortname) gsub(/\$\+|@ARGS/, extraargs) gsub(/@RECURS/, ARGV[0]) diff --git a/bake.1 b/bake.1 index 241df30..b4a5eab 100755 --- a/bake.1 +++ b/bake.1 @@ -35,7 +35,7 @@ extend a command over several lines. These macros will expand to their counterpart before execution. .TP -.B @FILENAME, @FILE, @NAME, $@ +.B @NAME, $@ returns target\-file (abc.x.txt) .TP .B @SHORT, $* diff --git a/bake.l b/bake.l index 50c3b31..4b8248a 100755 --- a/bake.l +++ b/bake.l @@ -28,8 +28,8 @@ extern void shorten(char * filename, int n); SPACE [ \t\r\v\f] /* Everything that can be backslashed */ -FILENAME (@FILE_NAME|@FILENAME|@FILE|@NAME) -CMD @BAKE[[:space:]] +FILENAME @FILE +CMD @BAKE[[:space:]] MACROS ({CMD}|@STOP|{FILENAME}|@SHORT|@ARGS|@LINE|@RECURS|$@|$*|$+|@\{) %x FOUND PADDING STOP diff --git a/install.sh b/install.sh index e2668c3..e806512 100755 --- a/install.sh +++ b/install.sh @@ -1,6 +1,8 @@ #!/bin/sh # source install +cd "$(dirname "$(readlink -f $0)")" || exit + TARGET="${TARGET:-/usr/local}" INSTALL="bake" @@ -9,6 +11,7 @@ usage() { echo "" echo "--alternatives Includes awake and shake into the build" echo "--target=DIRECTORY Target directory like /usr or /usr/local" + echo "--prebuilt Program is prebuilt" echo "" exit 1 } @@ -24,6 +27,9 @@ while [ ! -z $1 ]; do "--help") usage ;; + "--prebuilt") + BUILD=1 + ;; *) echo "Unknown option: " $1 usage @@ -32,9 +38,10 @@ while [ ! -z $1 ]; do shift done -cd "$(dirname "$(readlink -f $0)")" +if [ -z $BUILD ]; then + ./awake bake.l +fi -./awake bake.l mkdir -p "$TARGET/bin" "$TARGET/man/man1" install -m 755 $INSTALL "$TARGET/bin" gzip -c bake.1 > "$TARGET/man/man1/bake.1.gz" diff --git a/shake b/shake index e2cf120..21637c4 100755 --- a/shake +++ b/shake @@ -76,12 +76,9 @@ if [[ -n $line ]]; then line=${line//\$@/$input_file} line=${line//\$\*/${input_file%.*}} line=${line//\$+/$@} - line=${line//@FILE_NAME/$input_file} line=${line//@FILENAME/$input_file} line=${line//@SHORT/${input_file%.*}} line=${line//@ARGS/$@} - line=${line//@NAME/$input_file} - line=${line//@FILE/$input_file} line=$(echo "$line" | sed 's/@STOP.*//') echo -e "${BOLD}${GREEN}$0${NORMAL}: ${line#*${MARK}}"