home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR24 / BASH_112.ZIP / BASH-112.TAR / bash-1.12 / cpp-makefile < prev    next >
Makefile  |  1992-01-25  |  28KB  |  823 lines

  1. /* This -*- C -*- file (cpp-Makefile) is run through the C preprocessor
  2.    to produce bash-Makefile which is machine specific.
  3.  
  4.    If you have Gcc and/or Bison, you might wish to mention that right
  5.    below here.
  6.  
  7.    Since this is to become a Makefile, blank lines which appear outside
  8.    of comments may not contain a TAB character.
  9.  
  10.    Copyright (C) 1987,1991 Free Software Foundation, Inc.
  11.  
  12.    This file is part of GNU Bash, the Bourne Again SHell.
  13.  
  14.    Bash is free software; you can redistribute it and/or modify it under
  15.    the terms of the GNU General Public License as published by the Free
  16.    Software Foundation; either version 1, or (at your option) any later
  17.    version.
  18.  
  19.    Bash is distributed in the hope that it will be useful, but WITHOUT ANY
  20.    WARRANTY; without even the implied warranty of MERCHANTABILITY or
  21.    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  22.    for more details.
  23.  
  24.    You should have received a copy of the GNU General Public License along
  25.    with Bash; see the file COPYING.  If not, write to the Free Software
  26.    Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
  27.  
  28. /**/# This Makefile is automagically made from cpp-Makefile.  You should
  29. /**/# not be editing this file; edit cpp-Makefile, machines.h, or
  30. /**/# support/mksysdefs instead.  Then, assuming the edits were required
  31. /**/# to compile Bash on your system, mail the changes you had to make to
  32. /**/# bash-maintainers@ai.mit.edu.  We will do our best to incorporate
  33. /**/# them into the next release.
  34.  
  35. /* **************************************************************** */
  36. /*                                    */
  37. /*            Which compiler are you using?            */
  38. /*                                    */
  39. /* **************************************************************** */
  40.  
  41. /* Define HAVE_GCC if you have the GNU C compiler. */
  42. /* #define HAVE_GCC */
  43.  
  44. /* Define HAVE_FIXED_INCLUDES if you are using GCC with the fixed
  45.    header files. */
  46. #if defined (HAVE_GCC) && !defined (HAVE_FIXED_INCLUDES)
  47. /* #define HAVE_FIXED_INCLUDES */
  48. #endif /* HAVE_GCC && !HAVE_FIXED_INCLUDES */
  49.  
  50. /* Define HAVE_BISON if you have the GNU replacement for Yacc. */
  51. /**/# We would like you to use Bison instead of Yacc since some
  52. /**/# versions of Yacc cannot handle reentrant parsing.  Unfortunately,
  53. /**/# this includes the Yacc currently being shipped with SunOS4.x.
  54. /**/# If you do use Yacc, please make sure that any bugs in parsing
  55. /**/# are not really manifestations of Yacc bugs before you report
  56. /**/# them.
  57. #define HAVE_BISON
  58.  
  59. /* This includes the appropriate description for the machine that you are
  60.    using (we hope).  If the compilation doesn't work correctly, then you
  61.    will have to edit the file `machines.h' to include a description for the
  62.    machine that your Cpp uniquely identifies this as.  For example, Sun 4's
  63.    are recognized by the Cpp identifier `sparc', Vax is recognized with `vax',
  64.    etc.  The order of these files is very important.  Config.h must come last,
  65.    since it is capable of undef'ing various things. */
  66. #define BUILDING_MAKEFILE   /* Tell config.h to avoid #including anything. */
  67. #include "sysdefs.h"
  68. #include "machines.h"
  69. #include "config.h"
  70.  
  71. /**/# Here is a rule for making .o files from .c files that does not
  72. /**/# force the type of the machine (like -M_MACHINE) into the flags.
  73. .c.o:
  74.     $(RM) $@
  75.     $(CC) $(CFLAGS) $(CPPFLAGS) -c $*.c
  76.  
  77. #if defined (HAVE_BISON)
  78. BISON = bison -y
  79. #else
  80. BISON = yacc
  81. #endif
  82.  
  83. #if defined (HAVE_GCC)
  84. #  if defined (GCC_FLAGS)
  85. GCC_EXTRAS = GCC_FLAGS
  86. #  endif /* GCC_FLAGS */
  87. #  if !defined (HAVE_FIXED_INCLUDES)
  88. /* This is guaranteed to work, even if you have the fixed includes!
  89.    (Unless, of course, you have the fixed include files installed in
  90.    /usr/include.  Then it will break.) */
  91. #    if defined (isc386)
  92. CC = gcc -traditional -posix -I/usr/include $(GCC_EXTRAS)
  93. #    else
  94. CC = gcc -traditional -I/usr/include $(GCC_EXTRAS)
  95. #    endif /* isc386 */
  96. #  else /* HAVE_FIXED_INCLUDES */
  97. #    if defined (isc386)
  98. CC = gcc -posix $(GCC_EXTRAS)
  99. #    else /* !isc386 */
  100. CC = gcc $(GCC_EXTRAS)
  101. #    endif /* isc386 */
  102. #  endif /* HAVE_FIXED_INCLUDES */
  103. #else /* !HAVE_GCC */
  104. CC = CPP_CC
  105. #endif /* !HAVE_GCC */
  106.  
  107. /**/# Of course, you cannot do this the first time through...
  108. /**/#SHELL=$(DESTDIR)/bash
  109. SHELL=/bin/sh
  110.  
  111. RM = rm -f
  112. AR = ar
  113.  
  114. MACHINE = M_MACHINE
  115. OS = M_OS
  116.  
  117. /**/# PROFILE_FLAGS is either -pg, to generate profiling info for use
  118. /**/# with gprof, or nothing (the default).
  119. PROFILE_FLAGS=
  120.  
  121. #if defined (HAVE_SHARED_LIBS) && defined (sun)
  122. #  if !defined (HAVE_GCC)
  123. /**/# On Sun systems, we compile without shared libraries so we
  124. /**/# can debug the shell with gdb.
  125. NOSHARE = -Bstatic
  126. #  endif
  127. #endif
  128.  
  129. #if defined (SYSDEP_CFLAGS)
  130. /**/# This system has some peculiar flags that must be passed to the
  131. /**/# the C compiler (or to cpp).
  132. SYSDEP = SYSDEP_CFLAGS
  133. #endif /* SYSDEP_CFLAGS */
  134.  
  135. #if defined (SYSDEP_LDFLAGS)
  136. /**/# This system has some peculiar flags that must be passed to the
  137. /**/# link editor (ld).
  138. SYSDEP_LD = SYSDEP_LDFLAGS
  139. #endif /* SYSDEP_LDFLAGS */
  140.  
  141. #if defined (HAVE_SETLINEBUF)
  142. /**/# This system has the setlinebuf () call.
  143. LINEBUF = -DHAVE_SETLINEBUF
  144. #endif
  145.  
  146. #if defined (HAVE_VFPRINTF)
  147. /**/# This system has the vprintf () and vfprintf () calls.
  148. VPRINTF = -DHAVE_VFPRINTF
  149. #endif /* HAVE_VFPRINTF */
  150.  
  151. #if defined (HAVE_UNISTD_H)
  152. /**/# This system has <unistd.h>.
  153. UNISTD = -DHAVE_UNISTD_H
  154. #endif
  155.  
  156. #if defined (HAVE_GETGROUPS)
  157. /**/# This system has multiple groups.
  158. GROUPS = -DHAVE_GETGROUPS
  159. #endif
  160.  
  161. #if defined (HAVE_RESOURCE)
  162. /**/# This system has <sys/resource.h>
  163. RESOURCE = -DHAVE_RESOURCE
  164. #endif
  165.  
  166. #if defined (VOID_SIGHANDLER)
  167. /**/# The signal () call of this system returns a pointer to a function
  168. /**/# returning void.  The signal handlers themselves are thus void functions.
  169. SIGHANDLER = -DVOID_SIGHANDLER
  170. #endif
  171.  
  172. #if defined (HAVE_STRERROR)
  173. /**/# This system has the strerror () function.
  174. STRERROR = -DHAVE_STRERROR
  175. #endif
  176.  
  177. #if defined (HAVE_WAIT_H)
  178. /**/# This system has <sys/wait.h>
  179. WAITH = -DHAVE_WAIT_H
  180. #endif
  181.  
  182. #if defined (HAVE_GETWD)
  183. /**/# This system has the getwd () call.
  184. GETWD = -DHAVE_GETWD
  185. #endif
  186.  
  187. #if defined (HAVE_DUP2)
  188. /**/# This system has a working version of dup2 ().
  189. DUP2 = -DHAVE_DUP2
  190. #endif /* HAVE_DUP2 */
  191.  
  192. SYSTEM_FLAGS = $(LINEBUF) $(VPRINTF) $(UNISTD) $(GROUPS) $(RESOURCE) \
  193.        $(SIGHANDLER) $(SYSDEP) $(WAITH) $(GETWD) $(DUP2) $(STRERROR) \
  194.        -D$(MACHINE) -D$(OS)
  195. DEBUG_FLAGS = $(PROFILE_FLAGS) -g
  196. LDFLAGS    = $(NOSHARE) $(SYSDEP_LD) $(EXTRA_LD_PATH) $(DEBUG_FLAGS)
  197. CFLAGS    = $(DEBUG_FLAGS) $(SYSTEM_FLAGS) -DSHELL $(ALLOCA_CFLAGS)
  198. CPPFLAGS= -I$(LIBSRC)
  199.  
  200. /* It is conceviable that you wish to edit some things beyond this point,
  201.    but I guess that it is highly unlikely, and may give you a headache. */
  202.  
  203. /* **************************************************************** */
  204. /*                                    */
  205. /*            How to Build a Library                */
  206. /*                                    */
  207. /* **************************************************************** */
  208.  
  209. /* Defines used when building libraries. */
  210. #define LIB_CFLAGS_DECL CFLAGS='$(LIBRARY_CFLAGS) '$(LIBINC_USAGE)
  211. #define LIB_CPPFLAGS_DECL CPPFLAGS='$(CPPFLAGS)'
  212. #define LIB_LDFLAGS_DECL LDFLAGS='$(LDFLAGS)'
  213. #define LIBMAKE_FLAGS LIB_CFLAGS_DECL LIB_CPPFLAGS_DECL LIB_LDFLAGS_DECL \
  214.     RANLIB='$(RANLIB)' AR='$(AR)' CC='$(CC)'
  215.  
  216. /* Macro does library building. */
  217. #define build_lib_in_dir(directory) \
  218.     @echo "Building in " directory "..."; \
  219.     ($(LIBINC_DECL); cd directory; $(MAKE) $(MFLAGS) LIBMAKE_FLAGS)
  220.  
  221. /* The builtins are somewhat special in that more information is needed
  222.    to compile them correctly. */
  223. #define build_builtins_in_dir(directory) \
  224.     ($(LIBINC_DECL); cd directory; \
  225.      $(MAKE) $(MFLAGS) CPPFLAGS='$(CPPFLAGS)' \
  226.      CFLAGS='$(CFLAGS) '$(LIBINC_USAGE)' -I.' LDFLAGS='$(LDFLAGS)' \
  227.      RANLIB='$(RANLIB)' AR='$(AR)' CC='$(CC)' DIRECTDEFINE='-D 'directory)
  228.  
  229. /* Flags used when building libraries. */
  230. LIBRARY_CFLAGS  = $(DEBUG_FLAGS) $(SIGHANDLER) $(ALLOCA_CFLAGS) \
  231.           $(SYSDEP) -D$(MACHINE) -D$(OS) $(UNISTD) -DSHELL
  232.  
  233. /**/# These are required for sending bug reports.
  234. SYSTEM_NAME = $(MACHINE)
  235. OS_NAME = $(OS)
  236.  
  237. /**/# The name of this program.
  238. PROGRAM = bash
  239.  
  240. /**/# The type of machine Bash is being compiled on.
  241. HOSTTYPE_DECL = -DHOSTTYPE='$(SYSTEM_NAME)'
  242.  
  243. #if defined (NotYet)
  244. /**/# The name of the manufacturer of this machine.
  245. MachineManufacturer = ConfiguredManufacturer
  246.  
  247. /**/# The name of the operating system this machine is using.
  248. MachineSystem = ConfiguredOS
  249.  
  250. /**/# How to pass the above two variables into a source compilation.
  251. MachineInfo = -DMachineManufacturer="$(MachineManufacturer)" \
  252.           -DMachineSystem="$(MachineSystem)"
  253. #endif /* NotYet */
  254.  
  255. /**/# The default primary and secondary prompts.
  256. PPROMPT = '"${PROGRAM}\\$$ "'
  257. SPROMPT = '"> "'
  258.  
  259. #if defined (MAINTAINER)
  260. bash_maintainer = MAINTAINER
  261. MAINTAIN_DEFINE = -DMAINTAINER='"$(bash_maintainer)"'
  262. #endif
  263.  
  264. /**/# The group of configuration flags.  These are for shell.c
  265. CFG_FLAGS = -DPPROMPT=$(PPROMPT) -DSPROMPT=$(SPROMPT) -DOS_NAME='"$(OS_NAME)"'\
  266.         -DSYSTEM_NAME='$(SYSTEM_NAME)' $(SIGLIST_FLAG) $(MAINTAIN_DEFINE)
  267.  
  268. /**/# The directory which contains the source for malloc.  The name must
  269. /**/# end in a slash, as in "./lib/malloc/".
  270. ALLOC_DIR = ./lib/malloc/
  271.  
  272. /**/# Our malloc.
  273. #if defined (USE_GNU_MALLOC)
  274. MALLOC = $(ALLOC_DIR)malloc.o
  275. MALLOC_DEP = $(ALLOC_DIR)malloc.c $(ALLOC_DIR)getpagesize.h
  276. MALLOC_FLAGS = -Drcheck -Dbotch=programming_error
  277. #endif /* USE_GNU_MALLOC */
  278.  
  279. /* If this user doesn't have alloca (), then we must try to supply them
  280.    with a working one. */
  281. #if !defined (HAVE_ALLOCA)
  282. ALLOCA = $(ALLOC_DIR)alloca.o
  283. #  if defined (ALLOCA_ASM)
  284. ALLOCA_SOURCE = $(ALLOC_DIR)ALLOCA_ASM
  285. #  else
  286. ALLOCA_SOURCE = $(ALLOC_DIR)alloca.c
  287. #  endif /* ALLOCA_ASM */
  288. #endif /* !HAVE_ALLOCA */
  289.  
  290. /* Compilation flags to use in the shell directory and to pass to builds
  291.    in subdirectories (readline, termcap) to ensure that alloca is treated
  292.    in a consistent fashion. */
  293. #if defined (HAVE_ALLOCA_H)
  294. ALLOCA_H_DEFINE = -DHAVE_ALLOCA_H
  295. #else
  296. ALLOCA_H_DEFINE =
  297. #endif /* HAVE_ALLOCA_H */
  298.  
  299. #if defined (HAVE_ALLOCA)
  300. ALLOCA_DEFINE = -DHAVE_ALLOCA
  301. #else
  302. ALLOCA_DEFINE =
  303. #endif /* HAVE_ALLOCA */
  304.  
  305. ALLOCA_CFLAGS = $(ALLOCA_DEFINE) $(ALLOCA_H_DEFINE)
  306.  
  307. /* Protect the `i386' used in the definition of ALLOC_FILES. */
  308. #if defined (i386)
  309. #  undef i386
  310. #  define i386_defined
  311. #endif /* i386 */
  312.  
  313. ALLOC_HEADERS = $(ALLOC_DIR)getpagesize.h
  314. ALLOC_FILES = $(ALLOC_DIR)malloc.c $(ALLOC_DIR)alloca.c $(ALLOC_DIR)xmalloc.c \
  315.           $(ALLOC_DIR)i386-alloca.s $(ALLOC_DIR)x386-alloca.s
  316.  
  317. /* Perhaps restore the `i386' define. */
  318. #if defined (i386_defined)
  319. #  define i386
  320. #  undef i386_defined
  321. #endif /* i386_defined */
  322.  
  323. #if !defined (HAVE_SYS_SIGLIST)
  324. /**/# Since this system does not have sys_siglist, we define SIGLIST
  325. /**/# as siglist.o.
  326. SIGLIST = siglist.o
  327. SIGLIST_FLAG=-DINITIALIZE_SIGLIST
  328. #endif /* HAVE_SYS_SIGLIST */
  329.  
  330. #if !defined (HAVE_GETCWD)
  331. /**/# Since this system does not have a correctly working getcwd (), we
  332. /**/# define GETCWD as getcwd.o.
  333. GETCWD = getcwd.o
  334. #endif /* !HAVE_GETCWD */
  335.  
  336. /**/# The location of ranlib on your system.
  337. #if defined (RANLIB_LOCATION)
  338. RANLIB = RANLIB_LOCATION
  339. #else
  340. RANLIB = ranlib
  341. #endif /* RANLIB_LOCATION */
  342.  
  343. /**/# Support for the libraries required.  Termcap, Glob, and Readline.
  344. /**/# The location of sources for the support libraries.
  345. LIBSRC = ./lib/
  346. LIBINC_DECL  = LIBINCDIR=`pwd`; export LIBINCDIR
  347. LIBINC_USAGE = "-I$${LIBINCDIR} -I$${LIBINCDIR}/$(LIBSRC)"
  348.  
  349. /* Does this machine's linker need a space after -L? */
  350. #if defined (HAVE_GCC)
  351. #  undef SEARCH_LIB_NEEDS_SPACE
  352. #endif /* HAVE_GCC */
  353.  
  354. #if defined (SEARCH_LIB_NEEDS_SPACE)
  355. /**/# The native compiler for this machines requires a space after '-L'.
  356. SEARCH_LIB = -L $(UNSET_VARIABLE_CREATES_SPACE)
  357. #else
  358. SEARCH_LIB = -L
  359. #endif /* !SEARCH_LIB_NEEDS_SPACE */
  360.  
  361. #if defined (EXTRA_LIB_SEARCH_PATH)
  362. LOCAL_LD_PATH = EXTRA_LIB_SEARCH_PATH
  363. EXTRA_LD_PATH = $(SEARCH_LIB)$(LOCAL_LD_PATH)
  364. #endif /* EXTRA_LIB_SEARCH_PATH */
  365.  
  366. RLIBSRC = $(LIBSRC)readline/
  367. RLIBDOC = $(RLIBSRC)doc/
  368.  
  369. /**/# The source, object and documentation of the history library.
  370. HISTORY_SOURCE    = $(RLIBSRC)history.c $(RLIBSRC)history.h
  371. HISTORY_OBJ    = $(RLIBSRC)history.o
  372. HISTORY_DOC    = $(RLIBDOC)hist.texinfo $(RLIBDOC)hsuser.texinfo \
  373.           $(RLIBDOC)hstech.texinfo
  374.  
  375. /**/# The source, object and documentation of the GNU Readline library.
  376. /**/# The source to the history library is inherently part of this.
  377. READLINE_SOURCE    = $(RLIBSRC)readline.c $(RLIBSRC)readline.h\
  378.           $(RLIBSRC)chardefs.h $(RLIBSRC)keymaps.h\
  379.           $(RLIBSRC)funmap.c $(RLIBSRC)emacs_keymap.c\
  380.           $(RLIBSRC)vi_keymap.c $(RLIBSRC)keymaps.c\
  381.           $(RLIBSRC)vi_mode.c $(GLIBSRC)tilde.c $(HISTORY_SOURCE)
  382.  
  383. READLINE_OBJ    = $(RLIBSRC)readline.o $(RLIBSRC)funmap.o \
  384.           $(RLIBSRC)keymaps.o $(GLIBSRC)tilde.o $(HISTORY_OBJ)
  385.  
  386. READLINE_DOC    = $(RLIBDOC)rlman.texinfo $(RLIBDOC)rluser.texinfo \
  387.           $(RLIBDOC)rltech.texinfo
  388.  
  389. READLINE_DOC_SUPPORT  = $(RLIBDOC)Makefile $(RLIBDOC)texinfo.tex \
  390.           $(RLIBDOC)texindex.c $(RLIBDOC)readline.dvi \
  391.           $(RLIBDOC)readline.info $(RLIBDOC)history.dvi \
  392.           $(RLIBDOC)history.info
  393.  
  394. /**/# This has to be written funny to avoid looking like a C comment starter.
  395. READLINE_EXAMPLES = $(RLIBSRC)examples/[a-zA-Z]*.[ch] \
  396.             $(RLIBSRC)examples/Makefile $(RLIBSRC)examples/Inputrc
  397.  
  398. /**/# Support files for GNU Readline.
  399. READLINE_SUPPORT = $(RLIBSRC)Makefile $(RLIBSRC)ChangeLog $(RLIBSRC)COPYING \
  400.            $(READLINE_EXAMPLES) $(READLINE_DOC_SUPPORT)
  401.  
  402. #if defined (HAVE_READLINE_SOURCE)
  403. READLINE_CFLAGS = $(DEBUG_FLAGS) $(SIGHANDLER) $(ALLOCA_CFLAGS) \
  404.           $(SYSDEP) -D$(MACHINE) -D$(OS) $(UNISTD)
  405. #define READLINE_LIBRARY ./lib/readline/libreadline.a
  406. #else
  407. #define READLINE_LIBRARY -lreadline
  408. #endif
  409.  
  410. #if defined (USE_GNU_TERMCAP)
  411. #define HAVE_TERMCAP_SOURCE
  412. /**/# The source, object and documentation for the GNU Termcap library.
  413. TLIBSRC = $(LIBSRC)termcap/
  414. #define TERMCAP_LIBRARY ./lib/termcap/libtermcap.a
  415.  
  416. TERMCAP_SOURCE    = $(TLIBSRC)termcap.c $(TLIBSRC)tparam.c
  417. TERMCAP_OBJ    = $(TLIBSRC)libtermcap.a
  418. TERMCAP_DOC    = $(TLIBSRC)termcap.texinfo
  419. TERMCAP_SUPPORT = $(TLIBSRC)Makefile $(TLIBSRC)ChangeLog
  420. TERMCAP_LDFLAGS = $(SEARCH_LIB)$(TLIBSRC)
  421. #endif /* USE_GNU_TERMCAP */
  422.  
  423. /* The glob library is always used. */
  424. #define USE_GLOB_LIBRARY
  425.  
  426. /* If we have the source to the glob library, then compile it. */
  427. #if defined (USE_GLOB_LIBRARY)
  428. GLIBSRC = $(LIBSRC)glob/
  429. #define GLOB_LIBRARY ./lib/glob/libglob.a
  430.  
  431. /* Sometime in the future, we will have the finished GNU C Library globber. */
  432. #if defined (POSIX_GLOBBING_SOURCE)
  433. GLOB_SOURCE = $(GLIBSRC)glob.c $(GLIBSRC)fnmatch.c $(GLIBSRC)tilde.c \
  434.           $(GLIBSRC)glob.h $(GLIBSRC)ndir.h $(GLIBSRC)fnmatch.h
  435. #else
  436. GLOB_SOURCE = $(GLIBSRC)glob.c $(GLIBSRC)tilde.c \
  437.         $(GLIBSRC)fnmatch.c $(GLIBSRC)fnmatch.h
  438. #endif /* POSIX_GLOBBING_SOURCE */
  439.  
  440. GLOB_OBJ     = $(GLIBSRC)libglob.a
  441. GLOB_DOC     = $(GLIBSRC)glob.texinfo
  442. GLOB_SUPPORT = $(GLIBSRC)Makefile $(GLIBSRC)ChangeLog
  443. GLOB_LDFLAGS = $(SEARCH_LIB)$(GLIBSRC)
  444. GLOB_LIB     = -lglob
  445. #endif /* USE_GLOB_LIBRARY */
  446.  
  447. /**/# Declare all of the sources for the libraries that we have.
  448. LIBRARY_SOURCE    = $(READLINE_SOURCE) $(TERMCAP_SOURCE) $(GLOB_SOURCE)
  449. LIBRARY_DOC    = $(READLINE_DOC) $(HISTORY_DOC) $(TERMCAP_DOC) $(GLOB_DOC)
  450. LIBRARY_SUPPORT    = $(READLINE_SUPPORT) $(TERMCAP_SUPPORT) $(GLOB_SUPPORT)
  451. LIBRARY_TAR    = $(LIBRARY_SOURCE) $(LIBRARY_DOC) $(LIBRARY_SUPPORT)
  452.  
  453. #if defined (READLINE)
  454. /**/# You wish to compile with the line editing features installed.
  455. READLINE_LIB = -lreadline
  456.  
  457. /**/# You only need termcap for readline.
  458. #if defined (USE_TERMCAP_EMULATION)
  459. TERMCAP_LIB = -lcurses
  460. #else
  461. TERMCAP_LIB = -ltermcap
  462. #endif /* USE_TERMCAP_EMULATION */
  463.  
  464. /**/# Directory list for -L so that the link editor (ld) can find -lreadline.
  465. #if defined (HAVE_READLINE_SOURCE)
  466. READLINE_LDFLAGS = $(SEARCH_LIB)$(RLIBSRC) $(TERMCAP_LDFLAGS)
  467. #else
  468. READLINE_LDFLAGS = $(TERMCAP_LDFLAGS) $(SEARCH_LIB)/usr/gnu/lib \
  469.            $(SEARCH_LIB)/usr/local/lib
  470. #endif /* HAVE_READLINE_SOURCE */
  471.  
  472. /**/# The source and object of the bash<->readline interface code.
  473. RL_SUPPORT_SRC = bashline.c
  474. RL_SUPPORT_OBJ = bashline.o
  475. #endif /* READLINE */
  476.  
  477. #if defined (REQUIRED_LIBRARIES)
  478. /**/# Locally required libraries.
  479. LOCAL_LIBS = REQUIRED_LIBRARIES
  480. #endif /* REQUIRED_LIBRARIES */
  481.  
  482. /**/# The order is important.  Most dependent first.
  483. LIBRARIES = $(READLINE_LIB) $(TERMCAP_LIB) $(GLOB_LIB) $(LOCAL_LIBS)
  484.  
  485. #if defined (HAVE_TERMCAP_SOURCE)
  486. TERMCAP_DEP = TERMCAP_LIBRARY
  487. #endif
  488.  
  489. #if defined (HAVE_READLINE_SOURCE)
  490. READLINE_DEP = READLINE_LIBRARY
  491. #endif
  492.  
  493. #if defined (USE_GLOB_LIBRARY)
  494. GLOB_DEP = GLOB_LIBRARY
  495. #else
  496. GLOBC = glob.c tilde.c
  497. GLOBO = glob.o tilde.o
  498. #endif /* USE_GLOB_LIBRARY */
  499.  
  500. /**/# Source files for libraries that Bash depends on.
  501. LIBDEP = $(READLINE_DEP) $(TERMCAP_DEP) $(GLOB_DEP)
  502.  
  503. /**/# Rules for cleaning the readline and termcap sources.
  504. #if defined (HAVE_READLINE_SOURCE)
  505. #  define CLEAN_READLINE (cd $(RLIBSRC); $(MAKE) $(MFLAGS) clean)
  506. #else
  507. #  define CLEAN_READLINE :
  508. #endif /* HAVE_READLINE_SOURCE */
  509.  
  510. #if defined (HAVE_TERMCAP_SOURCE)
  511. #  define CLEAN_TERMCAP (cd $(TLIBSRC); $(MAKE) $(MFLAGS) clean)
  512. #else
  513. #  define CLEAN_TERMCAP :
  514. #endif /* HAVE_TERMCAP_SOURCE */
  515.  
  516. #if defined (USE_GLOB_LIBRARY)
  517. #  define CLEAN_GLOB (cd $(GLIBSRC); $(MAKE) $(MFLAGS) clean)
  518. #else
  519. #  define CLEAN_GLOB :
  520. #endif /* USE_GLOB_LIBRARY */
  521.  
  522. BUILTINS_LIB = builtins/libbuiltins.a
  523.  
  524. /**/# The main source code for the Bourne Again SHell.
  525. CSOURCES = shell.c parse.y general.c make_cmd.c print_cmd.c y.tab.c \
  526.        dispose_cmd.c execute_cmd.c variables.c $(GLOBC) version.c \
  527.        expr.c copy_cmd.c flags.c subst.c hash.c mailcheck.c \
  528.        test.c trap.c jobs.c nojobs.c $(ALLOC_FILES) braces.c \
  529.        unwind_prot.c siglist.c getcwd.c $(RL_SUPPORT_SRC) error.c
  530.  
  531. HSOURCES = shell.h flags.h trap.h hash.h jobs.h builtins.h alias.c y.tab.h \
  532.        general.h variables.h config.h $(ALLOC_HEADERS) alias.h maxpath.h \
  533.        quit.h machines.h posixstat.h filecntl.h unwind_prot.h parser.h \
  534.        command.h input.h error.h
  535.  
  536. SOURCES     = $(CSOURCES) $(HSOURCES) $(BUILTIN_DEFS)
  537.  
  538. /**/# Matching object files.
  539. OBJECTS     = shell.o y.tab.o general.o make_cmd.o print_cmd.o $(GLOBO) \
  540.        dispose_cmd.o execute_cmd.o variables.o copy_cmd.o error.o \
  541.        expr.o flags.o jobs.o subst.o hash.o mailcheck.o test.o \
  542.        trap.o alias.o $(MALLOC) $(ALLOCA) braces.o unwind_prot.o \
  543.        $(SIGLIST) $(GETCWD) version.o $(RL_SUPPORT_OBJ) $(BUILTINS_LIB)
  544.  
  545. /**/# Where the source code of the shell builtins resides.
  546. DEFDIR = builtins/
  547. BUILTIN_DEFS = $(DEFDIR)alias.def $(DEFDIR)bind.def $(DEFDIR)break.def \
  548.            $(DEFDIR)builtin.def $(DEFDIR)cd.def $(DEFDIR)colon.def \
  549.            $(DEFDIR)command.def $(DEFDIR)declare.def \
  550.            $(DEFDIR)echo.def $(DEFDIR)enable.def $(DEFDIR)eval.def \
  551.            $(DEFDIR)exec.def $(DEFDIR)exit.def $(DEFDIR)fc.def \
  552.            $(DEFDIR)fg_bg.def $(DEFDIR)hash.def $(DEFDIR)help.def \
  553.            $(DEFDIR)history.def $(DEFDIR)jobs.def $(DEFDIR)kill.def \
  554.            $(DEFDIR)let.def $(DEFDIR)read.def $(DEFDIR)return.def \
  555.            $(DEFDIR)set.def $(DEFDIR)setattr.def $(DEFDIR)shift.def \
  556.            $(DEFDIR)source.def $(DEFDIR)suspend.def $(DEFDIR)test.def \
  557.            $(DEFDIR)times.def $(DEFDIR)trap.def $(DEFDIR)type.def \
  558.            $(DEFDIR)ulimit.def $(DEFDIR)umask.def $(DEFDIR)wait.def \
  559.            $(DEFDIR)getopts.def $(DEFDIR)reserved.def
  560. BUILTIN_C_CODE  = $(DEFDIR)mkbuiltins.c $(DEFDIR)common.c \
  561.           $(DEFDIR)hashcom.h $(GETOPT_SOURCE)
  562. GETOPT_SOURCE   = $(DEFDIR)getopt.c $(DEFDIR)getopt.h
  563. PSIZE_SOURCE    = $(DEFDIR)psize.sh $(DEFDIR)psize.c
  564. BUILTIN_SUPPORT = $(DEFDIR)Makefile $(DEFDIR)ChangeLog $(PSIZE_SOURCE) \
  565.           $(BUILTIN_C_CODE)
  566.  
  567. /**/# Documentation for the shell.
  568. DOCDIR = ./documentation/
  569. BASH_TEXINFO = $(DOCDIR)*.texi $(DOCDIR)*.tex $(DOCDIR)texindex.c \
  570.             $(DOCDIR)*.dvi $(DOCDIR)Makefile
  571. BASH_MAN = $(DOCDIR)bash.1
  572. BASHDOCS = $(BASH_TEXINFO) $(BASH_MAN) INSTALL README RELEASE
  573. DOCUMENTATION = $(BASHDOCS) $(LIBRARY_DOC)
  574.  
  575. /**/# Some example files demonstrating use of the shell.
  576. /* This has to be written funny to avoid looking like a comment starter. */
  577. EXAMPLES = examples/[a-zA-Z]*
  578.  
  579. ENDIAN_SUPPORT = endian.c
  580. SDIR = ./support/
  581. MKTARFILE = $(SDIR)mktarfile
  582. SCRIPTS_SUPPORT = $(SDIR)mksysdefs $(SDIR)cppmagic $(SDIR)cat-s \
  583.           $(MKTARFILE) $(SDIR)mail-shell $(SDIR)inform
  584.  
  585. TEST_SUITE = ./test-suite/
  586. TEST_SUITE_SUPPORT = $(TEST_SUITE)[a-zA-Z0-9]*
  587.  
  588. CREATED_SUPPORT = endian.aux endian.h sysdefs.h $(SDIR)getcppsyms
  589.  
  590. SUPPORT = configure $(ENDIAN_SUPPORT) $(SCRIPTS_SUPPORT) $(BUILTIN_SUPPORT) \
  591.       COPYING Makefile cpp-Makefile ChangeLog .distribution newversion.c \
  592.       $(EXAMPLES) $(SDIR)bash.xbm $(SDIR)getcppsyms.c $(TEST_SUITE_SUPPORT)
  593.  
  594. /**/# BAGGAGE consists of things that you want to keep with the shell for some
  595. /**/# reason, but do not actually use; old source code, etc.
  596. BAGGAGE = longest_sig.c
  597.  
  598. /**/# Things that the world at large needs.
  599. THINGS_TO_TAR = $(SOURCES) $(LIBRARY_TAR) $(BASHDOCS) $(SUPPORT) $(BAGGAGE)
  600.  
  601. all: .made
  602.  
  603. /**/# Keep GNU Make from exporting the entire environment for small machines.
  604. .NOEXPORT:
  605.  
  606. .made: $(PROGRAM)
  607.     cp .machine .made
  608.  
  609. $(PROGRAM):  .build $(OBJECTS) $(LIBDEP) .distribution
  610.     $(RM) $@
  611.     $(CC) $(LDFLAGS) $(READLINE_LDFLAGS) $(GLOB_LDFLAGS) \
  612.        -o $(PROGRAM) $(OBJECTS) $(LIBRARIES)
  613.  
  614. .build:    $(SOURCES) cpp-Makefile newversion.aux
  615.     if ./newversion.aux -build; then mv -f newversion.h version.h; fi
  616.     @echo
  617.     @echo "      ***************************************************"
  618.     @echo "      *                            *"
  619.     @echo "      * Making Bash-`cat .distribution` for a $(MACHINE) running $(OS)."
  620.     @echo "      *                            *"
  621.     @echo "      ***************************************************"
  622.     @echo
  623.     @echo "$(PROGRAM) last made for a $(MACHINE) running $(OS)" >.machine
  624.  
  625. version.h:    newversion.aux
  626.     if ./newversion.aux -build; then mv -f newversion.h version.h; fi
  627.  
  628. y.tab.c:    parse.y parser.h command.h input.h
  629.         -if test -f y.tab.h; then mv -f y.tab.h old-y.tab.h; fi
  630.         @echo "Expect 12 reduce/reduce errors.  No Problem."
  631.         $(BISON) -d parse.y
  632.         -if cmp -s old-y.tab.h y.tab.h; then mv old-y.tab.h y.tab.h; fi
  633.  
  634. #if defined (HAVE_READLINE_SOURCE)
  635. READLINE_LIBRARY: $(READLINE_SOURCE)
  636.     build_lib_in_dir ($(RLIBSRC))
  637. #endif /* HAVE_READLINE_SOURCE */
  638.  
  639. #if defined (HAVE_TERMCAP_SOURCE)
  640. TERMCAP_LIBRARY: $(TERMCAP_SOURCE)
  641.     build_lib_in_dir ($(TLIBSRC))
  642. #endif /* HAVE_TERMCAP_SOURCE */
  643.  
  644. #if defined (USE_GLOB_LIBRARY)
  645. GLOB_LIBRARY: $(GLOB_SOURCE)
  646.     build_lib_in_dir ($(GLIBSRC))
  647. #endif /* USE_GLOB_LIBRARY */
  648.  
  649. version.o:    version.h version.c
  650.  
  651. shell.o:    shell.h flags.h shell.c posixstat.h filecntl.h endian.h \
  652.         parser.h
  653.         $(CC) $(CFG_FLAGS) $(CFLAGS) $(CPPFLAGS) -c shell.c
  654.  
  655. endian.h:    endian.aux
  656.         ./endian.aux endian.h
  657.  
  658. endian.aux:    endian.c
  659.         $(CC) $(CFLAGS) -o $@ endian.c
  660.  
  661. #if defined (USE_GNU_MALLOC)
  662. /* Note that gcc correctly leaves the output file in the source directory. */
  663. #if !defined (__GNUC__)
  664. $(MALLOC):    $(MALLOC_DEP)
  665.         $(CC) -I$(ALLOC_DIR) $(CFLAGS) $(MALLOC_FLAGS) -c $*.c
  666.         @-mv `basename $*`.o $(MALLOC) 2>/dev/null
  667. #else
  668. $(MALLOC):    $(MALLOC_DEP)
  669.         $(CC) -I$(ALLOC_DIR) $(CFLAGS) $(MALLOC_FLAGS) \
  670.             -o $(MALLOC) -c $*.c
  671. #endif /* __GNUC__ */
  672. #endif /* USE_GNU_MALLOC */
  673.  
  674. #if !defined (HAVE_ALLOCA)
  675. /* Note that gcc correctly leaves the output file in the source directory. */
  676. $(ALLOCA):    $(ALLOCA_SOURCE)
  677.         $(CC) -I$(ALLOC_DIR) $(CFLAGS) -c $(ALLOCA_SOURCE)
  678.         @-mv `basename $*`.o $(ALLOCA) >/dev/null 2>&1
  679. #endif /* !HAVE_ALLOCA */
  680.  
  681. variables.o: shell.h hash.h flags.h variables.h variables.c
  682.     $(CC) -c $(CFLAGS) $(CPPFLAGS) $(HOSTTYPE_DECL) variables.c
  683.  
  684. builtins/libbuiltins.a: $(BUILTIN_DEFS) $(BUILTIN_C_CODE)
  685.     build_builtins_in_dir ($(DEFDIR))
  686.  
  687. /* Dependencies for the main bash source. */
  688. shell.h:    general.h variables.h config.h quit.h
  689. jobs.h:        endian.h quit.h
  690. variables.h:    hash.h
  691. braces.o: general.h
  692. copy_cmd.o: shell.h hash.h
  693. copy_cmd.o: general.h variables.h config.h quit.h
  694. dispose_cmd.o: shell.h
  695. dispose_cmd.o: general.h variables.h config.h quit.h
  696. error.o: error.h
  697. execute_cmd.o: shell.h y.tab.h posixstat.h flags.h jobs.h
  698. execute_cmd.o: general.h variables.h config.h quit.h hash.h endian.h
  699. execute_cmd.o: unwind_prot.h
  700. expr.o: shell.h hash.h
  701. expr.o: general.h variables.h config.h quit.h
  702. flags.o: flags.h config.h general.h quit.h
  703. general.o: shell.h maxpath.h
  704. general.o: general.h variables.h config.h quit.h
  705. hash.o: shell.h hash.h
  706. hash.o: general.h variables.h config.h quit.h
  707. jobs.o: shell.h hash.h trap.h jobs.h
  708. jobs.o: general.h variables.h config.h endian.h quit.h
  709. mailcheck.o: posixstat.h maxpath.h variables.h
  710. mailcheck.o: hash.h quit.h
  711. make_cmd.o: shell.h flags.h
  712. make_cmd.o: general.h variables.h config.h quit.h
  713. y.tab.o: shell.h flags.h maxpath.h
  714. y.tab.o: general.h variables.h config.h quit.h
  715. print_cmd.o: shell.h y.tab.h
  716. print_cmd.o: general.h variables.h config.h quit.h
  717. shell.o: shell.h flags.h
  718. shell.o: general.h variables.h config.h quit.h
  719. subst.o: shell.h flags.h alias.h jobs.h
  720. subst.o: general.h variables.h config.h endian.h quit.h
  721. test.o: posixstat.h
  722. trap.o: trap.h shell.h hash.h unwind_prot.h
  723. trap.o: general.h variables.h config.h quit.h
  724. unwind_prot.o: config.h general.h unwind_prot.h
  725.  
  726. #if !defined (JOB_CONTROL)
  727. jobs.o: nojobs.c
  728. #endif
  729.  
  730. #if defined (READLINE)
  731. bashline.o: shell.h hash.h builtins.h
  732. bashline.o: general.h variables.h config.h quit.h alias.h
  733. #endif
  734.  
  735. /* Dependencies which rely on the user using the source to READLINE. */
  736. #if defined (HAVE_READLINE_SOURCE)
  737. bashline.o: $(RLIBSRC)chardefs.h $(RLIBSRC)history.h $(RLIBSRC)readline.h
  738. bashline.o: $(RLIBSRC)keymaps.h $(RLIBSRC)history.h
  739. y.tab.o: $(RLIBSRC)keymaps.h $(RLIBSRC)chardefs.h $(RLIBSRC)history.h
  740. y.tab.o: $(RLIBSRC)readline.h
  741. subst.o: $(RLIBSRC)history.h
  742. #endif /* HAVE_READLINE_SOURCE */
  743.  
  744. #if defined (USE_GLOB_LIBRARY)
  745. subst.o: $(GLIBSRC)fnmatch.h
  746. execute_cmd.o: $(GLIBSRC)fnmatch.h
  747. #  if defined (POSIX_GLOBBING_SOURCE)
  748. subst.o: $(GLIBSRC)glob.h
  749. #  endif /* POSIX_GLOBBING_SOURCE */
  750. #endif /* USE_GLOB_LIBRARY */
  751.  
  752. $(PROGRAM).tar: $(THINGS_TO_TAR) .distribution
  753.     @$(MKTARFILE) $(PROGRAM) `cat .distribution` $(THINGS_TO_TAR)
  754.  
  755. $(PROGRAM).tar.Z:    $(PROGRAM).tar
  756.         compress -f $(PROGRAM).tar
  757.  
  758. clone:        $(THINGS_TO_TAR)
  759.     @$(MKTARFILE) +notar $(MACHINE) $(OS) $(THINGS_TO_TAR)
  760.         
  761. install:    .made
  762.         -if [ -f $(DESTDIR)/$(PROGRAM) ]; \
  763.         then mv $(DESTDIR)/$(PROGRAM) $(DESTDIR)/$(PROGRAM).old; \
  764.         fi
  765.         cp $(PROGRAM) $(DESTDIR)/$(PROGRAM)
  766.         $(RM) installed-$(PROGRAM)
  767.         ln -s $(DESTDIR)/$(PROGRAM) installed-$(PROGRAM)
  768.  
  769. mailable:    distribution
  770.         /bin/rm -rf uuencoded
  771.         mkdir uuencoded
  772.         $(SHELL) -c 'f=$(PROGRAM)-`cat .distribution`.tar.Z;uuencode $$f $$f | split -800 - uuencoded/$$f.uu.'
  773.  
  774. .distribution:
  775.         ./newversion.aux -dist `$(PROGRAM) -c 'echo $$BASH_VERSION'`
  776.  
  777. distribution:    $(PROGRAM) $(PROGRAM).tar.Z .distribution
  778.         @echo cp $(PROGRAM).tar.Z $(PROGRAM)-`cat .distribution`.tar.Z
  779.         @cp $(PROGRAM).tar.Z $(PROGRAM)-`cat .distribution`.tar.Z
  780.  
  781. newversion.aux:    newversion.c
  782.         $(CC) $(DEBUG_FLAGS) -o newversion.aux newversion.c -lm
  783.  
  784. newversion:    newversion.aux
  785.         $(RM) .build
  786.         ./newversion.aux -dist
  787.         mv -f newversion.h version.h
  788.         $(MAKE) $(MFLAGS)
  789.  
  790. documentation:  documentation-frob
  791.         (cd $(DOCDIR); make)
  792.  
  793. documentation-frob:
  794.  
  795. tags:        $(SOURCES) $(BUILTIN_C_CODE) $(LIBRARY_SOURCE)
  796.         etags $(SOURCES) $(BUILTIN_C_CODE) $(LIBRARY_SOURCE)
  797.  
  798. INDEX:        $(SOURCES) $(BUILTIN_C_CODE) $(LIBRARY_SOURCE)
  799.         ctags -x $(SOURCES) $(BUILTIN_C_CODE) $(LIBRARY_SOURCE) > $@
  800.  
  801. clean:
  802.         $(RM) $(OBJECTS) $(PROGRAM) aix-Makefile *.aux
  803.         $(RM) .build .made version.h
  804.         $(RM) $(CREATED_SUPPORT) bash-Makefile
  805.         (cd $(DOCDIR); $(MAKE) $(MFLAGS) clean)
  806.         (cd builtins; $(MAKE) $(MFLAGS) clean)
  807.         CLEAN_READLINE;CLEAN_TERMCAP;CLEAN_GLOB
  808.  
  809. /**/# Here is a convenient rule when you arrive at a new site and wish to
  810. /**/# install bash on several different architectures.  It creates a new
  811. /**/# directory to hold the results of compilatation.  The directory is
  812. /**/# named MACHINE-OS.
  813. architecture: $(MACHINE)-$(OS)/$(PROGRAM)
  814.  
  815. $(MACHINE)-$(OS):
  816.     -mkdir $(MACHINE)-$(OS)
  817.  
  818. $(MACHINE)-$(OS)/$(PROGRAM): $(MACHINE)-$(OS) $(PROGRAM)
  819.     mv $(PROGRAM) $(MACHINE)-$(OS)
  820.     mv sysdefs.h $(MACHINE)-$(OS)
  821.     mv $(SDIR)getcppsyms $(MACHINE)-$(OS)
  822.     $(MAKE) $(MFLAGS) clean
  823.