Return to MakeMakefile.sh CVS log | Up to [OMI] / omi / mak |
File: [OMI] / omi / mak / MakeMakefile.sh
(download)
/
(as text)
Revision: 1.1.1.1 (vendor branch), Wed May 30 21:47:49 2012 UTC (12 years, 1 month ago) by mike Branch: TOG CVS Tags: OMI_1_0_2_Branch, OMI_1_0_1_PRE, OMI_1_0_1, OMI_1_0_0 Changes since 1.1: +0 -0 lines Initial Import |
#!/bin/bash ##============================================================================== ## ## Check arguments ## ##============================================================================== if [ "$#" = "0" ]; then echo "Usage: $0 (lib|cshlib|cxxshlib|cprog|cxxprog) [OPTIONS]" echo "Try --help for help." exit 1 fi case $1 in -*) ;; *) TYPE=$1 shift 1 esac ##============================================================================== ## ## Get command line arguments. ## ##============================================================================== for opt do arg=`expr "x$opt" : 'x[^=]*=\(.*\)'` case $opt in -h | --help) HELP=1 ;; --top=*) TOP=$arg ;; --project=*) PROJECT=$arg ;; --guid=*) GUID=$arg ;; --sources=*) SOURCES=$arg ;; --headers=*) HEADERS=$arg ;; --defines=*) DEFINES=$arg ;; --includes=*) INCLUDES=$arg ;; --libraries=*) LIBRARIES=$arg ;; *) echo "$0: unknown option: $opt" exit 1 ;; esac done ##============================================================================== ## ## Print the help message ## ##============================================================================== if [ "$HELP" = "1" ]; then cat<<EOF Usage: $0 (lib|cshlib|cxxshlib|cprog|cxxprog) [OPTIONS] OVERVIEW: This script generates a makefile (called 'GNUmakefile'). OPTIONS: -h, --help Print this help message. --top Relative directory that contains 'configure' script. --project Name of project (defaults to current directory name). --guid GUID for this project (generated by default). --sources List of source files (defaults to *.c and *.cpp). --headers List of headers files (defaults to *.h). --defines List macros definitions. --includes List of include paths (relative to current directory). --libraries List of dependent library names. EOF exit 0 fi ##============================================================================== ## ## $TYPE ## ##============================================================================== case $TYPE in lib) TYPE=LIBRARY ;; cshlib) TYPE=CSHLIBRARY ;; cxxshlib) TYPE=CXXSHLIBRARY ;; cprog) TYPE=CPROGRAM ;; cxxprog) TYPE=CXXPROGRAM ;; *) echo "$0: unknown or missing type argument: '$TYPE'" echo "" exit 1 ;; esac ##============================================================================== ## ## $TOP ## ##============================================================================== if [ "$TOP" == "" ]; then if [ -f "../configure" ]; then TOP=.. fi if [ -f "../../configure" ]; then TOP=../.. fi if [ -f "../../../configure" ]; then TOP=../../.. fi if [ -f "../../../../configure" ]; then TOP=../../../.. fi if [ -f "../../../../../configure" ]; then TOP=../../../../.. fi if [ -f "../../../../../../configure" ]; then TOP=../../../../../.. fi if [ -f "../../../../../../../configure" ]; then TOP=../../../../../../.. fi if [ "$TOP" == "" ]; then echo "$0: unable to find top (please use --top option)" exit 1 fi fi ##============================================================================== ## ## $PROJECT ## ##============================================================================== if [ "$PROJECT" = "" ]; then TMP=`pwd` PROJECT=`basename $TMP` fi ##============================================================================== ## ## $GUID ## ##============================================================================== if [ "$GUID" = "" ]; then GUID=`uuidgen | tr abcdef ABCDEF` fi ##============================================================================== ## ## $SOURCES ## ##============================================================================== if [ "$SOURCES" = "" ]; then SOURCES="`ls *.c 2> /dev/null``ls *.cpp 2> /dev/null`" fi ##============================================================================== ## ## $HEADERS ## ##============================================================================== if [ "$HEADERS" = "" ]; then HEADERS="`ls *.h 2> /dev/null`" fi ##============================================================================== ## ## Write 'GNUmakefile' ## ##============================================================================== cat > GNUmakefile <<END TOP = $TOP include \$(TOP)/config.mak $TYPE = $PROJECT GUID = $GUID SOURCES = $SOURCES HEADERS = $HEADERS DEFINES = $DEFINES INCLUDES = \$(TOP) \$(TOP)/common $INCLUDES LIBRARIES = $LIBRARIES include \$(TOP)/mak/rules.mak END echo "Created GNUmakefile"
ViewCVS 0.9.2 |