Edit

kc3-lang/automake/automake.in

Branch :

  • Show log

    Commit

  • Author : Tom Tromey
    Date : 1995-11-26 06:43:09
    Hash : a5c9d023
    Message : Look for .texi file in $am_reldir

  • automake.in
  • #! /bin/sh
    # @configure_input@
    
    # automake - create Makefile.in from Makefile.am
    # Copyright (C) 1994 Free Software Foundation, Inc.
    
    # This program 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, or (at your option)
    # any later version.
    
    # This program 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 program; if not, write to the Free Software
    # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    
    # Sample usage: automake Makefile lib/Makefile src/Makefile man/Makefile
    # Written by David Mackenzie <djm@gnu.ai.mit.edu>.
    
    # Caveat: must use all lowercase variables in this file.  User
    # Makefile.am can cause any uppercase variable to be set.
    
    version=@VERSION@
    
    # We need prefix because datadir might depend on it.
    prefix=@prefix@
    am_dir=@datadir@/@PACKAGE@
    
    # These are commonly found files that we look for and automatically
    # include in DIST_FILES.  NOTE if you add something here, make sure
    # you add it in the right place -- that is, so that the "--help" still
    # lines up nicely.
    common='THANKS TODO README NEWS COPYING COPYING.LIB INSTALL ABOUT-NLS ChangeLog configure configure.in config.guess config.sub mkinstalldirs install-sh texinfo.tex'
    
    # $echo will eventually be used to handle NLS matters.
    echo=echo
    
    mfiles=
    am_usedeps=yes
    am_incdeps=no
    while test $# -gt 0; do
       case "$1" in
        --help | --h* )
           $echo "Usage: automake [OPTION]... [Makefile]..."
           $echo "\
      --amdir=DIR           directory storing config files
      --help                print this help, then exit
      --version             print version number, then exit
      --include-deps        include generated dependencies in Makefile"
           echo
           $echo "Files which are automatically distributed, if found:"
           set $common
           while test $# -gt 0; do
    	  echo "  $1		$2"
    	  shift
    	  # Ignore errors here, in case we have an odd number.
    	  shift 2>/dev/null
           done
           exit 0
           ;;
    
        --version | --v* )
           $echo "Automake version $version"
           exit 0
           ;;
    
        --amdir=* | --a*=* )
           am_dir="`echo \"${1}\" | sed -e 's/^[^=]*=//'`"
           ;;
    
        --amdir | --a* )
           if test $# -eq 1; then
    	  $echo "automake: no argument given for option \`$1'" 1>&2
    	  exit 1
           fi
           shift
           am_dir="${1}"
           ;;
    
        --include-deps | --i*)
           am_incdeps=yes
           am_usedeps=no
           ;;
    
        -- ) # Stop option processing.
           shift
           while test $# -gt 0; do
    	  mfiles="$mfiles $1"
    	  shift
           done
           break
           ;;
    
        -*)
           # FIXME consider "-" meaning stdin as input?
           $echo "automake: unrecognized option -- \`$1'" 1>&2
           exit 1
           ;;
    
        * )
           mfiles="$mfiles $1"
           ;;
       esac
       shift
    done
    
    test -n "$mfiles" || {
       # Look around.
       mfiles=`echo */Makefile.am`
       if test "$mfiles" = '*/Makefile.am'; then
          mfiles=
       else
          mfiles=`echo "$mfiles" | sed 's/\.am//g'`
       fi
    
       if test -f Makefile.am; then
          mfiles="Makefile $mfiles"
       fi
    
       if test -n "$mfiles"; then
          $echo "automake: using $mfiles" 1>&2
       else
          $echo "automake: no \"Makefile.am\" found or specified" 1>&2
          exit 1
       fi
    }
    
    
    am_status=0
    
    # Some handy sed scripts.
    am_rmnl=$am_dir/nl-remove.sed
    am_ass=$am_dir/hack-make.sed
    
    for am_makefile in $mfiles; do
      if test ! -f ${am_makefile}.am; then
         $echo "automake: ${am_makefile}.am: No such honkin' file" 1>&2
         am_status=1
         continue
      fi
    
    (
      am_localstatus=0
    
      $echo "creating ${am_makefile}.in"
    
      # Find our directory relative to top.
      am_reldir=`echo "$am_makefile" | sed 's,//*[^/][^/]*$,,g'`
      if test "$am_reldir" = "$am_makefile"; then
         # Bogus.
         am_reldir=.
      fi
    
      exec 4> ${am_makefile}.vars
      exec 5> ${am_makefile}.rules
    
      echo "# Makefile.in generated automatically by automake $version from Makefile.am." >&4
      cat $am_dir/header-vars.am >&4
      cat $am_dir/header.am >&5
    
      DEFS= INCLUDES= CPPFLAGS= CFLAGS=
      SOURCES= CONFIG_HEADER= SUBDIRS= PROGRAMS= LIBPROGRAMS= SCRIPTS= LIBSCRIPTS=
      LIBRARIES= TEXINFOS= MANS= AM_PROGRAMS=
      am_suffixes=
      am_recursive_install=no
      am_dist_common=
      # The following are targets that formerly were implemented as
      # double-colon rules.  Nowadays we have to construct such lists
      # explicitly.
      installexec= uninstall= id= tags= info= dvi= check=
      installdata= all='${ALL}' install=
    
      eval `sed -n -f $am_rmnl ${am_makefile}.am | sed -n -f $am_ass`
    
      #
      # If a variable is set at configure time, we still need to know the
      # values it can assume (statically).  This is done using the AM_
      # forms in the Makefile.am.  Handle it now.
      #
      test -n "$AM_PROGRAMS" && {
         PROGRAMS=$AM_PROGRAMS
      }
      test -n "$AM_LIBPROGRAMS" && {
         LIBPROGRAMS=$AM_LIBPROGRAMS
      }
      test -n "$AM_SCRIPTS" && {
         SCRIPTS=$AM_SCRIPTS
      }
      test -n "$AM_LIBSCRIPTS" && {
         LIBSCRIPTS=$AM_LIBSCRIPTS
      }
      test -n "$AM_LIBRARIES" && {
         LIBRARIES=$AM_LIBRARIES
      }
    
      if grep @kr@ ${am_makefile}.am >/dev/null; then
        kr='${kr}'
      else
        kr=
      fi
    
      if test -n "$PROGRAMS$LIBPROGRAMS$LIBRARIES"; then
        cat $am_dir/compile-vars.am >&4
        cat $am_dir/compile.am >&5
    
        am_suffixes=".c .o $am_suffixes"
    
        # Check for automatic de-ANSIfication.
        if grep @kr@ ${am_makefile}.am >/dev/null; then
           cat $am_dir/compile-kr.am >&5
           am_suffixes=".krc .krh .kro $am_suffixes"
        fi
    
        for am_file in $PROGRAMS $LIBPROGRAMS $LIBRARIES; do
           if eval "test \"\$var_${am_file}_SOURCES\" = explicit"; then
    	  if eval "test \"\$var_${am_file}_OBJECTS\" = explicit"; then
    	     :
    	  else
    	     sed -n -f $am_rmnl ${am_makefile}.am |
    	     sed -n "/^[	 ]*${am_file}_SOURCES[	 ]*=/{
    s/SOURCES/OBJECTS/
    s/@[^@]*@//g
    s/\$([^)]*)//g
    s/\${[^}]*}//g
    s/\\.cc/.${kr}o/g
    s/\\.\${kr}c/.${kr}o/g
    s/\\.\$(kr)c/.${kr}o/g
    s/\\.[cCmylfs]/.${kr}o/g
    p
    }" >&4
    	  fi
    	  SOURCES="$SOURCES \${${am_file}_SOURCES}"
    	  OBJECTS="$OBJECTS \${${am_file}_OBJECTS}"
           else
    	  echo "${am_file}_SOURCES = ${am_file}.c" >&4
    	  echo "${am_file}_OBJECTS = ${am_file}.${kr}o" >&4
              SOURCES="$SOURCES ${am_file}.c"
    	  OBJECTS="$OBJECTS ${am_file}.${kr}o"
           fi
           if test -n "$CONFIG_HEADER"; then
    	  echo "\$(${am_file}_OBJECTS): $CONFIG_HEADER" >&5
           fi
        done
      fi
    
    
      #
      # Boilerplate for scripts or programs.
      #
      if test -n "$PROGRAMS"; then
         cat $am_dir/programs.am >&5
         installexec="install-programs $installexec"
         uninstall="uninstall-programs $uninstall"
      fi
      if test -n "$SCRIPTS"; then
         cat $am_dir/scripts.am >&5
         installexec="install-scripts $installexec"
         uninstall="uninstall-scripts $uninstall"
      fi
      if test -n "$LIBPROGRAMS$LIBSCRIPTS"; then
         cat $am_dir/libprograms.am >&5
         installexec="install-libprograms $installexec"
         uninstall="uninstall-libprograms $uninstall"
      fi
      if test -n "$LIBSCRIPTS"; then
         cat $am_dir/libscripts.am >&5
         installexec="install-libscripts $installexec"
         uninstall="uninstall-libscripts $uninstall"
      fi
    
      if test -n "$PROGRAMS$LIBPROGRAMS$SCRIPTS$LIBSCRIPTS"; then
        if test -n "$PROGRAMS$LIBPROGRAMS"; then
           for am_prog in $PROGRAMS $LIBPROGRAMS; do
    	  # If `prog_LDADD' is explicitly defined, use it.  Otherwise,
    	  # use LDADD.
    	  eval "test \"\$var_${am_prog}_LDADD\" = explicit" || {
    	     # Not set, so set it.
    	     echo "${am_prog}_LDADD = \${LDADD}" >&5
    	  }
    
    	  # Insert rule for this target, unless it is explicitly given
    	  # in Makefile.am.
    	  eval "test \"\$target_$am_prog\" != explicit" &&
    	  sed "s/@PROGRAM@/$am_prog/g" $am_dir/program.am >&5
           done
        fi
      fi
    
      if test -n "$LIBRARIES"; then
        echo "LIBFILES = " `echo "$LIBRARIES"|sed 's/\([a-zA-Z0-9_][a-zA-Z0-9_]*\)/lib\1.a/g'` >&4
        cat $am_dir/libraries-vars.am >&4
        cat $am_dir/libraries.am >&5
    
        installexec="install-libraries $installexec"
        uninstall="uninstall-libraries $uninstall"
    
        for am_lib in $LIBRARIES; do
          sed "s/@LIBRARY@/$am_lib/g" $am_dir/library.am >&5
        done
      fi
    
      if test -n "$TEXINFOS"; then
         # Give an error if more than one texinfo is defined -- we
         # can't handle that.  But how to count?  Sigh.  We do the naive,
         # broken thing.
         set $TEXINFOS
         if test $# -gt 1; then
    	$echo "automake: $am_makefile specified more than one file in \`TEXINFOS'"
    	am_localstatus=1
         else
    	am_infobase=`echo "$TEXINFOS" | sed 's/\.texi//'`
    
    	am_deps="$TEXINFOS"
    	# Only do version.texi if requested.  FIXME error if .texi
    	# file does not exist?
    	if grep $am_reldir/version.texi $TEXINFOS > /dev/null 2>&1; then
    	   am_deps="version.texi $am_deps"
    	   am_dist_common="version.texi $am_dist_common"
    	fi
    	if eval "test \"\$var_${am_infobase}_TEXINFOS\" = explicit"; then
    	   # User supplied eg automake_TEXINFOS.  So use those as
    	   # dependencies.
    	   am_deps="\$(${am_infobase}_TEXINFOS) $am_deps"
    	   am_dist_common"\$(${am_infobase}_TEXINFOS) $am_dist_common"
    	   sed "s/@TEXI@/$TEXINFOS/g" $am_dir/texi-version.am >&5
    	fi
    
    	if test -n "$am_deps"; then
    	   echo "${am_infobase}.info: $am_deps" >&5
    	   echo >&5
    	fi
    
    	cat $am_dir/texinfos-vars.am >&4
    	cat $am_dir/texinfos.am >&5
    	am_suffixes=".texi .info .dvi $am_suffixes"
    	installdata="install-info $installdata"
    	uninstall="uninstall-info $uninstall"
    	info="\$(INFO_DEPS) $info"
    	dvi="\$(DVIS) $dvi"
    
    	echo "$TEXINFOS" | sed 's/^/INFOS = /; s/\.texi/.info*/g' >&4
    	echo "$TEXINFOS" | sed 's/^/INFO_DEPS = /; s/\.texi/.info/g' >&4
    	echo "$TEXINFOS" | sed 's/^/DVIS = /; s/\.texi/.dvi/g' >&4
         fi
      fi
    
      if test -n "$MANS"; then
        cat $am_dir/mans-vars.am >&4
        cat $am_dir/mans.am >&5
    
        installdata="install-man $installdata"
        uninstall="uninstall-man $uninstall"
      fi
    
    
      #
      # Handle DATA and PACKAGEDATA.
      #
      if test -n "$DATA"; then
         cat $am_dir/data.am >&5
         installdata="install-ddata $installdata"
         uninstall="uninstall-ddata $uninstall"
      fi
      if test -n "$PACKAGEDATA"; then
         cat $am_dir/packagedata.am >&5
         installdata="install-pdata $installdata"
         uninstall="uninstall-pdata $uninstall"
      fi
    
      case "$SUBDIRS" in
       "")
          if grep @kr@ ${am_makefile}.am >/dev/null; then
    	 cat $am_dir/clean-kr.am >&5
          else
    	 cat $am_dir/clean.am >&5
          fi
          ;;
       *)
          cat $am_dir/subdirs.am >&5
    
          all="all-recursive $all"
          check="check-recursive $check"
          info="info-recursive $info"
          dvi="dvi-recursive $dvi"
          am_recursive_install=yes
          ;;
      esac
    
      case "$am_makefile" in
       */*)
          cat $am_dir/remake-subd.am >&5
          ;;
       *)
          test -f aclocal.m4 && echo "ACLOCAL = aclocal.m4" >&4
          cat $am_dir/remake.am >&5
          ;;
      esac
    
      case "$CONFIG_HEADER" in
      "") ;;
      */*) ;; # It's in some other directory, so don't remake it in this one.
      *)
        test -f acconfig.h && echo "ACCONFIG = acconfig.h" >&4
        test -f config.h.top && echo "CONFIG_TOP = config.h.top" >&4
        test -f config.h.bot && echo "CONFIG_BOT = config.h.bot" >&4
        am_dist_common="stamp-h.in $am_dist_common"
        cat $am_dir/remake-hdr.am >&5 ;;
      esac
    
      #
      # Handle TAGS.
      #
      case "$am_makefile" in
       */*)
          if test -n "${SOURCES}${HEADERS}${ETAGS_ARGS}"; then
    	 cat $am_dir/tags-subd.am >&5
          fi
          ;;
       *)
          if test -n "${SUBDIRS}"; then
    	 cat $am_dir/tags.am >&5
          else
    	 if test -n "${SOURCES}${HEADERS}${ETAGS_ARGS}"; then
    	    cat $am_dir/tags-subd.am >&5
    	 fi
          fi
          ;;
      esac
    
      #
      # Handle "dist" targets.
      #
    
      # Look for certain common files and make sure they are included.
      for cfile in $common; do
         if test -f $am_reldir/$cfile; then
    	am_dist_common="$am_dist_common $cfile"
         fi
      done
      echo "DIST_COMMON = $am_dist_common" >&4
    
      # Include "dist" boilerplate.
      case "$am_makefile" in
      */*) 
         cat $am_dir/dist-subd-vars.am >&4
         echo "subdir = $am_reldir" >&5
         cat $am_dir/dist-subd.am >&5
         ;;
      *)
         cat $am_dir/dist-vars.am >&4
         if test -n "$SUBDIRS"; then
    	cat $am_dir/dist-subd-top.am >&5
         else
    	cat $am_dir/dist.am >&5
         fi
         ;;
      esac
    
    
      #
      # Handle auto-generating dependencies.
      #
      if test "$am_usedeps" = yes && test -n "$SOURCES"; then
         # Include code to auto-generate dependencies.
         cat $am_dir/depend.am >&5
      fi
      if test "$am_incdeps" = yes; then
         # Include any already generated dependencies.
         if test -d $am_reldir/.deps && test -f $am_reldir/.deps/empty.P; then
    	cat $am_reldir/.deps/*.P >&5
         fi
      fi
    
      #
      # Some final checks.
      #
      test -z "$TEXINFOS" || test -f $am_reldir/texinfo.tex || {
         $echo "automake: ${am_makefile}.am defines TEXINFOS, but" 1>&2
         $echo "automake: ${am_reldir}/texinfo.tex does not exist" 1>&2
      }
    
      case "$am_makefile" in
       */*)
          # In a subdirectory.
          ;;
    
       *)
          # In top-level, or only, directory.
          test -f $am_reldir/install-sh || {
    	 $echo "automake: $am_reldir/install-sh does not exist" 1>&2
          }
          test -f $am_reldir/mkinstalldirs || {
    	 $echo "automake: $am_reldir/mkinstalldirs does not exist" 1>&2
          }
          ;;
      esac
    
      # Copy from Makefile.am to output.
      sed '/^[^#=]*:/,$d' ${am_makefile}.am >&4
      sed -n '/^[^#=]*:/,$p' ${am_makefile}.am >&5
      echo >&5
    
      echo "SOURCES = $SOURCES" >&4
      echo "OBJECTS = $OBJECTS" >&4
      echo >&4
    
      #
      # Put .SUFFIXES way down at the bottom.
      #
      if test -n "$am_suffixes"; then
         echo ".SUFFIXES:" >&5
         echo ".SUFFIXES: $am_suffixes" >&5
         echo >&5
      fi
    
      # Ditto .NOEXPORT.
      cat $am_dir/footer.am >&5
    
      # Output variable definitions.
      exec 6> ${am_makefile}.in
    
      cat ${am_makefile}.vars >&6
    
      #
      # Merge any targets that need to be merged.
      #
      for am_target in all info dvi check; do
         # If user specified the local form of the target, then include it.
         if eval "test \"\$target_${am_target}_local\" = explicit"; then
    	eval "${am_target}=\"${am_target}-local \$${am_target}\""
         fi
    
         # Always print these targets; GNU makefile standards require it.
         eval "am_val=\"\$${am_target}\""
         echo "${am_target}: ${am_val}" >&6
         echo >&6
      done
    
      # Handle the various install targets specially.  We do this so that
      # (eg) "make install-exec" will run "install-exec-recursive" if
      # required, but "make install" won't run it twice.  Step one is to
      # see if the user specified local versions of any of the targets we
      # handle.
      if test -n "$target_install_exec_local"; then
         installexec="install-exec-local $installexec"
      fi
      if test -n "$target_uninstall_local"; then
         uninstall="uninstall-local $uninstall"
      fi
      if test -n "$target_install_data_local"; then
         installdata="install-data-local $installdata"
      fi
      # FIXME do install-local here?  Maybe make it an error and tell the
      # user to use install-data or install-exec?
    
      # Step two: if we are doing recursive makes, write out the
      # appropriate rules.
      if test $am_recursive_install = yes; then
         install="install-recursive $install"
         if test -n "$installexec"; then
    	echo "install-exec-am: $installexec" >&6
    	echo >&6
    	installexec="install-exec-recursive install-exec-am"
    	install="install-exec-am $install"
         fi
         if test -n "$installdata"; then
    	echo "install-data-am: $installdata" >&6
    	echo >&6
    	installdata="install-data-recursive install-data-am"
    	install="install-data-am $install"
         fi
         if test -n "$uninstall"; then
    	echo "uninstall-am: $uninstall" >&6
    	echo >&6
    	uninstall="uninstall-recursive uninstall-am"
         fi
      fi
    
      # Step three: print definitions users can use.
      if test -n "$installexec"; then
         echo "install-exec: $installexec" >&6
         echo >&6
         if test $am_recursive_install = no; then
    	install="install-exec $install"
         fi
      fi
      if test -n "$installdata"; then
         echo "install-data: $installdata" >&6
         echo >&6
         if test $am_recursive_install = no; then
    	install="install-data $install"
         fi
      fi
    
      echo "install: $install" >&6
      echo >&6
      echo "uninstall: $uninstall" >&6
      echo >&6
    
      cat ${am_makefile}.rules >&6
      rm -f ${am_makefile}.vars ${am_makefile}.rules
    
      exit $am_localstatus
    ) || {
       am_status=1
    }
    done
    
    exit $am_status