small tool: amm (aubit4gl-make-make)

Peter Schubert <[email protected]>
Newsgroups gmane.comp.lang.4gl.aubit.general
Organization SACO GmbH
Message-ID <[email protected]>
Hi,
here a small tool, to build makefiles for aubit4gl programs.
-------------
#!/bin/sh
# This is a shell archive (produced by GNU sharutils 4.9).
# To extract the files from this archive, save it to some FILE, remove
# everything before the `#!/bin/sh' line above, then type `sh FILE'.
#
lock_dir=_sh27938
# Made on 2012-02-22 16:21 CET by <psc>.
#
# Existing files will *not* be overwritten, unless `-c' is specified.
#
# This shar contains:
# length mode       name
# ------ ---------- ------------------------------------------
#   3133 -rwxr-xr-x amm
#
MD5SUM=${MD5SUM-md5sum}
f=`${MD5SUM} --version | egrep '^md5sum .*(core|text)utils'`
test -n "${f}" && md5check=true || md5check=false
${md5check} || \
   echo 'Note: not verifying md5sums.  Consider installing GNU coreutils.'
save_IFS="${IFS}"
IFS="${IFS}:"
gettext_dir=FAILED
locale_dir=FAILED
first_param="$1"
for dir in $PATH
do
   if test "$gettext_dir" = FAILED && test -f $dir/gettext \
      && ($dir/gettext --version >/dev/null 2>&1)
   then
     case `$dir/gettext --version 2>&1 | sed 1q` in
       *GNU*) gettext_dir=$dir ;;
     esac
   fi
   if test "$locale_dir" = FAILED && test -f $dir/shar \
      && ($dir/shar --print-text-domain-dir >/dev/null 2>&1)
   then
     locale_dir=`$dir/shar --print-text-domain-dir`
   fi
done
IFS="$save_IFS"
if test "$locale_dir" = FAILED || test "$gettext_dir" = FAILED
then
   echo=echo
else
   TEXTDOMAINDIR=$locale_dir
   export TEXTDOMAINDIR
   TEXTDOMAIN=sharutils
   export TEXTDOMAIN
   echo="$gettext_dir/gettext -s"
fi
if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null
then if (echo -n test; echo 1,2,3) | grep n >/dev/null
      then shar_n= shar_c='
'
      else shar_n=-n shar_c= ; fi
else shar_n= shar_c='\c' ; fi
f=shar-touch.$$
st1=200112312359.59
st2=123123592001.59
st2tr=123123592001.5 # old SysV 14-char limit
st3=1231235901

if touch -am -t ${st1} ${f} >/dev/null 2>&1 && \
    test ! -f ${st1} && test -f ${f}; then
   shar_touch='touch -am -t $1$2$3$4$5$6.$7 "$8"'

elif touch -am ${st2} ${f} >/dev/null 2>&1 && \
    test ! -f ${st2} && test ! -f ${st2tr} && test -f ${f}; then
   shar_touch='touch -am $3$4$5$6$1$2.$7 "$8"'

elif touch -am ${st3} ${f} >/dev/null 2>&1 && \
    test ! -f ${st3} && test -f ${f}; then
   shar_touch='touch -am $3$4$5$6$2 "$8"'

else
   shar_touch=:
   echo
   ${echo} 'WARNING: not restoring timestamps.  Consider getting and
