/* This -*- C -*- file (cpp-Makefile) is run through the C preprocessor
   to produce bash-Makefile which is machine specific.

   If you have Gcc and/or Bison, you might wish to mention that right
   below here.

   Since this is to become a Makefile, blank lines which appear outside
   of comments may not contain a TAB character.

   Copyright (C) 1987,1991 Free Software Foundation, Inc.

   This file is part of GNU Bash, the Bourne Again SHell.

   Bash 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 1, or (at your option) any later
   version.

   Bash 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 Bash; see the file COPYING.  If not, write to the Free Software
   Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */


/* **************************************************************** */
/*								    */
/*			Which compiler are you using?		    */
/*								    */
/* **************************************************************** */

/* Define HAVE_GCC if you have the GNU C compiler. */
/* #define HAVE_GCC */

#if defined (__GNUC__) && !defined (HAVE_GCC) && !defined (NeXT)
#  define HAVE_GCC
#endif

/* Undefine HAVE_FIXED_INCLUDES if you are not using GCC with the fixed
   header files. */
#if defined (HAVE_GCC) && !defined (HAVE_FIXED_INCLUDES)
#  define HAVE_FIXED_INCLUDES
#endif /* HAVE_GCC && !HAVE_FIXED_INCLUDES */

/* Define HAVE_BISON if you have the GNU replacement for Yacc. */
#define HAVE_BISON

/* Include some boilerplate Gnu makefile definitions. */
prefix = /usr/local

exec_prefix = $(prefix)
bindir = $(exec_prefix)/bin
libdir = $(exec_prefix)/lib

manroot = $(prefix)/man

man1ext = 1
man1dir = $(manroot)/man$(man1ext)
mandir = $(man1dir)
manext = $(man1ext)

infodir = $(prefix)/info

srcdir = .
VPATH = $(srcdir)

/* This includes the appropriate description for the machine that you are
   using (we hope).  If the compilation doesn't work correctly, then you
   will have to edit the file `machines.h' to include a description for the
   machine that your Cpp uniquely identifies this as.  For example, Sun 4's
   are recognized by the Cpp identifier `sparc', Vax is recognized with `vax',
   etc.  The order of these files is very important.  Config.h must come last,
   since it is capable of undef'ing various things. */
#define BUILDING_MAKEFILE   /* Tell config.h to avoid #including anything. */
#include "sysdefs.h"
#include "machines.h"
#include "config.h"

/* Can't use the Gnu malloc library without saying we want the Gnu malloc. */
#if !defined (USE_GNU_MALLOC)
#  undef USE_GNU_MALLOC_LIBRARY
#endif /* !USE_GNU_MALLOC */

.c.o:
	$(RM) $@
	$(CC) $(CFLAGS) $(CPPFLAGS) -c $*.c

#if defined (HAVE_BISON)
BISON = bison -y
#else
BISON = yacc
#endif

#if defined (HAVE_GCC)
#  if defined (GCC_FLAGS)
GCC_EXTRAS = GCC_FLAGS
#  endif /* GCC_FLAGS */
#  if !defined (HAVE_FIXED_INCLUDES)
/* This is guaranteed to work, even if you have the fixed includes!
   (Unless, of course, you have the fixed include files installed in
   /usr/include.  Then it will break.) */
CC = gcc -traditional -I/usr/include $(GCC_EXTRAS)
#  else /* HAVE_FIXED_INCLUDES */
CC = gcc $(GCC_EXTRAS)
#  endif /* HAVE_FIXED_INCLUDES */
#else /* !HAVE_GCC */
CC = CPP_CC
#endif /* !HAVE_GCC */

#if defined (MAKE_SHELL)
SHELL = MAKE_SHELL
#else
SHELL=/bin/sh
#endif /* MAKE_SHELL */

RM = rm -f
AR = ar
COMPRESS = gzip
COMPRESS_EXT = .gz

Machine = M_MACHINE
OS = M_OS

PROFILE_FLAGS=

#if defined (SYSDEP_CFLAGS)
SYSDEP = SYSDEP_CFLAGS
#endif /* SYSDEP_CFLAGS */

#if defined (SYSDEP_LDFLAGS)
SYSDEP_LD = SYSDEP_LDFLAGS
#endif /* SYSDEP_LDFLAGS */

#if defined (HAVE_SETLINEBUF)
LINEBUF = -DHAVE_SETLINEBUF
#endif

#if defined (HAVE_VFPRINTF)
VPRINTF = -DHAVE_VFPRINTF
#endif /* HAVE_VFPRINTF */

#if defined (USE_VFPRINTF_EMULATION)
VPRINTF = -DHAVE_VFPRINTF
VPRINT_OBJ = vprint.o
#endif /* USE_VFPRINTF_EMULATION */

#if defined (HAVE_SYS_PTEM_H)
PTEM = -DHAVE_SYS_PTEM_H
#endif /* HAVE_SYS_PTEM_H */

#if defined (HAVE_SYS_PTE_H)
PTE = -DHAVE_SYS_PTE_H
#endif /* HAVE_SYS_PTE_H */

#if defined (HAVE_UNISTD_H)
UNISTD = -DHAVE_UNISTD_H
#endif

#if defined (HAVE_STDLIB_H)
STDLIB = -DHAVE_STDLIB_H
#endif

#if defined (HAVE_LIMITS_H)
LIMITSH = -DHAVE_LIMITS_H
#endif

#if defined (HAVE_GETGROUPS)
GROUPS = -DHAVE_GETGROUPS
#endif

#if defined (HAVE_RESOURCE)
RESOURCE = -DHAVE_RESOURCE
#endif

#if defined (VOID_SIGHANDLER)
SIGHANDLER = -DVOID_SIGHANDLER
#endif

#if defined (HAVE_STRERROR)
STRERROR = -DHAVE_STRERROR
#endif

#if defined (HAVE_WAIT_H)
WAITH = -DHAVE_WAIT_H
#endif

#if defined (HAVE_GETWD)
GETWD = -DHAVE_GETWD
#endif

#if defined (HAVE_DUP2)
DUP2 = -DHAVE_DUP2
#endif /* HAVE_DUP2 */

#if defined (HAVE_DIRENT)
DIRENT = -DHAVE_DIRENT
#endif /* HAVE_DIRENT */

#if defined (HAVE_DIRENT_H)
DIRENTH = -DHAVE_DIRENT_H
#endif /* HAVE_DIRENT_H */

#if defined (HAVE_STRING_H)
STRINGH = -DHAVE_STRING_H
#endif /* HAVE_STRING_H */

#if defined (HAVE_VARARGS_H)
VARARGSH = -DHAVE_VARARGS_H
#endif /* HAVE_VARARGS_H */

#if defined (HAVE_STRCHR)
STRCHR = -DHAVE_STRCHR
#endif /* HAVE_STRCHR */

#if defined (HAVE_DEV_FD)
DEVFD = -DHAVE_DEV_FD
#endif /* HAVE_DEV_FD */

SYSTEM_FLAGS = $(LINEBUF) $(VPRINTF) $(UNISTD) $(STDLIB) $(LIMITSH) \
       $(GROUPS) $(RESOURCE) \
       $(SIGHANDLER) $(SYSDEP) $(WAITH) $(GETWD) $(DUP2) $(STRERROR) \
       $(DIRENT) $(DIRENTH) $(STRINGH) $(VARARGSH) $(STRCHR) $(DEVFD) \
       -D$(Machine) -D$(OS)
