]> rtime.felk.cvut.cz Git - omk.git/commitdiff
OMK shell alias replaced with a shell script
authorMichal Sojka <sojkam1@fel.cvut.cz>
Thu, 29 Jan 2009 12:26:56 +0000 (13:26 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Thu, 29 Jan 2009 12:26:56 +0000 (13:26 +0100)
The advantage of the script over alias is that it can be run from other
programs (e.g. editors).

omk [new file with mode: 0755]
omk-alias.sh [deleted file]

diff --git a/omk b/omk
new file mode 100755 (executable)
index 0000000..89e66cb
--- /dev/null
+++ b/omk
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+# Helper script to run OMK from directories without the leaf OMK Makefile
+
+omk_rules=$(
+old_pwd=""
+while [ ! -e Makefile.rules ]; do
+       if [ "$old_pwd" = `pwd`  ]; then 
+              echo "Makefile.rules has not been found in this or parent directory" >&2; exit 1; 
+       else
+              old_pwd=`pwd`; 
+              cd -L .. 2>/dev/null; 
+       fi; 
+done; 
+echo `pwd`/Makefile.rules
+)
+
+[ "$omk_rules" ] && make -f $omk_rules "$@"
diff --git a/omk-alias.sh b/omk-alias.sh
deleted file mode 100644 (file)
index c525a20..0000000
+++ /dev/null
@@ -1 +0,0 @@
-alias omk='_omk_rules=$(old_pwd=""; while [ ! -e Makefile.rules ]; do if [ "$old_pwd" = `pwd`  ]; then echo "Makefile.rules has not been found in this or parent directory" >&2; exit 1; else old_pwd=`pwd`; cd -L .. 2>/dev/null; fi; done; echo `pwd`/Makefile.rules); [ "$_omk_rules" ] && make -f $_omk_rules'