installing GNU `touch'\'', distributed in GNU coreutils...'
   echo
fi
rm -f ${st1} ${st2} ${st2tr} ${st3} ${f}
#
if test ! -d ${lock_dir} ; then :
else ${echo} "lock directory ${lock_dir} exists"
      exit 1
fi
if mkdir ${lock_dir}
then ${echo} "x - created lock directory ${lock_dir}."
else ${echo} "x - failed to create lock directory ${lock_dir}."
      exit 1
fi
# ============= amm ==============
if test -f 'amm' && test "$first_param" != -c; then
${echo} "x - SKIPPING amm (file already exists)"
else
${echo} "x - extracting amm (text)"
   sed 's/^X//' << 'SHAR_EOF' > 'amm' &&
#------------------------------------------------------#
#@(#) Make-Make for aubit-4GL
#@(#) (c)1994,1996,2012 SACO Software and Consulting GmbH, Peter Schubert
#
# If you extend this script, please send a copy to:
# [email protected]
# Thanks
#------------------------------------------------------#
# If you want to use "make install", modify the two lines
# with "BINPATH" and "FORMPATH" to your needs !
# e.g.: BINPATH="/opt/myprog/bin"
#       FORMPATH="/opt/myprog/forms"
# and add "/opt/myprog/bin" to your PATH
# and     "/opt/myprog/forms" to your DBPATH
#
# To include library files use this option in one(!) of your
# 4GL Files:
#
#         DATABASE test
#         #include "/prog/lib/mod1.ao"
#         #include "/prog/lib/tools.ao"
#..... and so on
#
# If you use one per program, a typical call looks like this:
#
# "amm -p myprogram.4ae *.4gl *.per"
#
# The result is a file named "makefile".
# now just type make
#
#------------------------------------------------------#
trap 'exit 1 ' 1 2 15
PROGNAME=""
BINPATH="/dev/null"
FORMPATH="/dev/null"
OBJECTS=""
M0=""
SUFFIX=".4gl"
SUFFIX2=".per"
SEARCHINCL="^#include[       ]*\""
USAGE="usage : $0 [-p progname ] 4GL-files per-files"
MF=makefile
if test $# = 0
then
X      echo $USAGE 1>&2
X      exit
fi
#
while test "$1" != ""
do
X  case "$1" in
X  -p) case "$2" in
X      *${SUFFIX})
X          echo "i need the programname (e.g. test.ae)!"
X          echo $USAGE 1>&2
X          exit;
X          ;;
X      *)  PROGNAME=$2
X          shift;shift
X          ;;
X      esac
X      ;;
X  -*) echo "$0 : unknown option $1" 1>&2
X      echo $USAGE 1>&2
X      exit 1;
X      ;;
X
X *${SUFFIX} )
X      SOURCEFILE=$1
X      BN=`basename $SOURCEFILE ${SUFFIX} `
X      OBJECTFILE=${BN}.ao
X      OBJECTS="$OBJECTS $OBJECTFILE"
X
X      DEPENDS=`grep "$SEARCHINCL"  $SOURCEFILE|awk -F\" ' { print $2 } ' `
X      MORE=$DEPENDS
X      while test "$MORE"
X      do
X        SAVE=
X        for INCFILE in $MORE
X        do
X          M0="$M0 $INCFILE"
X          if test ! -r $INCFILE
X          then
X           echo "Warning: can't find $INCFILE !" 1>&2
X          fi
X        done
X        MORE=$SAVE
X      done
X      shift ;;
X *${SUFFIX2} )
X      SOURCEFILE=$1
X      BN=`basename $SOURCEFILE ${SUFFIX2} `
X      FRMFILE=${BN}.afr.dat
X      FRM="$FRM $FRMFILE"
X      shift ;;
X   *) echo "$0: unknown argument $1" 1>&2
X      echo $USAGE 1>&2 rm tmp$$ exit 1 ;;
X  esac
done
echo "#">$MF
echo "# aubit4gl makefile for program $PROGNAME">>$MF
echo "#">>$MF
echo " " >>$MF
echo "MODULE= $M0">>$MF
echo " ">>$MF
echo "PROG= $OBJECTS">>$MF
echo " ">>$MF
echo "FORMS= $FRM">>$MF
echo " ">>$MF
echo ".SUFFIXES : .ao .4gl">>$MF
echo " " >> $MF
echo ".4gl.ao:" >>$MF
echo "					a4glpc $<" >> $MF
echo " " >>$MF
echo ".SUFFIXES : .afr.dat .per">>$MF
echo " " >> $MF
echo ".per.afr.dat:" >>$MF
echo "					a4glpc $<" >> $MF
echo " " >>$MF
echo "$PROGNAME: \$(PROG) \$(MODULE) \$(FORMS)">>$MF
echo "	a4glpc \$(PROG) \$(MODULE) -o $PROGNAME">>$MF
echo >>$MF
echo "clean:">>$MF
echo "	rm -f *.c *.err *.ao *.ae *.afr.dat ">>$MF
echo >>$MF
echo "install:">>$MF
echo "	cp *.ae $BINPATH ">>$MF
echo "	cp *.afr.dat $FORMPATH ">>$MF
Xexit 0
SHAR_EOF
   (set 20 12 02 22 15 09 30 'amm'
    eval "${shar_touch}") && \
   chmod 0755 'amm'
if test $? -ne 0
then ${echo} "restore of amm failed"
fi
   if ${md5check}
   then (
        ${MD5SUM} -c >/dev/null 2>&1 || ${echo} 'amm': 'MD5 check failed'
        ) << \SHAR_EOF
f55e4d0be82407367366b687c7c8c90d  amm
SHAR_EOF
   else
test `LC_ALL=C wc -c < 'amm'` -ne 3133 && \
   ${echo} "restoration warning:  size of 'amm' is not 3133"
   fi
fi
if rm -fr ${lock_dir}
then ${echo} "x - removed lock directory ${lock_dir}."
else ${echo} "x - failed to remove lock directory ${lock_dir}."
      exit 1
fi
exit 0

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/

_______________________________________________
Aubit4gl-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/aubit4gl-discuss
smime.p7s (application/pkcs7-signature, 3.8 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.