DEBUG_FLAGS = $(PROFILE_FLAGS) -O -g
LDFLAGS	= $(NOSHARE) $(SYSDEP_LD) $(EXTRA_LD_PATH) $(DEBUG_FLAGS)
CFLAGS	= $(DEBUG_FLAGS) $(SYSTEM_FLAGS) -DSHELL $(ALLOCA_CFLAGS) \
	  $(MALLOC_CFLAGS)
CPPFLAGS= -I. -I$(LIBSRC)

/* It is conceivable that you wish to edit some things beyond this point,
   but I guess that it is highly unlikely, and may give you a headache. */

/* **************************************************************** */
/*								    */
/*		    How to Build the support libraries.		    */
/*								    */
/* **************************************************************** */

LIBSRC = ./lib/

LIBINC_DECL  = LIBINCDIR=`pwd`; export LIBINCDIR
LIBINC_USAGE = "-I$${LIBINCDIR} -I$${LIBINCDIR}/$(LIBSRC)"

/* Defines used when building libraries. */
#define LIB_CFLAGS_DECL CFLAGS='$(LIBRARY_CFLAGS) '$(LIBINC_USAGE)
#define LIB_CPPFLAGS_DECL CPPFLAGS='$(CPPFLAGS)'
#define LIB_LDFLAGS_DECL LDFLAGS='$(LDFLAGS)'
#define LIBMAKE_FLAGS LIB_CFLAGS_DECL LIB_CPPFLAGS_DECL LIB_LDFLAGS_DECL \
	RANLIB='$(RANLIB)' AR='$(AR)' CC='$(CC)' RM='$(RM)'

/* Macro used to build a library. */
#define build_lib_in_dir(directory, target) \
	@echo "Building in " directory "..."; \
	($(LIBINC_DECL); cd directory; $(MAKE) target $(MFLAGS) LIBMAKE_FLAGS)

/* The builtins are somewhat special in that more information is needed
   to compile them correctly. */
#define build_builtins_in_dir(directory) \
	($(LIBINC_DECL); cd directory; \
	 $(MAKE) $(MFLAGS) CPPFLAGS='$(CPPFLAGS)' \
	 CFLAGS='$(CFLAGS) '$(LIBINC_USAGE)' -I.' LDFLAGS='$(LDFLAGS)' \
	 RANLIB='$(RANLIB)' AR='$(AR)' CC='$(CC)' RM='$(RM)' \
	 DIRECTDEFINE='-D '$(srcdir)/directory)

LIBRARY_CFLAGS  = $(DEBUG_FLAGS) $(SIGHANDLER) $(ALLOCA_CFLAGS) \
		  $(SYSDEP) $(DIRENT) $(DIRENTH) $(STRINGH) $(VARARGSH) \
		  $(PTEM) $(PTE) \
		  $(STRCHR) -D$(Machine) -D$(OS) $(UNISTD) $(LIMITSH) \
		  $(STDLIB) -DSHELL

/* **************************************************************** */
/*                                                                  */
/*                 Support for desired libraries.                   */
/*    This includes Termcap, Glob, Tilde, History, and Readline.    */
/*                                                                  */
/* **************************************************************** */

/* Does this machine's linker need a space after -L? */
#if defined (HAVE_GCC)
#  undef SEARCH_LIB_NEEDS_SPACE
#endif /* HAVE_GCC */

#if defined (SEARCH_LIB_NEEDS_SPACE)
SEARCH_LIB = -L $(UNSET_VARIABLE_CREATES_SPACE)
#else
SEARCH_LIB = -L
#endif /* !SEARCH_LIB_NEEDS_SPACE */

#if defined (EXTRA_LIB_SEARCH_PATH)
LOCAL_LD_PATH = EXTRA_LIB_SEARCH_PATH
EXTRA_LD_PATH = $(SEARCH_LIB)$(LOCAL_LD_PATH)
#endif /* EXTRA_LIB_SEARCH_PATH */

/* Right now we assume that you have the full source code to Bash.  If
   you simply have the library and header files installed, then
   undefine HAVE_READLINE_SOURCE. */
#define HAVE_READLINE_SOURCE

#if defined (HAVE_READLINE_SOURCE)
RL_LIBSRC = $(LIBSRC)readline/
RL_LIBDOC = $(RL_LIBSRC)doc/
#  define READLINE_LIBRARY $(RL_LIBSRC)libreadline.a

READLINE_SOURCE	= $(RL_LIBSRC)rldefs.h $(RL_LIBSRC)readline.h \
		  $(RL_LIBSRC)chardefs.h $(RL_LIBSRC)keymaps.h \
		  $(RL_LIBSRC)funmap.c $(RL_LIBSRC)emacs_keymap.c \
		  $(RL_LIBSRC)search.c $(RL_LIBSRC)vi_keymap.c \
		  $(RL_LIBSRC)keymaps.c $(RL_LIBSRC)parens.c \
		  $(RL_LIBSRC)vi_mode.c $(RL_LIBSRC)history.c \
		  $(RL_LIBSRC)readline.c $(RL_LIBSRC)tilde.c \
		  $(RL_LIBSRC)rltty.c $(RL_LIBSRC)complete.c \
		  $(RL_LIBSRC)bind.c $(RL_LIBSRC)isearch.c \
		  $(RL_LIBSRC)display.c $(RL_LIBSRC)signals.c \
		  $(RL_LIBSRC)posixstat.h $(RL_LIBSRC)tilde.h \
		  $(RL_LIBSRC)xmalloc.c

READLINE_OBJ	= $(RL_LIBSRC)readline.o $(RL_LIBSRC)funmap.o \
		  $(RL_LIBSRC)parens.o $(RL_LIBSRC)search.o \
		  $(RL_LIBSRC)keymaps.o $(RL_LIBSRC)history.o \
		  $(RL_LIBSRC)rltty.o $(RL_LIBSRC)complete.o \
		  $(RL_LIBSRC)bind.o $(RL_LIBSRC)isearch.o \
		  $(RL_LIBSRC)display.o $(RL_LIBSRC)signals.o \
		  $(RL_LIBSRC)tilde.o $(RL_LIBSRC)xmalloc.o

READLINE_DOC	= $(RL_LIBDOC)rlman.texinfo $(RL_LIBDOC)rluser.texinfo \
		  $(RL_LIBDOC)rltech.texinfo

READLINE_DOC_SUPPORT  = $(RL_LIBDOC)Makefile $(RL_LIBDOC)readline.dvi \
		  $(RL_LIBDOC)readline.info

READLINE_EXAMPLES = $(RL_LIBSRC)examples/[a-zA-Z]*.[ch] \
		    $(RL_LIBSRC)examples/Makefile $(RL_LIBSRC)examples/Inputrc

READLINE_SUPPORT = $(RL_LIBSRC)Makefile $(RL_LIBSRC)ChangeLog \
		   $(RL_LIBSRC)COPYING $(READLINE_EXAMPLES) \
		   $(READLINE_DOC_SUPPORT)

READLINE_CFLAGS = $(DEBUG_FLAGS) $(SIGHANDLER) $(ALLOCA_CFLAGS) \
		  $(SYSDEP) -D$(Machine) -D$(OS) $(UNISTD) $(STDLIB) \
		  $(LIMITSH)
#else /* !HAVE_READLINE_SOURCE */
#  if defined (READLINE)
#    define READLINE_LIBRARY -lreadline
#  endif /* READLINE */
#endif /* !HAVE_READLINE_SOURCE */

/* Right now we assume that you have the full source code to Bash,
   including the source code to the history library.  If you only have
   the library and header files installed, then you can undefine
   HAVE_HISTORY_SOURCE. */
#define HAVE_HISTORY_SOURCE

