From c63dde2f683c96bcf9c883c533efc58882139ffc Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 6 Nov 2013 18:03:50 +0100 Subject: ship: add Quickstart Guide --- ship/README.markdown | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ship/README.markdown b/ship/README.markdown index 2882f732..8d2e8097 100644 --- a/ship/README.markdown +++ b/ship/README.markdown @@ -1,5 +1,14 @@ # ship - shellscript installation processor + This utility is used to build modular shell scripts using recursive macro + expansion. + +## Quickstart Guide + + BUILD_PATH=libs ./build compile INPUTFILE OUTPUTFILE + + If this doesen make science to you, then prepend `debug=true` to get all + the intermediate files printed to stdout. ## Make Interface -- cgit v1.2.3 From 58718154e9df9609448caf3098932f4df2a796e1 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 6 Nov 2013 18:04:15 +0100 Subject: ship: talk harder about Make Interface --- ship/README.markdown | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ship/README.markdown b/ship/README.markdown index 8d2e8097..01a63bd6 100644 --- a/ship/README.markdown +++ b/ship/README.markdown @@ -12,18 +12,21 @@ ## Make Interface - Build all executables from `src/` into `tmp/`: + Put libraries into `lib`. + Put executables into `src`. + + Build all executables from `src` into `tmp` with make [all] - Build all executables into `tmp/` and `//bin/`: + Build all executables from `src` into `tmp` and `//bin` with make install - Undo `make [all]`: + Undo `make [all]` with make clean - Undo `make install`: + Undo `make install` with make distclean -- cgit v1.2.3 From 20c7db3f85c066fc6c2abbf0ff7af47bdfdaadc9 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 6 Nov 2013 18:30:22 +0100 Subject: ship: talk about Macro Development --- ship/README.markdown | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/ship/README.markdown b/ship/README.markdown index 01a63bd6..9686d099 100644 --- a/ship/README.markdown +++ b/ship/README.markdown @@ -30,3 +30,25 @@ Undo `make install` with make distclean + +## Macro Development + + To define a new macro, you have to add a function like + + ## usage: BRE -> FUNCTION_NAME \1 [\2 ...] + + where `BRE` is a basic regular expression, that has to match a whole + line. `FUNCTION_NAME` should be the name of a function that outputs + a `sed` script. `\1` refers to the line number, where the macro is + used and `\2 ...` are the backreferences into `BRE`. E.g. + + ## usage: #@date \([.*]\) -> build_datemacro \1 \2 + build_datemacro() { + printf '%da\\\n%s\n' "$1" "$(date +"$2")" + } + + Like in this example, the line number `\1`, which gets mapped to `$1`, + is usually used to only change the line, where the macro got called. + The second argument gets passed as format specifier to `date`. + + Further examples can be found in `./build`. -- cgit v1.2.3 From b50fa72fc286a2302d90e137b738911cae9aebf0 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 6 Nov 2013 19:01:08 +0100 Subject: ship README: untypo --- ship/README.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ship/README.markdown b/ship/README.markdown index 9686d099..a84f542c 100644 --- a/ship/README.markdown +++ b/ship/README.markdown @@ -7,7 +7,7 @@ BUILD_PATH=libs ./build compile INPUTFILE OUTPUTFILE - If this doesen make science to you, then prepend `debug=true` to get all + If this doesn't make science to you, then prepend `debug=true` to get all the intermediate files printed to stdout. ## Make Interface -- cgit v1.2.3