aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-09-05 11:29:15 +1200
committerTom Ryder <tom@sanctum.geek.nz>2016-09-05 11:29:15 +1200
commit61c1c0be3c258635ad25dbbe652c4ccf30837324 (patch)
treead7c5af094acf4f2d3df894a719b5ad28e3894a7
parentClean up all/install-bin targets (diff)
downloaddotfiles-61c1c0be3c258635ad25dbbe652c4ccf30837324.tar.gz
dotfiles-61c1c0be3c258635ad25dbbe652c4ccf30837324.zip
Add umake(1df)
-rw-r--r--README.markdown2
-rwxr-xr-xbin/umake11
-rw-r--r--man/man1/umake.1df15
3 files changed, 28 insertions, 0 deletions
diff --git a/README.markdown b/README.markdown
index f1333be4..2b73547a 100644
--- a/README.markdown
+++ b/README.markdown
@@ -459,6 +459,8 @@ Installed by the `install-bin` target:
* `try(1df)` repeats a command up to a given number of times until it
succeeds, only printing error output if all three attempts failed. Good for
tolerating blips or temporary failures in `cron(8)` scripts.
+* `umake(1df)` iterates upwards through the directory tree from `$PWD` until
+ it finds a Makefile for which to run `make(1)` with the given arguments.
There's some silly stuff in `install-games`:
diff --git a/bin/umake b/bin/umake
new file mode 100755
index 00000000..8c8d4850
--- /dev/null
+++ b/bin/umake
@@ -0,0 +1,11 @@
+#!/bin/sh
+# Keep going up the tree until we find a Makefile, and then run make(1) with
+# any given args
+while [ "$PWD" != / ] ; do
+ if [ -f Makefile ] ; then
+ exec make "$@" || exit
+ fi
+ cd .. || exit
+done
+printf >&2 'umake: No Makefile found in ancestors\n'
+exit 1
diff --git a/man/man1/umake.1df b/man/man1/umake.1df
new file mode 100644
index 00000000..247ea50e
--- /dev/null
+++ b/man/man1/umake.1df
@@ -0,0 +1,15 @@
+.TH UMAKE 1df "September 2016" "Manual page for umake"
+.SH NAME
+.B umake
+\- run make(1) with the closest Makefile in current working directory ancestry
+.SH USAGE
+.B umake
+.br
+.B umake
+prefix=/foo/bar install
+.SH DESCRIPTION
+Iterate up through the directory tree starting with the current directory,
+looking for a Makefile, and run make(1) with the given arguments as soon as one
+is found.
+.SH AUTHOR
+Tom Ryder <tom@sanctum.geek.nz>