#if defined (READLINE) && !defined (HISTORY)
#  define HISTORY
#endif /* READLINE && !HISTORY */

#  if defined (HISTORY) && !defined (READLINE)
HISTORY_LIB = -lhistory
#  endif /* HISTORY && !READLINE */

#if defined (HAVE_HISTORY_SOURCE)

HIST_LIBSRC = $(LIBSRC)readline/
HIST_LIBDOC = $(HIST_LIBSRC)doc/

/* If you are building with readline, then you do not explicitly need the
   history library. */
#  if defined (READLINE)
#    define HISTORY_LIBRARY
#  else
#    define HISTORY_LIBRARY $(HIST_LIBSRC)libhistory.a
#  endif /* !READLINE */

HISTORY_CFLAGS = $(DEBUG_FLAGS) $(SIGHANDLER) $(ALLOCA_CFLAGS) \
		 $(SYSDEP) -D$(Machine) -D$(OS) $(UNISTD) $(STDLIB) \
		 $(LIMITSH)

HISTORY_SOURCE	= $(HIST_LIBSRC)history.c $(HIST_LIBSRC)history.h
HISTORY_OBJ	= $(HIST_LIBSRC)history.o
HISTORY_DOC	= $(HIST_LIBDOC)hist.texinfo $(HIST_LIBDOC)hsuser.texinfo \
		  $(HIST_LIBDOC)hstech.texinfo

#  if defined (HISTORY) && !defined (READLINE)
#    if !defined (LD_HAS_NO_DASH_L)
HISTORY_LDFLAGS = $(SEARCH_LIB)$(HIST_LIBSRC)
#    endif /* LD_HAS_NO_DASH_L */
#  endif /* HISTORY && !READLINE */
#else /* !HAVE_HISTORY_SOURCE */
#  if defined (HISTORY) && !defined (READLINE)
#    define HISTORY_LIBRARY -lhistory
HISTORY_LDFLAGS = $(SEARCH_LIB)$(libdir) $(SEARCH_LIB)/usr/local/lib
#  endif /* HISTORY && !READLINE */
#endif /* !HAVE_HISTORY_SOURCE */

#if defined (USE_GNU_TERMCAP)
#  define HAVE_TERMCAP_SOURCE
TERM_LIBSRC = $(LIBSRC)termcap/

#  define TERMCAP_LIBRARY $(TERM_LIBSRC)libtermcap.a

TERMCAP_SOURCE	= $(TERM_LIBSRC)termcap.c $(TERM_LIBSRC)tparam.c
TERMCAP_OBJ	= $(TERM_LIBSRC)libtermcap.a
TERMCAP_DOC	= $(TERM_LIBSRC)termcap.texinfo
TERMCAP_SUPPORT = $(TERM_LIBSRC)Makefile $(TERM_LIBSRC)ChangeLog

#  if !defined (LD_HAS_NO_DASH_L)
TERMCAP_LDFLAGS = $(SEARCH_LIB)$(TERM_LIBSRC)
#  endif /* !LD_HAS_NO_DASH_L */
#else /* !USE_GNU_TERMCAP */

/* Guessed at symbol for LIBRARIES, below. */
#  if defined (USE_TERMCAP_EMULATION)
#    define TERMCAP_LIBRARY -lcurses
#  else /* !USE_TERMCAP_EMULATION */
#    define TERMCAP_LIBRARY -ltermcap
#  endif /* !USE_TERMCAP_EMULATION */
#endif /* !USE_GNU_TERMCAP */

/* The glob library is always used. */
#define USE_GLOB_LIBRARY

#if defined (USE_GLOB_LIBRARY)
GLOB_LIBSRC = $(LIBSRC)glob/
#define GLOB_LIBRARY $(GLOB_LIBSRC)libglob.a

GLOB_SOURCE = $(GLOB_LIBSRC)glob.c $(GLOB_LIBSRC)fnmatch.c \
	      $(GLOB_LIBSRC)fnmatch.h
GLOB_OBJ     = $(GLOB_LIBSRC)libglob.a
GLOB_DOC     = $(GLOB_LIBSRC)doc/glob.texi $(GLOB_LIBSRC)doc/Makefile
GLOB_SUPPORT = $(GLOB_LIBSRC)Makefile $(GLOB_LIBSRC)ChangeLog

#  if !defined (LD_HAS_NO_DASH_L)
GLOB_LDFLAGS = $(SEARCH_LIB)$(GLOB_LIBSRC)
#  endif /* !LD_HAS_NO_DASH_L */
GLOB_LIB     = -lglob
#endif /* USE_GLOB_LIBRARY */

/* The source code for the tilde expansion library. */
#if defined (HAVE_READLINE_SOURCE)
#  define HAVE_TILDE_SOURCE
#endif /* HAVE_READLINE_SOURCE */

#if defined (HAVE_TILDE_SOURCE)
TILDE_LIBSRC = $(LIBSRC)tilde/
TILDE_LIB = -ltilde
#  define TILDE_LIBRARY $(TILDE_LIBSRC)libtilde.a

TILDE_SOURCE	= $(TILDE_LIBSRC)tilde.c $(TILDE_LIBSRC)tilde.h
TILDE_OBJ	= $(TILDE_LIBSRC)tilde.o
TILDE_DOC	= $(TILDE_LIBSRC)doc/tilde.texi $(TILDE_LIBSRC)doc/Makefile
TILDE_SUPPORT	= $(TILDE_LIBSRC)Makefile $(TILDE_LIBSRC)ChangeLog

#  if !defined (LD_HAS_NO_DASH_L)
TILDE_LDFLAGS = $(SEARCH_LIB)$(TILDE_LIBSRC)
#  endif /* !LD_HAS_NO_DASH_L */

#else /* !HAVE_TILDE_SOURCE */
#  define TILDE_LIBRARY $(libdir)/libtilde.a
#endif /* !HAVE_TILDE_SOURCE */

#if defined (USE_GNU_MALLOC_LIBRARY)
MALLOC_LIBSRC = $(LIBSRC)malloclib/
#define MALLOC_LIBRARY $(MALLOC_LIBSRC)libmalloc.a

MALLOC_SOURCE = $(MALLOC_LIBSRC)calloc.c $(MALLOC_LIBSRC)cfree.c \
		$(MALLOC_LIBSRC)free.c $(MALLOC_LIBSRC)malloc.c \
		$(MALLOC_LIBSRC)mcheck.c $(MALLOC_LIBSRC)memalign.c \
		$(MALLOC_LIBSRC)morecore.c $(MALLOC_LIBSRC)mstats.c \
		$(MALLOC_LIBSRC)mtrace.c $(MALLOC_LIBSRC)realloc.c \
		$(MALLOC_LIBSRC)valloc.c

MALLOC_OBJ    = $(MALLOC_LIBSRC)libmalloc.a
MALLOC_SUPPORT= $(MALLOC_LIBSRC)Makefile
MALLOC_CFLAGS = -DUSE_GNU_MALLOC_LIBRARY

#  if !defined (LD_HAS_NO_DASH_L)
MALLOC_LDFLAGS = $(SEARCH_LIB)$(MALLOC_LIBSRC)
#  endif /* !LD_HAS_NO_DASH_L */
MALLOC_LIB     = -lmalloc

MALLOC_DEP = MALLOC_LIBRARY
#else
#  define MALLOC_LIBRARY
#endif /* USE_GNU_MALLOC_LIBRARY */

BASHPOSIX_LIB     = $(LIBSRC)posixheaders/
BASHPOSIX_SUPPORT = $(BASHPOSIX_LIB)posixstat.h $(BASHPOSIX_LIB)ansi_stdlib.h

