#!/bin/bash
#******************************************************************************
#FILE:               make-depends
#LANGUAGE:           bash shell script
#SYSTEM:             POSIX
#USER-INTERFACE:     POSIX
#DESCRIPTION
#
#    This scripts run pjb-make-depends elisp script to create a Makefile.depend
#
#USAGE
#
#    make-depends [ -Iinclude-dir | lisp-object-file ] ...
#
#AUTHORS
#    <PJB> Pascal J. Bourguignon <pjb@informatimago.com>
#MODIFICATIONS
#    2002-12-04 <PJB> Created.
#BUGS
#LEGAL
#    Copyright Pascal J. Bourguignon 2002 - 2002
#
#    This script is free software; you can redistribute it and/or
#    modify it under the terms of the GNU  General Public
#    License as published by the Free Software Foundation; either
#    version 2 of the License, or (at your option) any later version.
#
#    This script is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#    General Public License for more details.
#
#    You should have received a copy of the GNU General Public
#    License along with this library; see the file COPYING.LIB.
#    If not, write to the Free Software Foundation,
#    59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#******************************************************************************
pname="$(basename $0)"
pblan="${pname//?/ }"


function usage () {
    echo "${pname} usage:"
    echo "    ${pname} [-Iinclude-dir|lisp-object-file]... "
}

DIR="$(dirname $0)"
IDIRES=""
OFILES=""
trace=0
closure=0

for arg ; do
    case "$arg" in
    -h|--help)
        usage
        exit 0
        ;;
    -I*)
        IDIRES="$IDIRES \"${arg/-I}\""
        ;;
    -t)
        trace=1
        ;;
    -c)
        closure=1
        ;;
    -*)
        echo "${pname}: Invalid option '$arg'."
        usage
        exit 1
        ;;
    *)
        OFILES="$OFILES \"$arg\""
        ;;
    esac
done


if [ $closure -ne 0 ] ; then
   emacs -q -nw --batch -l .emacs  --eval "
   (progn
      (setq debugger (lambda (x y) (message \"### Error: %S %S\\n\" x y)
                      (backtrace) (kill-emacs)) debug-on-error  t)
     (add-to-list 'load-path \"$DIR\")
     (load \"pjb-cl.el\")
     (load \"pjb-list.el\")
     (load \"pjb-make-depends.el\")
     (mapc (lambda (item) (princ item) (princ \" \"))
           (nreverse (list-to-set (nreverse
             (get-closed-dependencies $OFILES '( $IDIRES )))))) ) "
else
    emacs -q -nw --batch -l .emacs --eval "
    (progn
      ;; (setq debugger (lambda (x y) (message \"### Error: %S %S\\n\" x y)
      ;;                 (backtrace) (kill-emacs)) debug-on-error  t)
      (add-to-list 'load-path \"$DIR\")
      (load \"pjb-cl.el\")
      (load \"pjb-make-depends.el\")
      (make-depends '( $OFILES ) '( $IDIRES )) )"
fi | grep -v Loading


#END#

#### make-depends                     -- 2004-01-10 21:42:18 -- pascal   ####
ViewGit