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