LIBRARY_SOURCE  = $(READLINE_SOURCE) $(HISTORY_SOURCE) $(TERMCAP_SOURCE) \
		  $(GLOB_SOURCE) $(TILDE_SOURCE) $(MALLOC_SOURCE)
LIBRARY_DOC    = $(READLINE_DOC) $(HISTORY_DOC) $(TERMCAP_DOC) $(GLOB_DOC) \
		  $(TILDE_DOC) $(MALLOC_DOC)
LIBRARY_SUPPORT = $(READLINE_SUPPORT) $(HISTORY_SUPPORT) $(TERMCAP_SUPPORT) \
		  $(GLOB_SUPPORT) $(TILDE_SUPPORT) $(MALLOC_SUPPORT)
LIBRARY_TAR     = $(LIBRARY_SOURCE) $(LIBRARY_DOC) $(LIBRARY_SUPPORT)

#if defined (READLINE)
READLINE_LIB = -lreadline

#  if defined (USE_TERMCAP_EMULATION)
TERMCAP_LIB = -lcurses
#  else  /* !USE_TERMCAP_EMULATION */
TERMCAP_LIB = -ltermcap
#  endif /* !USE_TERMCAP_EMULATION */

#  if !defined (LD_HAS_NO_DASH_L)
#    if defined (HAVE_READLINE_SOURCE)
READLINE_LDFLAGS = $(SEARCH_LIB)$(RL_LIBSRC) $(TERMCAP_LDFLAGS)
#    else
READLINE_LDFLAGS = $(TERMCAP_LDFLAGS) $(SEARCH_LIB)$(libdir) \
		   $(SEARCH_LIB)/usr/local/lib
#    endif /* HAVE_READLINE_SOURCE */
#  endif /* LD_HAS_NO_DASH_L */

RL_SUPPORT_SRC = bashline.c bracecomp.c
RL_SUPPORT_OBJ = bashline.o $(BRACECOMP_OBJECT)
#endif /* READLINE */

#if defined (LD_HAS_NO_DASH_L)
LIBRARIES = READLINE_LIBRARY HISTORY_LIBRARY TERMCAP_LIBRARY GLOB_LIBRARY TILDE_LIBRARY MALLOC_LIBRARY $(LOCAL_LIBS)
#else /* !LD_HAS_NO_DASH_L */
LIBRARIES = $(READLINE_LIB) $(HISTORY_LIB) $(TERMCAP_LIB) $(GLOB_LIB) $(TILDE_LIB) $(MALLOC_LIB) $(LOCAL_LIBS)
#endif /* !LD_HAS_NO_DASH_L */

#if defined (READLINE)
#  if defined (HAVE_TERMCAP_SOURCE)
TERMCAP_DEP = TERMCAP_LIBRARY
#  endif /* HAVE_TERMCAP_SOURCE */
#  if defined (HAVE_READLINE_SOURCE)
READLINE_DEP = READLINE_LIBRARY
#  endif /* HAVE_READLINE_SOURCE */
#endif /* READLINE */

#if defined (HISTORY) && defined (HAVE_HISTORY_SOURCE) && !defined (READLINE)
HISTORY_DEP = HISTORY_LIBRARY
#endif

#if defined (USE_GLOB_LIBRARY)
GLOB_DEP = GLOB_LIBRARY
#else
GLOBC = glob.c fnmatch.c
GLOBO = glob.o fnmatch.o
#endif /* USE_GLOB_LIBRARY */

#if defined (HAVE_TILDE_SOURCE)
TILDE_DEP = TILDE_LIBRARY
#endif

LIBDEP = $(READLINE_DEP) $(TERMCAP_DEP) $(GLOB_DEP) $(HISTORY_DEP) $(TILDE_DEP) $(MALLOC_DEP)

#if defined (HAVE_READLINE_SOURCE)
#  define CLEAN_READLINE (cd $(RL_LIBSRC); $(MAKE) $(MFLAGS) clean)
#else
#  define CLEAN_READLINE :
#endif /* !HAVE_READLINE_SOURCE */

#if defined (HAVE_HISTORY_SOURCE)
#  if !defined (READLINE)
#    define CLEAN_HISTORY (cd $(HIST_LIBSRC); $(MAKE) $(MFLAGS) clean)
#  else
#    define CLEAN_HISTORY :
#  endif /* READLINE */
#endif /* !HAVE_HISTORY_SOURCE */

#if defined (HAVE_TERMCAP_SOURCE)
#  define CLEAN_TERMCAP (cd $(TERM_LIBSRC); $(MAKE) $(MFLAGS) clean)
#else
#  define CLEAN_TERMCAP :
#endif /* !HAVE_TERMCAP_SOURCE */

#if defined (USE_GLOB_LIBRARY)
#  define CLEAN_GLOB (cd $(GLOB_LIBSRC); $(MAKE) $(MFLAGS) clean)
#else
#  define CLEAN_GLOB :
#endif /* !USE_GLOB_LIBRARY */

#if defined (HAVE_TILDE_SOURCE)
#  define CLEAN_TILDE (cd $(TILDE_LIBSRC); $(MAKE) $(MFLAGS) clean)
#else
#  define CLEAN_TILDE :
#endif /* !HAVE_TILDE_SOURCE */

#if defined (USE_GNU_MALLOC_LIBRARY)
#  define CLEAN_MALLOC (cd $(MALLOC_LIBSRC); $(MAKE) $(MFLAGS) clean)
#else
#  define CLEAN_MALLOC :
#endif /* !USE_GNU_MALLOC_LIBRARY */

LIBRARY_LDFLAGS = $(READLINE_LDFLAGS) $(HISTORY_LDFLAGS) $(TILDE_LDFLAGS) \
		  $(GLOB_LDFLAGS) $(MALLOC_LDFLAGS)

SYSTEM_NAME = $(Machine)
OS_NAME = $(OS)

Program = bash

HOSTTYPE_DECL = -DHOSTTYPE='$(SYSTEM_NAME)'

#if defined (NotYet)
MachineManufacturer = ConfiguredManufacturer

MachineSystem = ConfiguredOS

MachineInfo = -DMachineManufacturer="$(MachineManufacturer)" \
	      -DMachineSystem="$(MachineSystem)"
#endif /* NotYet */

PPROMPT = '"${Program}\\$$ "'
SPROMPT = '"> "'

#if defined (MAINTAINER)
bash_maintainer = MAINTAINER
MAINTAIN_DEFINE = -DMAINTAINER='"$(bash_maintainer)"'
#endif

CFG_FLAGS = -DPPROMPT=$(PPROMPT) -DSPROMPT=$(SPROMPT) -DOS_NAME='$(OS_NAME)'\
	    -DSYSTEM_NAME='$(SYSTEM_NAME)' $(SIGLIST_FLAG) $(MAINTAIN_DEFINE)

ALLOC_DIR = ./lib/malloc/

#if defined (USE_GNU_MALLOC) && !defined (USE_GNU_MALLOC_LIBRARY)

MALLOC = $(ALLOC_DIR)malloc.o
MALLOC_DEP = $(ALLOC_DIR)malloc.c $(ALLOC_DIR)getpagesize.h
MALLOC_FLAGS = -Drcheck -Dbotch=programming_error

#define MALLOC_LIBRARY

#endif /* USE_GNU_MALLOC && !USE_GNU_MALLOC_LIBRARY */

/* If this user doesn't have alloca (), then we must try to supply them
   with a working one. */
