mklib: put usage info into usage() function
authorBrian Paul <brianp@vmware.com>
Wed, 23 Dec 2009 23:55:37 +0000 (16:55 -0700)
committerBrian Paul <brianp@vmware.com>
Thu, 24 Dec 2009 14:24:33 +0000 (07:24 -0700)
bin/mklib

index 486f27fb49706abee85395eabd27bd79081977c0..fb160a2aae92e9dc56ce613971e0be24979ba743 100755 (executable)
--- 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