Mesa (master): mklib: put usage info into usage() function

Brian Paul brianp at kemper.freedesktop.org
Thu Dec 24 06:25:17 PST 2009


Module: Mesa
Branch: master
Commit: 57cce7a409724a261c6dae6c979496a630167742
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=57cce7a409724a261c6dae6c979496a630167742

Author: Brian Paul <brianp at vmware.com>
Date:   Wed Dec 23 16:55:37 2009 -0700

mklib: put usage info into usage() function

---

 bin/mklib |   60 +++++++++++++++++++++++++++++++++---------------------------
 1 files changed, 33 insertions(+), 27 deletions(-)

diff --git a/bin/mklib b/bin/mklib
index 486f27f..fb160a2 100755
--- a/bin/mklib
+++ b/bin/mklib
@@ -69,6 +69,36 @@ contents_of_archives() {
 }
 
 
+# Print usage info.
+usage() {
+    echo 'Usage: mklib [options] objects'
+    echo 'Create a shared library from object files.'
+    echo '  -o LIBRARY    specifies the name of the resulting library, without'
+    echo '                the leading "lib" or any suffix.'
+    echo '                (eg: "-o GL" might result in "libGL.so" being made)'
+    echo '  -major N      specifies major version number (default is 1)'
+    echo '  -minor N      specifies minor version number (default is 0)'
+    echo '  -patch N      specifies patch version number (default is 0)'
+    echo '  -lLIBRARY     specifies a dependency on LIBRARY'
+    echo '  -LDIR         search in DIR for library dependencies at build time'
+    echo '  -RDIR         search in DIR for library dependencies at run time'
+    echo '  -linker L     explicity specify the linker program to use (eg: gcc, g++)'
+    echo '                Not observed on all systems at this time.'
+    echo '  -ldflags OPT  specify any additional linker flags in OPT'
+    echo '  -cplusplus    link with C++ runtime'
+    echo '  -static       make a static library (default is dynamic/shared)'
+    echo '  -dlopen       make a shared library suitable for dynamic loading'
+    echo '  -install DIR  put resulting library file(s) in DIR'
+    echo '  -arch ARCH    override using `uname` to determine host system'
+    echo '  -archopt OPT  specify an extra achitecture-specific option OPT'
+    echo '  -altopts OPTS alternate options to override all others'
+    echo "  -noprefix     don't prefix library name with 'lib' nor add any suffix"
+    echo '  -exports FILE only export the symbols listed in FILE'
+    echo '  -id NAME      Sets the id of the dylib (Darwin)'
+    echo '  -h, --help    display this information and exit'
+}
+
+
 #
 # Option defaults
 #
@@ -96,31 +126,7 @@ while true
 do
     case $1 in
 	'-h' | '--help')
-	    echo 'Usage: mklib [options] objects'
-	    echo 'Create a shared library from object files.'
-	    echo '  -o LIBRARY    specifies the name of the resulting library, without'
-	    echo '                the leading "lib" or any suffix.'
-	    echo '                (eg: "-o GL" might result in "libGL.so" being made)'
-	    echo '  -major N      specifies major version number (default is 1)'
-	    echo '  -minor N      specifies minor version number (default is 0)'
-	    echo '  -patch N      specifies patch version number (default is 0)'
-	    echo '  -lLIBRARY     specifies a dependency on LIBRARY'
-	    echo '  -LDIR         search in DIR for library dependencies at build time'
-	    echo '  -RDIR         search in DIR for library dependencies at run time'
-	    echo '  -linker L     explicity specify the linker program to use (eg: gcc, g++)'
-	    echo '                Not observed on all systems at this time.'
-	    echo '  -ldflags OPT  specify any additional linker flags in OPT'
-	    echo '  -cplusplus    link with C++ runtime'
-	    echo '  -static       make a static library (default is dynamic/shared)'
-	    echo '  -dlopen       make a shared library suitable for dynamic loading'
-	    echo '  -install DIR  put resulting library file(s) in DIR'
-	    echo '  -arch ARCH    override using `uname` to determine host system'
-	    echo '  -archopt OPT  specify an extra achitecture-specific option OPT'
-	    echo '  -altopts OPTS alternate options to override all others'
-	    echo "  -noprefix     don't prefix library name with 'lib' nor add any suffix"
-	    echo '  -exports FILE only export the symbols listed in FILE'
-	    echo '  -id NAME      Sets the id of the dylib (Darwin)'
-	    echo '  -h, --help    display this information and exit'
+	    usage
 	    exit 1
 	    ;;
 	'-o')
@@ -241,11 +247,11 @@ fi
 # Error checking
 #
 if [ "x${LIBNAME}" = "x" ] ; then
-    echo "mklib: Error: no library name specified"
+    echo "mklib: Error: no library name specified (-h for help)"
     exit 1
 fi
 if [ "x${OBJECTS}" = "x" ] ; then
-    echo "mklib: Error: no object files specified"
+    echo "mklib: Error: no object files specified (-h for help)"
     exit 1
 fi
 



More information about the mesa-commit mailing list