#if !defined (HAVE_ALLOCA)
ALLOCA = $(ALLOC_DIR)alloca.o
#  if defined (ALLOCA_ASM)
ALLOCA_SOURCE = $(ALLOC_DIR)ALLOCA_ASM
ALLOCA_OBJECT = $(ALLOC_DIR)ALLOCA_OBJ
#  else
ALLOCA_SOURCE = $(ALLOC_DIR)alloca.c
ALLOCA_OBJECT = alloca.o
#  endif /* ALLOCA_ASM */
#endif /* !HAVE_ALLOCA */

/* Compilation flags to use in the shell directory and to pass to builds
   in subdirectories (readline, termcap) to ensure that alloca is treated
   in a consistent fashion. */
#if defined (HAVE_ALLOCA_H)
ALLOCA_H_DEFINE = -DHAVE_ALLOCA_H
#else
ALLOCA_H_DEFINE =
#endif /* HAVE_ALLOCA_H */

#if defined (HAVE_ALLOCA)
ALLOCA_DEFINE = -DHAVE_ALLOCA
#else
ALLOCA_DEFINE =
#endif /* HAVE_ALLOCA */

ALLOCA_CFLAGS = $(ALLOCA_DEFINE) $(ALLOCA_H_DEFINE)

/* Protect the `i386' used in the definition of ALLOC_FILES. */
#if defined (i386)
#  undef i386
#  define i386_defined
#endif /* i386 */

ALLOC_HEADERS = $(ALLOC_DIR)getpagesize.h
ALLOC_FILES = $(ALLOC_DIR)malloc.c $(ALLOC_DIR)alloca.c $(ALLOC_DIR)xmalloc.c \
	      $(ALLOC_DIR)i386-alloca.s $(ALLOC_DIR)x386-alloca.s

/* Perhaps restore the `i386' define. */
#if defined (i386_defined)
#  define i386
#  undef i386_defined
#endif /* i386_defined */

#if !defined (HAVE_SYS_SIGLIST)
SIGLIST = siglist.o
SIGLIST_FLAG=-DINITIALIZE_SIGLIST
#endif /* HAVE_SYS_SIGLIST */

#if !defined (HAVE_GETCWD)
GETCWD = getcwd.o
#endif /* !HAVE_GETCWD */

#if defined (RANLIB_LOCATION)
RANLIB = RANLIB_LOCATION
#else
RANLIB = ranlib
#endif /* RANLIB_LOCATION */

BRACES_SOURCE	 = braces.c
BRACECOMP_SOURCE = bracecomp.c
#if defined (BRACE_EXPANSION)
BRACES_OBJECT = braces.o
#  if defined (READLINE)
BRACECOMP_OBJECT = bracecomp.o
#  endif /* READLINE */
#endif /* BRACE_EXPANSION */

#if defined (REQUIRED_LIBRARIES)
LOCAL_LIBS = REQUIRED_LIBRARIES
#endif /* REQUIRED_LIBRARIES */

BUILTINS_LIB = builtins/libbuiltins.a

CSOURCES = shell.c parse.y general.c make_cmd.c print_cmd.c y.tab.c \
	   dispose_cmd.c execute_cmd.c variables.c $(GLOBC) version.c \
	   expr.c copy_cmd.c flags.c subst.c hash.c mailcheck.c \
	   test.c trap.c jobs.c nojobs.c $(ALLOC_FILES) $(BRACES_SOURCE) \
	   vprint.c input.c \
	   unwind_prot.c siglist.c getcwd.c $(RL_SUPPORT_SRC) error.c

HSOURCES = shell.h flags.h trap.h hash.h jobs.h builtins.h alias.c y.tab.h \
	   general.h variables.h config.h $(ALLOC_HEADERS) alias.h maxpath.h \
	   quit.h machines.h posixstat.h filecntl.h unwind_prot.h parser.h \
	   command.h input.h error.h bashansi.h dispose_cmd.h make_cmd.h \
	   subst.h siglist.h

SOURCES	 = $(CSOURCES) $(HSOURCES) $(BUILTIN_DEFS)

OBJECTS	 = shell.o y.tab.o general.o make_cmd.o print_cmd.o $(GLOBO) \
	   dispose_cmd.o execute_cmd.o variables.o copy_cmd.o error.o \
	   expr.o flags.o jobs.o subst.o hash.o mailcheck.o test.o \
	   trap.o alias.o $(MALLOC) $(ALLOCA) $(BRACES_OBJECT) unwind_prot.o \
	   $(VPRINT_OBJ) input.o \
	   $(SIGLIST) $(GETCWD) version.o $(RL_SUPPORT_OBJ) $(BUILTINS_LIB)

#if defined (LOAD_BUILTIN)
LOAD_DEF = $(DEFDIR)load.def
#endif /* LOAD_BUILTIN */

DEFDIR = builtins/
BUILTIN_DEFS = $(DEFDIR)alias.def $(DEFDIR)bind.def $(DEFDIR)break.def \
	       $(DEFDIR)builtin.def $(DEFDIR)cd.def $(DEFDIR)colon.def \
	       $(DEFDIR)command.def $(DEFDIR)declare.def $(LOAD_DEF) \
	       $(DEFDIR)echo.def $(DEFDIR)enable.def $(DEFDIR)eval.def \
	       $(DEFDIR)exec.def $(DEFDIR)exit.def $(DEFDIR)fc.def \
	       $(DEFDIR)fg_bg.def $(DEFDIR)hash.def $(DEFDIR)help.def \
	       $(DEFDIR)history.def $(DEFDIR)jobs.def $(DEFDIR)kill.def \
	       $(DEFDIR)let.def $(DEFDIR)read.def $(DEFDIR)return.def \
	       $(DEFDIR)set.def $(DEFDIR)setattr.def $(DEFDIR)shift.def \
	       $(DEFDIR)source.def $(DEFDIR)suspend.def $(DEFDIR)test.def \
	       $(DEFDIR)times.def $(DEFDIR)trap.def $(DEFDIR)type.def \
	       $(DEFDIR)ulimit.def $(DEFDIR)umask.def $(DEFDIR)wait.def \
	       $(DEFDIR)getopts.def $(DEFDIR)reserved.def
BUILTIN_C_CODE  = $(DEFDIR)mkbuiltins.c $(DEFDIR)common.c \
		  $(DEFDIR)hashcom.h $(DEFDIR)/bashgetopt.c $(GETOPT_SOURCE)
GETOPT_SOURCE   = $(DEFDIR)getopt.c $(DEFDIR)getopt.h
PSIZE_SOURCE	= $(DEFDIR)psize.sh $(DEFDIR)psize.c
BUILTIN_SUPPORT = $(DEFDIR)Makefile $(DEFDIR)ChangeLog $(PSIZE_SOURCE) \
		  $(BUILTIN_C_CODE)

DOCDIR = ./documentation/
BASH_TEXINFO = $(DOCDIR)*.texi $(DOCDIR)*.tex $(DOCDIR)texindex.c \
	        $(DOCDIR)*.dvi $(DOCDIR)Makefile
BASH_MAN = $(DOCDIR)bash.1
BASHDOCS = $(BASH_TEXINFO) $(BASH_MAN) INSTALL README RELEASE
DOCUMENTATION = $(BASHDOCS) $(LIBRARY_DOC)

/* This has to be written funny to avoid looking like a comment starter. */
EXAMPLES = examples/[a-zA-Z]*

ENDIAN_SUPPORT = endian.c
#if !defined (HAVE_WAIT_H)
ENDIAN_HEADER = bash-endian.h
#else
ENDIAN_HEADER =
#endif
ENDIAN_OUTPUT = endian.aux $(ENDIAN_HEADER)

