#!/bin/sh ######################################################################### # # FILE : maketargets # DATE : 26.01.2001 # AUTHOR : Patrick Meier / patrick.meier@gmx.net # DESCRIPTION : show targets in a Makefile # # Copyrigth (C) 2001 by Patrick Meier, Switzerland # ######################################################################### PN=`basename "$0"` STARTSTRING="==>" AWK="awk" ######################################################################### # Usage ######################################################################### Usage() { echo "$PN - extract targets from makefile" echo "usage: $PN [-v] [-f makefile]" echo " -f: use specified makefile instead of \"makefile\" or \"Makefile\"" exit 1 } ######################################################################### # ParameterFailed ######################################################################### ParameterFailed() { echo "${STARTSTRING}Parameter faild: $1 ..."; echo "" Usage } ######################################################################### # main ######################################################################### Makefile="" while [ $# -gt 0 ] do case "$1" in -f) if [ $# -gt 1 ] ; then Makefile="$2"; shift; else ParameterFailed "$1"; fi;; -h) Usage;; -*) Usage;; *) break;; esac shift done if [ -z "$Makefile" ] then for Makefile in makefile Makefile do [ -f "$Makefile" ] && { echo "${STARTSTRING}searching $Makefile..." break } done fi if [ -z "$Makefile" ] then echo "${STARTSTRING}No makefile $Makefile found" exit -1 fi if [ -f "$Makefile" ] then : else echo "${STARTSTRING}File $Makefile does not exist" exit -1 fi echo "${STARTSTRING}searching tags..." cat $Makefile | awk '$1 ~ /^.*\:$/ { print $1 }' | cut -d: -f1 ######################################################################### # EOF #########################################################################