view src/mk-pkg-add @ 6469:a848b846cb3a ss-2-9-10

[project @ 2007-03-27 18:42:11 by jwe]
author jwe
date Tue, 27 Mar 2007 18:42:11 +0000
parents 4e6be3c306f1
children c05fbb1b7e1f
line wrap: on
line source

#! /bin/sh -e

SED=${SED:-'sed'}

for f in "$@"; do
  if [ -f $f ]; then

    ## Compute and print the autoloads.
  
    base=`basename $f | $SED 's/\.df$//'`
    fcns=`$SED -n -e 's/^ *XDEFUN_DLD_INTERNAL *( *\([^, ]*\)[, ].*$/\1/p' \
                  -e 's/^ *XDEFUNX_DLD_INTERNAL *( *"\([^"]*\)".*$/\1/p' $f | \
	  sort -u`
    if [ -n "$fcns" ]; then
      for n in $fcns; do
	if [ "$n" = "$base" ]; then
	  true
	else
          echo "autoload (\"$n\", fullfile (fileparts (mfilename (\"fullpath\")), \"$base.oct\"));"
	fi
      done
    fi

    ## Process PKG_ADD directives after autoloads so that all
    ## necessary functions can be found before they are used.

    $SED -n -e 's,^//* *PKG_ADD: *,,p' \
            -e 's,^/\* *PKG_ADD: *\(.*\) *\*/ *$,\1,p' $f

  fi
done

exit $?