SIGNAMES_SUPPORT = signames.c
SIGNAMES_OUTPUT  = signames.aux signames.h

SUPPORT_SRC = $(srcdir)/support/
SDIR = ./support/
MKTARFILE = $(SDIR)mktarfile
SCRIPTS_SUPPORT = $(SUPPORT_SRC)mksysdefs $(SUPPORT_SRC)cppmagic \
		  $(SUPPORT_SRC)cat-s $(MKTARFILE) $(SUPPORT_SRC)mail-shell \
		  $(SUPPORT_SRC)inform $(SUPPORT_SRC)/fixdist \
		  $(SUPPORT_SRC)mklinks $(SUPPORT_SRC)PORTING \
		  $(SUPPORT_SRC)/clone.bash
FAQ = $(SUPPORT_SRC)FAQ

TEST_SUITE = ./test-suite/
TEST_SUITE_SUPPORT = $(TEST_SUITE)[a-zA-Z0-9]*

CREATED_SUPPORT = $(ENDIAN_OUTPUT) $(SIGNAMES_OUTPUT) sysdefs.h \
		  $(SDIR)getcppsyms

SUPPORT = configure $(ENDIAN_SUPPORT) $(SIGNAMES_SUPPORT) $(SCRIPTS_SUPPORT) \
	  $(BUILTIN_SUPPORT) COPYING Makefile cpp-Makefile ChangeLog \
	  .distribution newversion.c $(EXAMPLES) $(SUPPORT_SRC)bash.xbm \
	  $(FAQ) $(SUPPORT_SRC)getcppsyms.c $(TEST_SUITE_SUPPORT)

BAGGAGE = longest_sig.c

THINGS_TO_TAR = $(SOURCES) $(LIBRARY_TAR) $(BASHDOCS) $(SUPPORT) $(BAGGAGE)

all: .made

.NOEXPORT:

.made: $(Program)
	cp .machine .made

$(Program):  .build $(OBJECTS) $(LIBDEP) .distribution
	$(RM) $@
	$(CC) $(LDFLAGS) $(LIBRARY_LDFLAGS) -o $(Program) $(OBJECTS) $(LIBRARIES)
	ls -l $(Program)
	size $(Program)

.build:	$(SOURCES) cpp-Makefile newversion.aux
	if ./newversion.aux -build; then mv -f newversion.h version.h; fi
	@echo
	@echo "	  ***************************************************"
	@echo "	  *						    *"
	@echo "	  * Making Bash-`cat .distribution` for a $(Machine) running $(OS)."
	@echo "	  *						    *"
	@echo "	  ***************************************************"
	@echo
	@echo "$(Program) last made for a $(Machine) running $(OS)" >.machine

version.h:	newversion.aux
	if ./newversion.aux -build; then mv -f newversion.h version.h; fi

y.tab.c:	parse.y parser.h command.h input.h
		-if test -f y.tab.h; then mv -f y.tab.h old-y.tab.h; fi
		@echo expect 66 shift/reduce conflicts
		$(BISON) -d parse.y
		-if cmp -s old-y.tab.h y.tab.h; then mv old-y.tab.h y.tab.h; fi

#if defined (READLINE) && defined (HAVE_READLINE_SOURCE)
READLINE_LIBRARY: $(READLINE_SOURCE)
	build_lib_in_dir ($(RL_LIBSRC), libreadline.a)
#endif /* READLINE && HAVE_READLINE_SOURCE */

#if defined (HISTORY) && defined (HAVE_HISTORY_SOURCE) && !defined (READLINE)
HISTORY_LIBRARY: $(HISTORY_SOURCE)
	build_lib_in_dir ($(HIST_LIBSRC), libhistory.a)
#endif /* HISTORY && HAVE_HISTORY_SOURCE && !READLINE */

#if defined (HAVE_TERMCAP_SOURCE)
TERMCAP_LIBRARY: $(TERMCAP_SOURCE)
	build_lib_in_dir ($(TERM_LIBSRC), libtermcap.a)
#endif /* HAVE_TERMCAP_SOURCE */

#if defined (USE_GLOB_LIBRARY)
GLOB_LIBRARY: $(GLOB_SOURCE)
	build_lib_in_dir ($(GLOB_LIBSRC), libglob.a)
#endif /* USE_GLOB_LIBRARY */

#if defined (HAVE_TILDE_SOURCE)
TILDE_LIBRARY: $(TILDE_SOURCE)
	build_lib_in_dir ($(TILDE_LIBSRC), libtilde.a)
#endif /* HAVE_TILDE_SOURCE */

#if defined (USE_GNU_MALLOC) && defined (USE_GNU_MALLOC_LIBRARY)
MALLOC_LIBRARY: $(MALLOC_SOURCE)
	build_lib_in_dir ($(MALLOC_LIBSRC), libmalloc.a)
#endif /* USE_GNU_MALLOC && USE_GNU_MALLOC_LIBRARY */

version.o:    version.h version.c

shell.o:      shell.h flags.h shell.c posixstat.h filecntl.h \
              $(ENDIAN_HEADER) parser.h
		$(RM) $@
		$(CC) $(CFG_FLAGS) $(CFLAGS) $(CPPFLAGS) -c shell.c

#if !defined (HAVE_WAIT_H)
$(ENDIAN_HEADER):     endian.aux
		$(RM) $@
		./endian.aux $@

endian.aux:   endian.c
		$(RM) $@
		$(CC) $(CFLAGS) -o $@ endian.c
#endif

signames.h:   signames.aux
		$(RM) $@
		./signames.aux $@

signames.aux:	signames.c
		$(RM) $@
		$(CC) $(CFLAGS) -o $@ signames.c

#if defined (USE_GNU_MALLOC) && !defined (USE_GNU_MALLOC_LIBRARY)
/* Note that gcc correctly leaves the output file in the source directory. */
#if !defined (__GNUC__)
$(MALLOC):	$(MALLOC_DEP)
		$(RM) $@
		$(CC) -I$(ALLOC_DIR) $(CFLAGS) $(MALLOC_FLAGS) -c $*.c
		@-mv `basename $*`.o $(MALLOC) 2>/dev/null
#else
$(MALLOC):	$(MALLOC_DEP)
		$(CC) -I$(ALLOC_DIR) $(CFLAGS) $(MALLOC_FLAGS) \
		    -o $(MALLOC) -c $*.c
#endif /* __GNUC__ */
#endif /* USE_GNU_MALLOC && !USE_GNU_MALLOC_LIBRARY */

#if !defined (HAVE_ALLOCA)
/* Note that gcc correctly leaves the output file in the source directory. */
$(ALLOCA):	$(ALLOCA_SOURCE)
		$(CC) -I$(ALLOC_DIR) $(CFLAGS) -c $(ALLOCA_SOURCE)
		@-mv $(ALLOCA_OBJECT) $(ALLOCA) >/dev/null 2>&1
#endif /* !HAVE_ALLOCA */

variables.o:  shell.h hash.h flags.h variables.h variables.c
		$(RM) $@
		$(CC) -c $(CFLAGS) $(HOSTTYPE_DECL) $(CPPFLAGS) variables.c

builtins/libbuiltins.a: $(BUILTIN_DEFS) $(BUILTIN_C_CODE) config.h
	build_builtins_in_dir ($(DEFDIR))

builtins/builtext.h: builtins/libbuiltins.a

$(SDIR)bashbug: $(SDIR)bashbug.c version.h
	$(RM) $@
	-$(CC) $(CFLAGS) $(CFG_FLAGS) -o $(SDIR)bashbug $(SDIR)bashbug.c

/* Dependencies for the main bash source. */
copy_cmd.o: shell.h command.h hash.h
copy_cmd.o: general.h variables.h config.h quit.h
dispose_cmd.o: shell.h command.h
dispose_cmd.o: general.h variables.h config.h quit.h
error.o: error.h
execute_cmd.o: shell.h command.h y.tab.h posixstat.h flags.h jobs.h
execute_cmd.o: general.h variables.h config.h quit.h hash.h $(ENDIAN_HEADER)
execute_cmd.o: unwind_prot.h siglist.h builtins/builtext.h
expr.o: shell.h command.h hash.h
expr.o: general.h variables.h config.h quit.h
flags.o: flags.h config.h general.h quit.h
general.o: shell.h command.h maxpath.h
general.o: general.h variables.h config.h quit.h machines.h
hash.o: shell.h command.h hash.h
hash.o: general.h variables.h config.h quit.h
jobs.o: shell.h command.h hash.h trap.h jobs.h siglist.h
jobs.o: general.h variables.h config.h $(ENDIAN_HEADER) quit.h builtins/builtext.h
mailcheck.o: posixstat.h maxpath.h variables.h
mailcheck.o: hash.h quit.h
make_cmd.o: shell.h command.h flags.h
make_cmd.o: general.h variables.h config.h quit.h
y.tab.o: shell.h command.h flags.h maxpath.h alias.h
y.tab.o: general.h variables.h config.h quit.h
print_cmd.o: shell.h command.h y.tab.h
print_cmd.o: general.h variables.h config.h quit.h
shell.o: shell.h command.h flags.h machines.h
shell.o: general.h variables.h config.h quit.h
shell.o: posixstat.h filecntl.h jobs.h input.h
subst.o: shell.h command.h flags.h jobs.h siglist.h
subst.o: general.h variables.h config.h $(ENDIAN_HEADER) quit.h
test.o: posixstat.h
trap.o: trap.h shell.h command.h hash.h unwind_prot.h signames.h
trap.o: general.h variables.h config.h quit.h
unwind_prot.o: config.h general.h unwind_prot.h
variables.o: shell.h command.h hash.h flags.h
variables.o: config.h general.h variables.h quit.h
version.o: version.h .build

alias.o: ansi_stdlib.h
bashline.o: ansi_stdlib.h
variables.o: ansi_stdlib.h
shell.o: ansi_stdlib.h
error.o: ansi_stdlib.h
hash.o: ansi_stdlib.h
signames.o: ansi_stdlib.h
expr.o: ansi_stdlib.h
general.o: ansi_stdlib.h
input.o: ansi_stdlib.h

#if !defined (JOB_CONTROL)
jobs.o: nojobs.c
#endif /* !JOB_CONTROL */

#if defined (BRACE_EXPANSION)
braces.o: general.h shell.h variables.h quit.h config.h
braces.o: maxpath.h unwind_prot.h command.h
#  if defined (READLINE)
bracecomp.o: bracecomp.c
bracecomp.o: shell.h command.h hash.h builtins.h general.h variables.h
bracecomp.o: quit.h alias.h
#    if defined (HAVE_READLINE_SOURCE)
bracecomp.o: $(RL_LIBSRC)readline.h
#    endif /* HAVE_READLINE_SOURCE */
#  endif /* READLINE */
#endif /* BRACE_EXPANSION */

#if defined (READLINE)
bashline.o: shell.h command.h hash.h builtins.h
bashline.o: general.h variables.h config.h quit.h alias.h
#endif /* READLINE */

/* Dependencies which rely on the user using the source to READLINE. */
#if defined (READLINE) && defined (HAVE_READLINE_SOURCE)
bashline.o: $(RL_LIBSRC)chardefs.h $(RL_LIBSRC)readline.h $(RL_LIBSRC)keymaps.h
y.tab.o: $(RL_LIBSRC)keymaps.h $(RL_LIBSRC)chardefs.h $(RL_LIBSRC)readline.h
#endif /* READLINE && HAVE_READLINE_SOURCE */

#if defined (HISTORY) && defined (HAVE_HISTORY_SOURCE)
subst.o: $(HIST_LIBSRC)history.h
bashline.o: $(HIST_LIBSRC)history.h
y.tab.o: $(HIST_LIBSRC)history.h
#endif /* HISTORY && HAVE_HISTORY_SOURCE */

#if defined (USE_GLOB_LIBRARY)
subst.o: $(GLOB_LIBSRC)fnmatch.h
execute_cmd.o: $(GLOB_LIBSRC)fnmatch.h
#endif /* USE_GLOB_LIBRARY */

/* Dependencies for the shell builtins. */
builtins/common.o: shell.h command.h config.h general.h error.h
builtins/common.o: variables.h input.h hashcom.h siglist.h
builtins/common.o: quit.h  unwind_prot.h maxpath.h jobs.h builtins.h

builtins/alias.o: command.h config.h error.h general.h maxpath.h
builtins/alias.o: quit.h builtins/common.h
builtins/alias.o: shell.h command.h unwind_prot.h variables.h 
builtins/bind.o: command.h config.h error.h general.h maxpath.h quit.h 
builtins/bind.o: shell.h unwind_prot.h variables.h 
builtins/bind.o: builtins/bashgetopt.h
builtins/break.o: command.h config.h error.h general.h maxpath.h
builtins/break.o: quit.h 
builtins/break.o: shell.h unwind_prot.h variables.h 
builtins/builtin.o: command.h config.h error.h general.h maxpath.h
builtins/builtin.o: quit.h builtins/common.h
builtins/builtin.o: shell.h unwind_prot.h variables.h 
builtins/cd.o: command.h config.h error.h general.h maxpath.h quit.h 
builtins/cd.o: shell.h unwind_prot.h variables.h builtins/common.h
builtins/command.o: command.h config.h error.h general.h maxpath.h
builtins/command.o: quit.h builtins/bashgetopt.h
builtins/command.o: shell.h unwind_prot.h variables.h 
builtins/declare.o: command.h config.h error.h general.h maxpath.h
builtins/declare.o: quit.h 
builtins/declare.o: shell.h unwind_prot.h variables.h 
builtins/echo.o: command.h config.h error.h general.h maxpath.h
builtins/echo.o: quit.h 
builtins/echo.o: shell.h unwind_prot.h variables.h 
builtins/enable.o: command.h config.h error.h general.h maxpath.h
builtins/enable.o: quit.h 
builtins/enable.o: shell.h unwind_prot.h variables.h 
builtins/eval.o: command.h config.h error.h general.h maxpath.h quit.h 
builtins/eval.o: shell.h unwind_prot.h variables.h 
builtins/exec.o: command.h config.h error.h general.h maxpath.h quit.h 
builtins/exec.o: shell.h unwind_prot.h variables.h builtins/common.h
builtins/exit.o: command.h config.h error.h general.h maxpath.h
builtins/exit.o: quit.h
builtins/exit.o: shell.h unwind_prot.h variables.h 
builtins/fc.o: builtins.h command.h 
builtins/fc.o: command.h config.h error.h general.h maxpath.h quit.h 
builtins/fc.o: flags.h unwind_prot.h variables.h shell.h 
builtins/fc.o: builtins/bashgetopt.h
builtins/fg_bg.o: command.h config.h error.h general.h maxpath.h
builtins/fg_bg.o: quit.h 
builtins/fg_bg.o: shell.h unwind_prot.h variables.h 
builtins/getopts.o: command.h config.h error.h general.h maxpath.h quit.h 
builtins/getopts.o: shell.h unwind_prot.h variables.h 
builtins/hash.o: builtins.h command.h 
builtins/hash.o: command.h config.h error.h general.h maxpath.h quit.h 
builtins/hash.o: shell.h unwind_prot.h variables.h builtins/common.h
builtins/help.o: command.h config.h error.h general.h maxpath.h
builtins/help.o: quit.h 
builtins/help.o: shell.h unwind_prot.h variables.h 
builtins/history.o: command.h config.h error.h general.h maxpath.h
builtins/history.o: quit.h
builtins/history.o: filecntl.h shell.h unwind_prot.h variables.h 
builtins/inlib.o: command.h config.h error.h general.h maxpath.h quit.h 
builtins/inlib.o: shell.h unwind_prot.h variables.h 
builtins/jobs.o: command.h config.h error.h general.h maxpath.h
builtins/jobs.o: quit.h builtins/bashgetopt.h
builtins/jobs.o: shell.h unwind_prot.h variables.h 
builtins/kill.o: command.h config.h error.h general.h maxpath.h
builtins/kill.o: quit.h
builtins/kill.o: shell.h trap.h unwind_prot.h variables.h 
builtins/let.o: command.h config.h error.h general.h maxpath.h
builtins/let.o: quit.h 
builtins/let.o: shell.h unwind_prot.h variables.h 
builtins/read.o: command.h config.h error.h general.h maxpath.h
builtins/read.o: quit.h 
builtins/read.o: shell.h unwind_prot.h variables.h 
builtins/return.o: command.h config.h error.h general.h maxpath.h
builtins/return.o: quit.h 
builtins/return.o: shell.h unwind_prot.h variables.h 
builtins/set.o: command.h config.h error.h general.h maxpath.h
builtins/set.o: quit.h 
builtins/set.o: shell.h unwind_prot.h variables.h 
builtins/setattr.o: command.h config.h error.h general.h maxpath.h
builtins/setattr.o: quit.h builtins/common.h builtins/bashgetopt.h
builtins/setattr.o: shell.h unwind_prot.h variables.h 
builtins/shift.o: command.h config.h error.h general.h maxpath.h
builtins/shift.o: quit.h 
builtins/shift.o: shell.h unwind_prot.h variables.h 
builtins/source.o: command.h config.h error.h general.h maxpath.h
builtins/source.o: quit.h 
builtins/source.o: shell.h unwind_prot.h variables.h 
builtins/suspend.o: command.h config.h error.h general.h maxpath.h
builtins/suspend.o: quit.h
builtins/suspend.o: shell.h unwind_prot.h variables.h 
builtins/test.o: command.h config.h error.h general.h maxpath.h
builtins/test.o: quit.h 
builtins/test.o: shell.h unwind_prot.h variables.h 
builtins/times.o: command.h config.h error.h general.h maxpath.h
builtins/times.o: quit.h
builtins/times.o: shell.h unwind_prot.h variables.h 
builtins/trap.o: command.h config.h error.h general.h maxpath.h
builtins/trap.o: quit.h builtins/common.h
builtins/trap.o: shell.h unwind_prot.h variables.h 
builtins/type.o: command.h config.h error.h general.h maxpath.h
builtins/type.o: quit.h builtins/common.h
builtins/type.o: shell.h unwind_prot.h variables.h 
builtins/ulimit.o: command.h config.h error.h general.h maxpath.h
builtins/ulimit.o: quit.h 
builtins/ulimit.o: shell.h unwind_prot.h variables.h 
builtins/umask.o: command.h config.h error.h general.h maxpath.h
builtins/umask.o: quit.h 
builtins/umask.o: shell.h unwind_prot.h variables.h 
builtins/wait.o: command.h config.h error.h general.h maxpath.h
builtins/wait.o: quit.h 
builtins/wait.o: shell.h unwind_prot.h variables.h

builtins/mkbuiltins.o: ansi_stdlib.h
builtins/fc.o: ansi_stdlib.h

$(Program).tar: $(THINGS_TO_TAR) .distribution
	@$(MKTARFILE) $(Program) `cat .distribution` $(THINGS_TO_TAR)

$(Program).tar$(COMPRESS_EXT):	$(Program).tar
		$(COMPRESS) < $(Program).tar > $@

clone:		$(THINGS_TO_TAR)
		@$(MKTARFILE) +notar $(Machine) $(OS) $(THINGS_TO_TAR)

install:	.made
		-if [ -f $(bindir)/$(Program) ]; \
		  then mv $(bindir)/$(Program) $(bindir)/$(Program).old; \
		fi
		cp $(Program) $(bindir)/$(Program)
		$(RM) installed-$(Program)
		-ln -s $(bindir)/$(Program) installed-$(Program)
		( cd $(DOCDIR) ; $(MAKE) $(MFLAGS) mandir=$(mandir) infodir=$(infodir) $@ )

mailable:	distribution
		/bin/rm -rf uuencoded
		mkdir uuencoded
		$(SHELL) -c 'f=$(Program)-`cat .distribution`.tar.Z;uuencode $$f $$f | split -800 - uuencoded/$$f.uu.'

.distribution:
		./newversion.aux -dist `$(Program) -c 'echo $$BASH_VERSION'`

distribution:	$(Program) $(Program).tar$(COMPRESS_EXT) .distribution
		@echo cp $(Program).tar$(COMPRESS_EXT) \
			$(Program)-`cat .distribution`.tar$(COMPRESS_EXT)
		@cp $(Program).tar$(COMPRESS_EXT) \
			$(Program)-`cat .distribution`.tar$(COMPRESS_EXT)

newversion.aux:	newversion.c
		$(CC) $(CFLAGS) -o newversion.aux newversion.c -lm

newversion:	newversion.aux
		$(RM) .build
		./newversion.aux -dist
		mv -f newversion.h version.h
		$(MAKE) $(MFLAGS)

documentation:  documentation-force
		(cd $(DOCDIR); $(MAKE) $(MFLAGS))

documentation-force:

tags:		$(SOURCES) $(BUILTIN_C_CODE) $(LIBRARY_SOURCE)
		etags $(SOURCES) $(BUILTIN_C_CODE) $(LIBRARY_SOURCE)

INDEX:		$(SOURCES) $(BUILTIN_C_CODE) $(LIBRARY_SOURCE)
		ctags -x $(SOURCES) $(BUILTIN_C_CODE) $(LIBRARY_SOURCE) > $@

clean:
		$(RM) $(OBJECTS) $(Program) ansi-Makefile *.aux
		$(RM) .build .made version.h
		$(RM) $(CREATED_SUPPORT) bash-Makefile
		(cd $(DOCDIR); $(MAKE) $(MFLAGS) clean)
		(cd builtins; $(MAKE) $(MFLAGS) clean)
		CLEAN_READLINE;
		CLEAN_HISTORY;
		CLEAN_TERMCAP;
		CLEAN_GLOB;
		CLEAN_TILDE;
		CLEAN_MALLOC;

distclean:	clean
realclean:	clean
		$(RM) y.tab.c y.tab.h

architecture: $(Machine)-$(OS)/$(Program)

$(Machine)-$(OS):
	-mkdir $(Machine)-$(OS)

$(Machine)-$(OS)/$(Program): $(Machine)-$(OS) $(Program)
	mv $(Program) $(Machine)-$(OS)
	mv sysdefs.h $(Machine)-$(OS)
	mv $(SDIR)getcppsyms $(Machine)-$(OS)
	$(MAKE) $(MFLAGS) clean

DEFINES: config.h cpp-Makefile sysdefs.h
	echo $(CFLAGS) $(CPPFLAGS) >DEFINES
