init version.
[bush.git] / build / src-c-src.list
blob81e6257d9da37280c04049de30b235ab44f7f2b7
1 all: .made
4 # Here is a rule for making .o files from .c files that does not
5 # force the type of the machine (like -M_MACHINE) into the flags.
6 .c.o:
7         $(RM) $@
8         $(CC) $(CCFLAGS) -c $<
10 THIS_SH = $(BUILD_DIR)/$(Program)
12 INCLUDES = -I. @RL_INCLUDE@ -I$(srcdir) -I$(BUSHINCDIR) -I$(BUSHSRC) -I$(LIBSRC) $(INTL_INC)
14 SUBDIR_INCLUDES = -I. @RL_INCLUDE@ -I$(topdir) -I$(topdir)/$(LIBSUBDIR)
17 # source dir
18
19 DIR_SRC=src
20 DIR_LIB=lib
21 DIR_BUILTINS=builtins
22 DIR_LIB_SH=lib/sh
23 DIR_LIB_TILDE=lib/tilde
24 DIR_LIB_MALLOC=lib/malloc
30 #####################################################################
31 # tags
32 #####################################################################
34 $(Program)=.build $(OBJECTS) $(BUILTINS_DEP) $(LIBDEP)
36 .build: $(SOURCES) config.h Makefile src/version.h $(VERSPROG)
37 SOURCES  = $(CSOURCES) $(HSOURCES) $(BUILTIN_DEFS)
40 # for versions
42 src/version.h:  $(SOURCES) config.h Makefile src/patchlevel.h
43         $(SHELL) $(SUPPORT_SRC)mkversion.sh -b -S ${topdir} -s $(RELSTATUS) -d $(Version) -o src/newversion.h \
44                 && mv src/newversion.h src/version.h
46 VERSPROG = bushversion$(EXEEXT)
48 bushversion$(EXEEXT): buildversion.o $(SUPPORT_SRC)bushversion.c
49         $(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) ${LDFLAGS_FOR_BUILD} -o $@ $(SUPPORT_SRC)bushversion.c buildversion.o ${LIBS_FOR_BUILD}
51 buildversion.o: $(srcdir)/src/version.c
52         $(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) -DBUILDTOOL -c -o $@ $(srcdir)/src/version.c
54 buildversion.o: src/bushintl.h $(BUSHINCDIR)/gettext.h
55 buildversion.o: src/version.h src/patchlevel.h src/conftypes.h
59 # src object files.
61 CSOURCES =  src/shell.c src/eval.c src/parse.y src/general.c src/make_cmd.c \
62                         src/print_cmd.c src/y.tab.c src/dispose_cmd.c src/execute_cmd.c \
63                         src/variables.c $(GLOBC) src/version.c src/expr.c src/copy_cmd.c \
64                         src/flags.c src/subst.c src/hashcmd.c src/hashlib.c src/mailcheck.c \
65                         src/test.c src/trap.c src/alias.c src/jobs.c src/nojobs.c \
66                         $(ALLOC_FILES) \
67                         src/braces.c src/input.c src/bushhist.c src/array.c src/arrayfunc.c \
68                         src/assoc.c src/sig.c src/pathexp.c src/unwind_prot.c src/siglist.c \
69                         src/bushline.c src/bracecomp.c src/error.c src/list.c \
70                         src/stringlib.c src/locale.c src/findcmd.c src/redir.c \
71                         src/pcomplete.c src/pcomplib.c src/syntax.c src/xmalloc.c
73 #CSOURCES =  src/parse.y $(GLOBC) src/jobs.c src/nojobs.c \
74 #                       $(ALLOC_FILES) \
75 #                       src/siglist.c
76 #OBJECTS = $(SIGNAMES_O) $(GLOBO) $(SIGLIST_O) $(JOBS_O)
78 JOBS_O = @JOBS_O@
79 SIGLIST_O = @SIGLIST_O@
80 SIGNAMES_O = @SIGNAMES_O@
84 # def source files.
86 BUILTIN_DEFS = $(DEFSRC)/alias.def $(DEFSRC)/bind.def $(DEFSRC)/break.def \
87                $(DEFSRC)/builtin.def $(DEFSRC)/cd.def $(DEFSRC)/colon.def \
88                $(DEFSRC)/command.def ${DEFSRC}/complete.def \
89                $(DEFSRC)/caller.def $(DEFSRC)/declare.def \
90                $(DEFSRC)/echo.def $(DEFSRC)/enable.def $(DEFSRC)/eval.def \
91                $(DEFSRC)/exec.def $(DEFSRC)/exit.def $(DEFSRC)/fc.def \
92                $(DEFSRC)/fg_bg.def $(DEFSRC)/hash.def $(DEFSRC)/help.def \
93                $(DEFSRC)/history.def $(DEFSRC)/jobs.def $(DEFSRC)/kill.def \
94                $(DEFSRC)/let.def $(DEFSRC)/read.def $(DEFSRC)/return.def \
95                $(DEFSRC)/set.def $(DEFSRC)/setattr.def $(DEFSRC)/shift.def \
96                $(DEFSRC)/source.def $(DEFSRC)/suspend.def $(DEFSRC)/test.def \
97                $(DEFSRC)/times.def $(DEFSRC)/trap.def $(DEFSRC)/type.def \
98                $(DEFSRC)/ulimit.def $(DEFSRC)/umask.def $(DEFSRC)/wait.def \
99                $(DEFSRC)/getopts.def $(DEFSRC)/reserved.def \
100                $(DEFSRC)/pushd.def $(DEFSRC)/shopt.def $(DEFSRC)/printf.def \
101                $(DEFSRC)/mapfile.def
102 BUILTIN_C_SRC  = $(DEFSRC)/mkbuiltins.c $(DEFSRC)/common.c \
103                  $(DEFSRC)/evalstring.c $(DEFSRC)/evalfile.c \
104                  $(DEFSRC)/bushgetopt.c $(GETOPT_SOURCE)
107 # example of glob in lib.
109 GLOB_LIBSRC = $(LIBSRC)/glob
110 GLOB_LIBDIR = $(dot)/$(LIBSUBDIR)/glob
111 GLOB_ABSSRC = ${topdir}/$(GLOB_LIBDIR)
113 GLOB_LIB     = -lglob
114 GLOB_LIBRARY = $(GLOB_LIBDIR)/libglob.a
115 GLOB_LDFLAGS = -L$(GLOB_LIBDIR)
116 GLOB_DEP = $(GLOB_LIBRARY)
118 GLOB_SOURCE = $(GLOB_LIBSRC)/glob.c $(GLOB_LIBSRC)/strmatch.c \
119               $(GLOB_LIBSRC)/smatch.c $(GLOB_LIBSRC)/xmbsrtowcs.c \
120               $(GLOB_LIBSRC)/glob_loop.c $(GLOB_LIBSRC)/sm_loop.c \
121               $(GLOB_LIBSRC)/gmisc.c \
122               $(GLOB_LIBSRC)/glob.h $(GLOB_LIBSRC)/strmatch.h
123 GLOB_OBJ    = $(GLOB_LIBDIR)/glob.o $(GLOB_LIBDIR)/strmatch.o \
124               $(GLOB_LIBDIR)/smatch.o $(GLOB_LIBDIR)/xmbsrtowcs.o \
125               $(GLOB_LIBDIR)/gmisc.o
127 $(GLOB_LIBRARY): config.h $(GLOB_SOURCE)
128         @echo making $@ in ${GLOB_LIBDIR}
129         @(cd ${GLOB_LIBDIR} && \
130                 $(MAKE) $(MFLAGS) DEBUG=${DEBUG} libglob.a) || exit 1
134 # lib dep
136 LIBDEP = $(GLOB_DEP) $(SHLIB_DEP) $(READLINE_DEP) $(HISTORY_DEP) \
137          $(TERMCAP_DEP) $(TILDE_DEP) $(MALLOC_DEP) $(INTL_DEP)
139 GLOB_DEP => GLOB_LIBRARY => GLOB_SOURCE
140 GLOB_SOURCE = $(GLOB_LIBSRC)/glob.c $(GLOB_LIBSRC)/strmatch.c \
141               $(GLOB_LIBSRC)/smatch.c $(GLOB_LIBSRC)/xmbsrtowcs.c \
142               $(GLOB_LIBSRC)/glob_loop.c $(GLOB_LIBSRC)/sm_loop.c \
143               $(GLOB_LIBSRC)/gmisc.c \
144               $(GLOB_LIBSRC)/glob.h $(GLOB_LIBSRC)/strmatch.h
146 SHLIB_DEP => SHLIB_LIBRARY => SHLIB_SOURCE
147 SHLIB_SOURCE =  ${SH_LIBSRC}/clktck.c ${SH_LIBSRC}/getcwd.c \
148                 ${SH_LIBSRC}/getenv.c ${SH_LIBSRC}/oslib.c \
149                 ${SH_LIBSRC}/setlinebuf.c ${SH_LIBSRC}/strchrnul.c \
150                 ${SH_LIBSRC}/strcasecmp.c ${SH_LIBSRC}/strdup.c \
151                 ${SH_LIBSRC}/strerror.c \
152                 ${SH_LIBSRC}/strtod.c ${SH_LIBSRC}/strtol.c \
153                 ${SH_LIBSRC}/strtoul.c ${SH_LIBSRC}/vprint.c \
154                 ${SH_LIBSRC}/itos.c ${SH_LIBSRC}/rename.c \
155                 ${SH_LIBSRC}/zread.c ${SH_LIBSRC}/zwrite.c \
156                 ${SH_LIBSRC}/shtty.c ${SH_LIBSRC}/inet_aton.c \
157                 ${SH_LIBSRC}/netopen.c ${SH_LIBSRC}/strpbrk.c \
158                 ${SH_LIBSRC}/timeval.c ${SH_LIBSRC}/clock.c \
159                 ${SH_LIBSRC}/makepath.c ${SH_LIBSRC}/pathcanon.c \
160                 ${SH_LIBSRC}/pathphys.c ${SH_LIBSRC}/stringlist.c \
161                 ${SH_LIBSRC}/stringvec.c ${SH_LIBSRC}/tmpfile.c \
162                 ${SH_LIBSRC}/spell.c ${SH_LIBSRC}/strtrans.c \
163                 ${SH_LIBSRC}/strcasestr.c ${SH_LIBSRC}/shquote.c \
164                 ${SH_LIBSRC}/snprintf.c ${SH_LIBSRC}/mailstat.c \
165                 ${SH_LIBSRC}/fmtulong.c ${SH_LIBSRC}/fmtullong.c \
166                 ${SH_LIBSRC}/strtoll.c ${SH_LIBSRC}/strtoull.c \
167                 ${SH_LIBSRC}/strtoimax.c ${SH_LIBSRC}/strtoumax.c \
168                 ${SH_LIBSRC}/fmtumax.c ${SH_LIBSRC}/netconn.c \
169                 ${SH_LIBSRC}/mktime.c ${SH_LIBSRC}/strftime.c \
170                 ${SH_LIBSRC}/memset.c ${SH_LIBSRC}/mbschr.c \
171                 ${SH_LIBSRC}/zcatfd.c ${SH_LIBSRC}/shmatch.c \
172                 ${SH_LIBSRC}/strnlen.c ${SH_LIBSRC}/winsize.c \
173                 ${SH_LIBSRC}/eaccess.c ${SH_LIBSRC}/wcsdup.c \
174                 ${SH_LIBSRC}/zmapfd.c ${SH_LIBSRC}/fpurge.c \
175                 ${SH_LIBSRC}/zgetline.c ${SH_LIBSRC}/mbscmp.c \
176                 ${SH_LIBSRC}/casemod.c ${SH_LIBSRC}/uconvert.c \
177                 ${SH_LIBSRC}/ufuncs.c ${SH_LIBSRC}/dprintf.c \
178                 ${SH_LIBSRC}/input_avail.c ${SH_LIBSRC}/mbscasecmp.c \
179                 ${SH_LIBSRC}/fnxform.c ${SH_LIBSRC}/unicode.c \
180                 ${SH_LIBSRC}/wcswidth.c ${SH_LIBSRC}/wcsnwidth.c \
181                 ${SH_LIBSRC}/shmbchar.c ${SH_LIBSRC}/utf8.c \
182                 ${SH_LIBSRC}/random.c ${SH_LIBSRC}/gettimeofday.c
184 READLINE_DEP => READLINE_LIBRARY => READLINE_SOURCE
185 READLINE_SOURCE = $(RL_LIBSRC)/rldefs.h $(RL_LIBSRC)/rlconf.h \
186                   $(RL_LIBSRC)/readline.h $(RL_LIBSRC)/tcap.h \
187                   $(RL_LIBSRC)/chardefs.h $(RL_LIBSRC)/keymaps.h \
188                   $(RL_LIBSRC)/history.h $(RL_LIBSRC)/histlib.h \
189                   $(RL_LIBSRC)/posixstat.h $(RL_LIBSRC)/tilde.h \
190                   $(RL_LIBSRC)/rlstdc.h ${RL_LIBSRC}/xmalloc.h \
191                   $(RL_LIBSRC)/rlshell.h ${RL_LIBSRC}/rlprivate.h \
192                   $(RL_LIBSRC)/colors.h  $(RL_LIBSRC)/parse-colors.h \
193                   $(RL_LIBSRC)/funmap.c $(RL_LIBSRC)/emacs_keymap.c \
194                   $(RL_LIBSRC)/search.c $(RL_LIBSRC)/vi_keymap.c \
195                   $(RL_LIBSRC)/keymaps.c $(RL_LIBSRC)/parens.c \
196                   $(RL_LIBSRC)/vi_mode.c $(RL_LIBSRC)/callback.c \
197                   $(RL_LIBSRC)/readline.c $(RL_LIBSRC)/tilde.c \
198                   $(RL_LIBSRC)/rltty.c $(RL_LIBSRC)/complete.c \
199                   $(RL_LIBSRC)/bind.c $(RL_LIBSRC)/isearch.c \
200                   $(RL_LIBSRC)/display.c $(RL_LIBSRC)/signals.c \
201                   $(RL_LIBSRC)/util.c $(RL_LIBSRC)/kill.c $(RL_LIBSRC)/text.c \
202                   $(RL_LIBSRC)/undo.c $(RL_LIBSRC)/macro.c \
203                   $(RL_LIBSRC)/terminal.c $(RL_LIBSRC)/nls.c \
204                   $(RL_LIBSRC)/input.c $(RL_LIBSRC)/xmalloc.c \
205                   $(RL_LIBSRC)/shell.c $(RL_LIBSRC)/savestring.c \
206                   $(RL_LIBSRC)/colors.c $(RL_LIBSRC)/parse-colors.c \
207                   $(RL_LIBSRC)/misc.c $(RL_LIBSRC)/mbutil.c $(RL_LIBSRC)/compat.c \
208                   $(RL_LIBSRC)/histexpand.c $(RL_LIBSRC)/history.c \
209                   $(RL_LIBSRC)/histsearch.c $(RL_LIBSRC)/histfile.c
211 HISTORY_DEP => HISTORY_LIBRARY => HISTORY_SOURCE
212 HISTORY_SOURCE  = $(HIST_LIBSRC)/history.c $(HIST_LIBSRC)/histexpand.c \
213                   $(HIST_LIBSRC)/histsearch.c $(HIST_LIBSRC)/histfile.c \
214                   $(HIST_LIBSRC)/shell.c \
215                   $(HIST_LIBSRC)/history.h $(HIST_LIBSRC)/histlib.h
217 TERMCAP_DEP => TERMCAP_LIBRARY => TERMCAP_SOURCE
218 TERMCAP_SOURCE  = $(TERM_LIBSRC)/termcap.c $(TERM_LIBSRC)/tparam.c
220 TILDE_DEP => TILDE_LIBRARY => TILDE_SOURCE
221 TILDE_SOURCE    = $(TILDE_LIBSRC)/tilde.c $(TILDE_LIBSRC)/tilde.h
223 MALLOC_DEP => MALLOC_LIBRARY => MALLOC_SOURCE
224 MALLOC_SRC = @MALLOC_SRC@
225 MALLOC_OTHERSRC = ${ALLOC_LIBSRC}/trace.c ${ALLOC_LIBSRC}/stats.c \
226                   ${ALLOC_LIBSRC}/table.c ${ALLOC_LIBSRC}/watch.c
227 MALLOC_SOURCE = ${ALLOC_LIBSRC}/${MALLOC_SRC} ${MALLOC_OTHERSRC}
229 INTL_DEP => INTL_LIBRARY => INTL_SOURCE
230 INTL_SOURCE = bindtextdom.c dcgettext.c dgettext.c gettext.c finddomain.c \
231   loadmsgcat.c localealias.c textdomain.c l10nflist.c explodename.c \
232   dcigettext.c dcngettext.c dngettext.c ngettext.c plural.y plural-exp.c \
233   localcharset.c relocatable.c localename.c log.c osdep.c os2compat.c \
234   intl-compat.c
237 # grammar
240 # old rules
241 GRAM_H = parser-built
242 y.tab.o: src/y.tab.h src/y.tab.c ${GRAM_H} src/command.h ${BUSHINCDIR}/stdc.h src/input.h
243 ${GRAM_H}:      src/y.tab.h
244         @-if test -f src/y.tab.h ; then \
245                 cmp -s $@ src/y.tab.h 2>/dev/null || cp -p src/y.tab.h $@; \
246         fi
248 src/y.tab.c: src/parse.y
249 #       -if test -f src/y.tab.h; then mv -f src/y.tab.h old-src/y.tab.h; fi
250         $(YACC) -d $(srcdir)/src/parse.y
251         touch parser-built
252 #       -if cmp -s old-src/y.tab.h src/y.tab.h; then mv old-src/y.tab.h src/y.tab.h; else cp -p src/y.tab.h ${GRAM_H}; fi
254 src/y.tab.h: src/y.tab.c
255         @true
258 # other single build
260 mksyntax$(EXEEXT):      ${srcdir}/mksyntax.c config.h src/syntax.h ${BUSHINCDIR}/chartypes.h src/bushansi.h
261         $(RM) $@
262         ${CC_FOR_BUILD} ${CCFLAGS_FOR_BUILD} ${LDFLAGS_FOR_BUILD} -o $@ ${srcdir}/mksyntax.c ${LIBS_FOR_BUILD}
264 syntax.c:       mksyntax${EXEEXT} $(srcdir)/src/syntax.h 
265         $(RM) $@
266         ./mksyntax$(EXEEXT) -o $@
271 signames.o: $(SUPPORT_SRC)signames.c
272         $(RM) $@
273         $(CC) $(CCFLAGS) -c $(SUPPORT_SRC)signames.c
275 buildsignames.o:        $(SUPPORT_SRC)signames.c
276         $(RM) $@
277         $(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) -DBUILDTOOL -o $@ -c $(SUPPORT_SRC)signames.c
279 mksignames.o:   $(SUPPORT_SRC)mksignames.c
280         $(RM) $@
281         $(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) -DBUILDTOOL -c $(SUPPORT_SRC)mksignames.c
283 mksignames$(EXEEXT):    mksignames.o buildsignames.o
284         $(RM) $@
285         $(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) ${LDFLAGS_FOR_BUILD} -o $@ mksignames.o buildsignames.o ${LIBS_FOR_BUILD}
288 # make a list of signals for the local system -- this is done when we're
289 # *not* cross-compiling
290 src/lsignames.h:   mksignames$(EXEEXT)
291         $(RM) $@
292         ./mksignames$(EXEEXT) $@
294 # copy the correct signames header file to src/signames.h
295 src/signames.h: $(SIGNAMES_H)
296         -if cmp -s $(SIGNAMES_H) $@ ; then :; else $(RM) $@ ; $(CP) $(SIGNAMES_H) $@ ; fi
299 # test programs
301 TESTS_SUPPORT = recho$(EXEEXT) zecho$(EXEEXT) printenv$(EXEEXT) xcase$(EXEEXT)
302 recho$(EXEEXT):         $(SUPPORT_SRC)recho.c
303         @$(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) ${LDFLAGS_FOR_BUILD} -o $@ $(SUPPORT_SRC)recho.c ${LIBS_FOR_BUILD}
305 zecho$(EXEEXT):         $(SUPPORT_SRC)zecho.c
306         @$(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) ${LDFLAGS_FOR_BUILD} -o $@ $(SUPPORT_SRC)zecho.c ${LIBS_FOR_BUILD}
308 printenv$(EXEEXT):      $(SUPPORT_SRC)printenv.c
309         @$(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) ${LDFLAGS_FOR_BUILD} -o $@ $(SUPPORT_SRC)printenv.c ${LIBS_FOR_BUILD}
311 xcase$(EXEEXT): $(SUPPORT_SRC)xcase.c
312         @$(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) ${LDFLAGS_FOR_BUILD} -o $@ $(SUPPORT_SRC)xcase.c ${LIBS_FOR_BUILD}
315 # man2html
317 $(SDIR)/man2html$(EXEEXT):      ${SUPPORT_SRC}/man2html.c
318         @(cd $(SDIR) && $(MAKE) $(MFLAGS) all ) || exit 1
339 $(Program): .build $(OBJECTS) $(BUILTINS_DEP) $(LIBDEP)
342 LIBRARIES = $(GLOB_LIB) $(SHLIB_LIB) $(READLINE_LIB) $(HISTORY_LIB) \
343                 $(TERMCAP_LIB) $(TILDE_LIB) $(MALLOC_LIB) $(INTL_LIB) \
344                 $(LIBICONV) $(LOCAL_LIBS)
346 # used for Makefile in sub-dir.
347 LIB_SUBDIRS = ${RL_LIBDIR}  ${HIST_LIBDIR} ${TERM_LIBDIR} ${GLOB_LIBDIR} \
348                 ${INTL_LIBDIR} ${TILDE_LIBDIR} ${ALLOC_LIBDIR} ${SH_LIBDIR}
372 LIBSUBDIR = lib
373 SRCSUBDIR = src
374 LIBSRC = $(srcdir)/$(LIBSUBDIR)
375 BUSHSRC = $(srcdir)/$(SRCSUBDIR)
377 LIBBUILD = ${BUILD_DIR}/${LIBSUBDIR}
380 BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@
381 USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
383 # the bush library
384 # the library is a mix of functions that the C library does not provide on
385 # some platforms and general shell utility functions
386 SH_LIBSRC = $(LIBSRC)/sh
387 SH_LIBDIR = $(dot)/${LIBSUBDIR}/sh
388 SH_ABSSRC = ${topdir}/${SH_LIBSRC}
390 SHLIB_LIB = -lsh
391 SHLIB_LIBNAME = libsh.a
392 SHLIB_LIBRARY = ${SH_LIBDIR}/${SHLIB_LIBNAME}
393 SHLIB_LDFLAGS = -L${SH_LIBDIR}
394 SHLIB_DEP = ${SHLIB_LIBRARY}
396 # we assume for now that readline source is being shipped with bush
397 RL_LIBSRC = $(LIBSRC)/readline
398 RL_LIBDOC = $(RL_LIBSRC)/doc
399 RL_LIBDIR = @RL_LIBDIR@
400 RL_ABSSRC = ${topdir}/$(RL_LIBDIR)
402 RL_INCLUDEDIR = @RL_INCLUDEDIR@
404 READLINE_LIB = @READLINE_LIB@
405 READLINE_LIBRARY = $(RL_LIBDIR)/libreadline.a
406 READLINE_LDFLAGS = -L${RL_LIBDIR}
407 READLINE_DEP = @READLINE_DEP@
409 # The source, object and documentation of the GNU Readline library.
415 READLINE_OBJ    = $(RL_LIBDIR)/readline.o $(RL_LIBDIR)/funmap.o \
416                   $(RL_LIBDIR)/parens.o $(RL_LIBDIR)/search.o \
417                   $(RL_LIBDIR)/keymaps.o $(RL_LIBDIR)/xmalloc.o \
418                   $(RL_LIBDIR)/rltty.o $(RL_LIBDIR)/complete.o \
419                   $(RL_LIBDIR)/bind.o $(RL_LIBDIR)/isearch.o \
420                   $(RL_LIBDIR)/display.o $(RL_LIBDIR)/signals.o \
421                   $(RL_LIBDIR)/tilde.o $(RL_LIBDIR)/util.o \
422                   $(RL_LIBDIR)/kill.o $(RL_LIBDIR)/undo.o $(RL_LIBDIR)/nls.o \
423                   $(RL_LIBDIR)/macro.o $(RL_LIBDIR)/input.o \
424                   $(RL_LIBDIR)/terminal.o $(RL_LIBDIR)/callback.o \
425                   $(RL_LIBDIR)/shell.o $(RL_LIBDIR)/savestring.o \
426                   $(RL_LIBDIR)/mbutil.o $(RL_LIBDIR)/compat.o \
427                   $(RL_LIBDIR)/history.o $(RL_LIBDIR)/histexpand.o \
428                   $(RL_LIBDIR)/histsearch.o $(RL_LIBDIR)/histfile.o \
429                   $(RL_LIBDIR)/colors.o $(RL_LIBDIR)/parse-colors.o
431 HIST_LIBSRC = $(LIBSRC)/readline
432 HIST_LIBDIR = @HIST_LIBDIR@
433 HIST_ABSSRC = ${topdir}/$(HIST_LIBDIR)
435 HISTORY_LIB = @HISTORY_LIB@
436 HISTORY_LIBRARY = $(HIST_LIBDIR)/libhistory.a
437 HISTORY_LDFLAGS = -L$(HIST_LIBDIR)
438 HISTORY_DEP = @HISTORY_DEP@
440 # The source, object and documentation of the history library.
445 HISTORY_OBJ     = $(HIST_LIBDIR)/history.o $(HIST_LIBDIR)/histexpand.o \
446                   $(HIST_LIBDIR)/histsearch.o $(HIST_LIBDIR)/histfile.o \
447                   $(HIST_LIBDIR)/shell.o
449 # You only need termcap (or curses) if you are linking with GNU Readline.
450 TERM_LIBSRC = $(LIBSRC)/termcap
451 TERM_LIBDIR = $(dot)/$(LIBSUBDIR)/termcap
452 TERM_ABSSRC = ${topdir}/$(TERM_LIBDIR)
454 TERMCAP_LIB = @TERMCAP_LIB@
455 TERMCAP_LIBRARY = $(TERM_LIBDIR)/libtermcap.a
456 TERMCAP_LDFLAGS = -L$(TERM_LIBDIR)
457 TERMCAP_DEP = @TERMCAP_DEP@
461 TERMCAP_OBJ     = $(TERM_LIBDIR)/termcap.o $(TERM_LIBDIR)/tparam.o
468 # The source, object and documentation for the GNU Tilde library.
469 TILDE_LIBSRC = $(LIBSRC)/tilde
470 TILDE_LIBDIR = $(dot)/$(LIBSUBDIR)/tilde
471 TILDE_ABSSRC = ${topdir}/$(TILDE_LIBDIR)
473 TILDE_LIB = @TILDE_LIB@
474 TILDE_LIBRARY = $(TILDE_LIBDIR)/libtilde.a
475 TILDE_LDFLAGS = -L$(TILDE_LIBDIR)
476 TILDE_DEP = $(TILDE_LIBRARY)
481 TILDE_OBJ       = $(TILDE_LIBDIR)/tilde.o
483 # libintl
484 INTL_LIBSRC = $(LIBSRC)/intl
485 INTL_LIBDIR = $(dot)/$(LIBSUBDIR)/intl
486 INTL_ABSSRC = ${topdir}/$(INTL_LIB)
487 INTL_BUILDDIR = ${LIBBUILD}/intl
489 INTL_LIB     = @LIBINTL@
490 INTL_LIBRARY = $(INTL_LIBDIR)/libintl.a
491 INTL_DEP = @INTL_DEP@
492 INTL_INC = @INTL_INC@
494 LIBINTL_H = @LIBINTL_H@
496 # libiconv
497 LIBICONV = @LIBICONV@
499 # tests
500 LIBINTL = @LIBINTL@
501 LTLIBINTL = @LTLIBINTL@
502 INTLLIBS = @INTLLIBS@
503 INTLOBJS = @INTLOBJS@
505 # Our malloc.
506 MALLOC_TARGET = @MALLOC_TARGET@
508 # set to alloca.o if we are using the C alloca in lib/malloc
509 ALLOCA = @ALLOCA@
511 ALLOC_LIBSRC = $(LIBSRC)/malloc
512 ALLOC_LIBDIR = $(dot)/$(LIBSUBDIR)/malloc
513 ALLOC_ABSSRC = ${topdir}/$(ALLOC_LIBDIR)
515 MALLOC_CFLAGS = -DRCHECK -Dbotch=programming_error ${MALLOC_DEBUG}
517 MALLOC_LIB     = @MALLOC_LIB@
518 MALLOC_LIBRARY = @MALLOC_LIBRARY@
519 MALLOC_LDFLAGS = @MALLOC_LDFLAGS@
520 MALLOC_DEP = @MALLOC_DEP@
522 ALLOC_HEADERS = $(ALLOC_LIBSRC)/getpagesize.h $(ALLOC_LIBSRC)/shmalloc.h \
523                 $(ALLOC_LIBSRC)/imalloc.h $(ALLOC_LIBSRC)/mstats.h \
524                 $(ALLOC_LIBSRC)/table.h $(ALLOC_LIBSRC)/watch.h
526 $(MALLOC_LIBRARY):      ${MALLOC_SOURCE} ${ALLOC_HEADERS} config.h
527                 @(cd $(ALLOC_LIBDIR) && \
528                  $(MAKE) $(MFLAGS) \
529                  MALLOC_CFLAGS="$(MALLOC_CFLAGS)" ${MALLOC_TARGET} ) || exit 1
531 BUSHINCDIR = ${srcdir}/include
532 BUSHINCFILES =   $(BUSHINCDIR)/posixstat.h $(BUSHINCDIR)/ansi_stdlib.h \
533                  $(BUSHINCDIR)/filecntl.h $(BUSHINCDIR)/posixdir.h \
534                  $(BUSHINCDIR)/memalloc.h $(BUSHINCDIR)/stdc.h \
535                  $(BUSHINCDIR)/posixjmp.h $(BUSHINCDIR)/posixwait.h \
536                  $(BUSHINCDIR)/posixtime.h $(BUSHINCDIR)/systimes.h \
537                  $(BUSHINCDIR)/unionwait.h $(BUSHINCDIR)/maxpath.h \
538                  $(BUSHINCDIR)/shtty.h $(BUSHINCDIR)/typemax.h \
539                  $(BUSHINCDIR)/ocache.h
541 LIBRARY_LDFLAGS = $(READLINE_LDFLAGS) $(HISTORY_LDFLAGS) $(GLOB_LDFLAGS) \
542                   $(TILDE_LDFLAGS) $(MALLOC_LDFLAGS) $(SHLIB_LDFLAGS)
545 # The shell itself
548 # The main source code for the Bourne Again SHell.
550 # mksyntax.c
552 HSOURCES =      src/shell.h \
553                         src/flags.h \
554                         src/trap.h \
555                         src/hashcmd.h \
556                         src/hashlib.h \
557                         src/jobs.h \
558                         src/builtins.h \
559                         src/general.h \
560                         src/variables.h \
561                         src/config.h \
562                         $(ALLOC_HEADERS) \
563                         src/alias.h \
564                         src/quit.h \
565                         src/unwind_prot.h \
566                         src/syntax.h \
567                         ${GRAM_H} \
568                         src/command.h \
569                         src/input.h \
570                         src/error.h \
571                         src/bushansi.h \
572                         src/dispose_cmd.h \
573                         src/make_cmd.h \
574                         src/subst.h \
575                         src/externs.h \
576                         src/siglist.h \
577                         src/bushhist.h \
578                         src/bushline.h \
579                         src/bushtypes.h \
580                         src/array.h \
581                         src/arrayfunc.h \
582                         src/sig.h \
583                         src/mailcheck.h \
584                         src/bushintl.h \
585                         src/bushjmp.h \
586                         src/execute_cmd.h \
587                         src/parser.h \
588                         src/pathexp.h \
589                         src/pathnames.h \
590                         src/pcomplete.h \
591                         src/assoc.h \
592                         $(BUSHINCFILES)
594 # config-bot.h config-top.h src/conftypes.h src/findcmd.h src/lsignames.h src/patchlevel.h 
595 # src/redir.h src/signames.h src/test.h version.h src/xmalloc.h src/y.tab.h
599 # headers in top-level source directory that get installed by install-headers
600 INSTALLED_HEADERS = shell.h command.h syntax.h general.h error.h \
601                     variables.h array.h assoc.h arrayfunc.h quit.h dispose_cmd.h \
602                     make_cmd.h subst.h sig.h externs.h builtins.h \
603                     bushtypes.h src/xmalloc.h config-top.h config-bot.h \
604                     bushintl.h bushansi.h bushjmp.h alias.h hashlib.h \
605                     conftypes.h unwind_prot.h jobs.h siglist.h
606 INSTALLED_BUILTINS_HEADERS = bushgetopt.h common.h getopt.h
607 INSTALLED_INCFILES =     posixstat.h ansi_stdlib.h filecntl.h posixdir.h \
608         memalloc.h stdc.h posixjmp.h posixwait.h posixtime.h systimes.h \
609         unionwait.h maxpath.h shtty.h typemax.h ocache.h chartypes.h gettext.h \
610         posixstat.h shmbchar.h shmbutil.h stat-time.h
612 # header files chosen based on running of configure
613 SIGNAMES_H = @SIGNAMES_H@
615 # object files chosen based on running of configure
617 # Where the source code of the shell builtins resides.
618 BUILTIN_SRCDIR=$(srcdir)/builtins
619 DEFSRC=$(BUILTIN_SRCDIR)
620 BUILTIN_ABSSRC=${topdir}/builtins
621 DEFDIR = $(dot)/builtins
622 DEBUGGER_DIR = $(dot)/debugger
625 BUILTIN_C_OBJ  = $(DEFDIR)/common.o $(DEFDIR)/evalstring.o \
626                  $(DEFDIR)/evalfile.o $(DEFDIR)/bushgetopt.o
627 BUILTIN_OBJS = $(DEFDIR)/alias.o $(DEFDIR)/bind.o $(DEFDIR)/break.o \
628                $(DEFDIR)/builtin.o $(DEFDIR)/cd.o $(DEFDIR)/colon.o \
629                $(DEFDIR)/command.o $(DEFDIR)/caller.o $(DEFDIR)/declare.o \
630                $(DEFDIR)/echo.o $(DEFDIR)/enable.o $(DEFDIR)/eval.o \
631                $(DEFDIR)/exec.o $(DEFDIR)/exit.o $(DEFDIR)/fc.o \
632                $(DEFDIR)/fg_bg.o $(DEFDIR)/hash.o $(DEFDIR)/help.o \
633                $(DEFDIR)/history.o $(DEFDIR)/jobs.o $(DEFDIR)/kill.o \
634                $(DEFDIR)/let.o $(DEFDIR)/pushd.o $(DEFDIR)/read.o \
635                $(DEFDIR)/return.o $(DEFDIR)/shopt.o $(DEFDIR)/printf.o \
636                $(DEFDIR)/set.o $(DEFDIR)/setattr.o $(DEFDIR)/shift.o \
637                $(DEFDIR)/source.o $(DEFDIR)/suspend.o $(DEFDIR)/test.o \
638                $(DEFDIR)/times.o $(DEFDIR)/trap.o $(DEFDIR)/type.o \
639                $(DEFDIR)/ulimit.o $(DEFDIR)/umask.o $(DEFDIR)/wait.o \
640                $(DEFDIR)/getopts.o $(DEFDIR)/mapfile.o $(BUILTIN_C_OBJ)
641 GETOPT_SOURCE   = $(DEFSRC)/getopt.c $(DEFSRC)/getopt.h
642 PSIZE_SOURCE    = $(DEFSRC)/psize.sh $(DEFSRC)/psize.c
644 BUILTINS_LIBRARY = $(DEFDIR)/libbuiltins.a
645 BUILTINS_LIB = -lbuiltins
646 BUILTINS_LDFLAGS = -L$(DEFDIR)
647 BUILTINS_DEP = $(BUILTINS_LIBRARY)
649 # Documentation for the shell.
650 DOCSRC = $(srcdir)/doc
651 DOCDIR = $(dot)/doc
653 # Translations and other i18n support files
654 PO_SRC = $(srcdir)/po/
655 PO_DIR = $(dot)/po/
657 SIGNAMES_SUPPORT = $(SUPPORT_SRC)mksignames.c
659 SUPPORT_SRC = $(srcdir)/support/
660 SDIR = $(dot)/support
662 CREATED_SUPPORT = src/signames.h recho$(EXEEXT) zecho$(EXEEXT) \
663                   printenv$(EXEEXT) tests/recho$(EXEEXT) tests/zecho$(EXEEXT) \
664                   tests/printenv$(EXEEXT) xcase$(EXEEXT) tests/xcase$(EXEEXT) \
665                   mksignames$(EXEEXT) src/lsignames.h \
666                   mksyntax${EXEEXT} syntax.c $(VERSPROG) $(VERSOBJ) \
667                   buildversion.o mksignames.o signames.o buildsignames.o
668 CREATED_CONFIGURE = config.h config.cache config.status config.log \
669                     stamp-h po/POTFILES config.status.lineno
670 CREATED_MAKEFILES = Makefile builtins/Makefile doc/Makefile \
671                     lib/readline/Makefile lib/glob/Makefile \
672                     lib/sh/Makefile lib/tilde/Makefile lib/malloc/Makefile \
673                     lib/termcap/Makefile examples/loadables/Makefile \
674                     examples/loadables/Makefile.inc \
675                     examples/loadables/perl/Makefile support/Makefile \
676                     lib/intl/Makefile po/Makefile po/Makefile.in
677 CREATED_HEADERS = src/signames.h config.h src/pathnames.h src/version.h \
678                   src/y.tab.h ${DEFDIR}/builtext.h
680 OTHER_DOCS = $(srcdir)/CHANGES $(srcdir)/COMPAT $(srcdir)/NEWS $(srcdir)/POSIX \
681         $(srcdir)/RBUSH $(srcdir)/README
682 OTHER_INSTALLED_DOCS = CHANGES COMPAT NEWS POSIX RBUSH README
684 LOADABLES_DIR = ${top_builddir}/examples/loadables
703 # Keep GNU Make from exporting the entire environment for small machines.
704 .NOEXPORT:
706 .made: $(Program) bushbug $(SDIR)/man2html$(EXEEXT)
707         @echo "$(Program) last made for a $(Machine) running $(OS)" >.made
710 bushbug: $(SDIR)/bushbug.sh $(VERSPROG)
711         @sed -e "s%!PATCHLEVEL!%$(PatchLevel)%" \
712              $(SDIR)/bushbug.sh > $@
713         @chmod a+rx bushbug
715 strip:  $(Program) .made
716         $(STRIP) $(Program)
717         ls -l $(Program)
718         -$(SIZE) $(Program)
720 lint:
721         ${MAKE} ${MFLAGS} CFLAGS='${GCC_LINT_FLAGS}' .made
723 asan:
724         ${MAKE} ${MFLAGS} ADDON_CFLAGS='${ASAN_XCFLAGS}' ADDON_LDFLAGS='${ASAN_XLDFLAGS}' .made
726 # cheating
727 gcov:
728         ${MAKE} ${MFLAGS} CFLAGS=-g ADDON_CFLAGS='${GCOV_XCFLAGS}' ADDON_LDFLAGS='${GCOV_XLDFLAGS}' .made
731 # have to make this separate because making tests depend on $(PROGRAM)
732 asan-tests: asan  $(TESTS_SUPPORT)
733         @-test -d tests || mkdir tests
734         @cp $(TESTS_SUPPORT) tests
735         @( cd $(srcdir)/tests && \
736                 BUILD_DIR=$(BUILD_DIR) PATH=$(BUILD_DIR)/tests:$$PATH THIS_SH=$(THIS_SH) $(SHELL) ${TESTSCRIPT} )
738 profiling-tests:        ${PROGRAM}
739         @test "X$$PROFILE_FLAGS" == "X" && { echo "profiling-tests: must be built with profiling enabled" >&2; exit 1; }
740         @${MAKE} ${MFLAGS} tests TESTSCRIPT=run-gprof
748 $(BUILTINS_LIBRARY): $(BUILTIN_DEFS) $(BUILTIN_C_SRC) config.h ${BUSHINCDIR}/memalloc.h $(DEFDIR)/builtext.h src/version.h
749         @(cd $(DEFDIR) && $(MAKE) $(MFLAGS) DEBUG=${DEBUG} targets ) || exit 1
751 # these require special rules to circumvent make builtin rules
752 ${DEFDIR}/common.o:     $(BUILTIN_SRCDIR)/common.c
753         @(cd $(DEFDIR) && $(MAKE) $(MFLAGS) DEBUG=${DEBUG} common.o) || exit 1
755 ${DEFDIR}/bushgetopt.o: $(BUILTIN_SRCDIR)/bushgetopt.c
756         @(cd $(DEFDIR) && $(MAKE) $(MFLAGS) DEBUG=${DEBUG} bushgetopt.o) || exit 1
758 ${DEFDIR}/builtext.h: $(BUILTIN_DEFS)
759         @(cd $(DEFDIR) && $(MAKE) $(MFLAGS) builtext.h ) || exit 1
761 ${DEFDIR}/pipesize.h:
762         @(cd $(DEFDIR) && $(MAKE) $(MFLAGS) pipesize.h ) || exit 1
766 # For the justification of the following Makefile rules, see node
767 # `Automatic Remaking' in GNU Autoconf documentation.
769 Makefile makefile:      config.status $(srcdir)/Makefile.in
770         CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status
772 Makefiles makefiles:    config.status $(srcdir)/Makefile.in
773         @for mf in $(CREATED_MAKEFILES); do \
774                 CONFIG_FILES=$$mf CONFIG_HEADERS= $(SHELL) ./config.status || exit 1; \
775         done
777 config.h:       stamp-h 
779 stamp-h:        config.status $(srcdir)/config.h.in $(srcdir)/config-top.h $(srcdir)/config-bot.h
780         CONFIG_FILES= CONFIG_HEADERS=config.h $(SHELL) ./config.status
782 config.status:  $(srcdir)/configure
783         $(SHELL) ./config.status --recheck
785 src/pathnames.h:                Makefile $(srcdir)/src/pathnames.h.in
786         @sed -e 's|@DEBUGGER_START_FILE\@|${DEBUGGER_START_FILE}|g' $(srcdir)/src/pathnames.h.in > pathnames.tmp
787         @if test -f $@; then \
788                 cmp -s pathnames.tmp $@ || mv pathnames.tmp $@; \
789         else \
790                 mv pathnames.tmp $@; \
791         fi
792         @${RM} pathnames.tmp
794 # comment out for distribution
795 $(srcdir)/configure:    $(srcdir)/configure.ac $(srcdir)/aclocal.m4 $(srcdir)/config.h.in
796         cd $(srcdir) && autoconf
798 # for chet
799 reconfig: force
800         sh $(srcdir)/configure -C
802 loadables:
803         cd $(LOADABLES_DIR) && $(MAKE) $(MFLAGS) all
805 #newversion:    mkversion
806 #       $(RM) .build
807 #       ./mkversion -dir $(srcdir) -dist
808 #       mv -f src/newversion.h src/version.h
809 #       $(MAKE) -f $(srcdir)/Makefile $(MFLAGS) srcdir=$(srcdir)
811 doc documentation:  force
812         @(cd $(DOCDIR) ; $(MAKE) $(MFLAGS) )
814 info dvi ps: force
815         @(cd $(DOCDIR) ; $(MAKE) $(MFLAGS) CFLAGS='$(CCFLAGS)' $@ )
817 force:
819 # unused
820 TAGS:   $(SOURCES) $(BUILTIN_C_SRC) $(LIBRARY_SOURCE)
821         etags $(SOURCES) $(BUILTIN_C_SRC) $(LIBRARY_SOURCE)
823 tags:   $(SOURCES) $(BUILTIN_C_SRC) $(LIBRARY_SOURCE)
824         ctags -x $(SOURCES) $(BUILTIN_C_SRC) $(LIBRARY_SOURCE) > $@
826 # Targets that actually do things not part of the build
828 installdirs:
829         @${SHELL} $(SUPPORT_SRC)mkinstalldirs $(DESTDIR)$(bindir)
830         @${SHELL} $(SUPPORT_SRC)mkinstalldirs $(DESTDIR)$(man1dir)
831         @${SHELL} $(SUPPORT_SRC)mkinstalldirs $(DESTDIR)$(infodir)
832         @${SHELL} $(SUPPORT_SRC)mkinstalldirs $(DESTDIR)$(docdir)
833         -( cd $(PO_DIR) ; $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) $@ )
835 install:        .made installdirs
836         $(INSTALL_PROGRAM) $(INSTALLMODE) $(Program) $(DESTDIR)$(bindir)/$(Program)
837         $(INSTALL_SCRIPT) $(INSTALLMODE2) bushbug $(DESTDIR)$(bindir)/bushbug
838         $(INSTALL_DATA) $(OTHER_DOCS) $(DESTDIR)$(docdir)
839         -( cd $(DOCDIR) ; $(MAKE) $(MFLAGS) \
840                 man1dir=$(man1dir) man1ext=$(man1ext) \
841                 man3dir=$(man3dir) man3ext=$(man3ext) \
842                 infodir=$(infodir) htmldir=$(htmldir) DESTDIR=$(DESTDIR) $@ )
843         -( cd $(DEFDIR) ; $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) $@ )
844         -( cd $(PO_DIR) ; $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) $@ )
845         -( cd $(LOADABLES_DIR) && $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) $@ )
847 install-strip:
848         $(MAKE) $(MFLAGS) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' \
849                 prefix=${prefix} exec_prefix=${exec_prefix} \
850                 DESTDIR=$(DESTDIR) install
852 install-headers-dirs:
853         @${SHELL} $(SUPPORT_SRC)mkinstalldirs $(DESTDIR)$(headersdir)
854         @${SHELL} $(SUPPORT_SRC)mkinstalldirs $(DESTDIR)$(headersdir)/builtins
855         @${SHELL} $(SUPPORT_SRC)mkinstalldirs $(DESTDIR)$(headersdir)/include
856         @${SHELL} $(SUPPORT_SRC)mkinstalldirs $(DESTDIR)$(pkgconfigdir)
858 install-headers: install-headers-dirs
859         @for hf in $(INSTALLED_HEADERS) ; do \
860                 ${INSTALL_DATA} $(srcdir)/"$$hf" $(DESTDIR)$(headersdir)/$$hf || exit 1; \
861         done
862         @for hf in $(INSTALLED_INCFILES) ; do \
863                 ${INSTALL_DATA} $(BUSHINCDIR)/"$$hf" $(DESTDIR)$(headersdir)/include/$$hf || exit 1; \
864         done
865         @for hf in $(INSTALLED_BUILTINS_HEADERS) ; do \
866                 ${INSTALL_DATA} $(BUILTIN_SRCDIR)/"$$hf" $(DESTDIR)$(headersdir)/builtins/$$hf || exit 1; \
867         done
868         @for hf in $(CREATED_HEADERS) ; do \
869                 if test -f $(BUILD_DIR)/"$$hf" ; then \
870                         ${INSTALL_DATA} $(BUILD_DIR)/"$$hf" $(DESTDIR)$(headersdir)/$$hf || exit 1; \
871                 else \
872                         ${INSTALL_DATA} $(srcdir)/"$$hf" $(DESTDIR)$(headersdir)/$$hf || exit 1; \
873                 fi ; \
874         done
875         -$(INSTALL_DATA) $(SDIR)/bush.pc $(DESTDIR)$(pkgconfigdir)/bush.pc
877 uninstall-headers:
878         -( cd $(DESTDIR)$(headersdir) && $(RM) $(INSTALLED_HEADERS) )
879         -( cd $(DESTDIR)$(headersdir)/include && $(RM) $(INSTALLED_INCFILES) )
880         -( cd $(DESTDIR)$(headersdir)/builtins && $(RM) $(INSTALLED_BUILTINS_HEADERS) )
881         -( cd $(DESTDIR)$(headersdir) && $(RM) $(CREATED_HEADERS) )
882         -( $(RM) $(DESTDIR)$(pkgconfigdir)/bush.pc )
884 uninstall:      .made
885         $(RM) $(DESTDIR)$(bindir)/$(Program) $(DESTDIR)$(bindir)/bushbug
886         -( cd $(DESTDIR)$(docdir) && ${RM} ${OTHER_INSTALLED_DOCS} )
887         -( cd $(DOCDIR) ; $(MAKE) $(MFLAGS) \
888                 man1dir=$(man1dir) man1ext=$(man1ext) \
889                 man3dir=$(man3dir) man3ext=$(man3ext) \
890                 infodir=$(infodir) htmldir=$(htmldir) DESTDIR=$(DESTDIR) $@ )
891         -( cd $(PO_DIR) ; $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) $@ )
892         -( cd $(LOADABLES_DIR) && $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) $@ )
894 .PHONY: basic-clean clean realclean maintainer-clean distclean mostlyclean maybe-clean
896 LIB_SUBDIRS = ${RL_LIBDIR}  ${HIST_LIBDIR} ${TERM_LIBDIR} ${GLOB_LIBDIR} \
897                 ${INTL_LIBDIR} ${TILDE_LIBDIR} ${ALLOC_LIBDIR} ${SH_LIBDIR}
899 basic-clean:
900         $(RM) $(OBJECTS) $(Program) bushbug
901         $(RM) .build .made src/version.h 
903 clean:  basic-clean
904         ( cd $(DOCDIR) && $(MAKE) $(MFLAGS) $@ )
905         ( cd builtins && $(MAKE) $(MFLAGS) $@ )
906         -( cd $(SDIR) && $(MAKE) $(MFLAGS) $@ )
907         -for libdir in ${LIB_SUBDIRS}; do \
908                 (cd $$libdir && test -f Makefile && $(MAKE) $(MFLAGS) $@) ;\
909         done
910         -( cd $(PO_DIR) ; $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) $@ )
911         -( cd $(LOADABLES_DIR) && $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) $@ )
912         $(RM) $(CREATED_SUPPORT)
914 mostlyclean: basic-clean
915         ( cd $(DOCDIR) && $(MAKE) $(MFLAGS) $@ )
916         ( cd builtins && $(MAKE) $(MFLAGS) $@ )
917         -( cd $(SDIR) && $(MAKE) $(MFLAGS) $@ )
918         -for libdir in ${LIB_SUBDIRS}; do \
919                 (cd $$libdir && test -f Makefile && $(MAKE) $(MFLAGS) $@) ;\
920         done
921         -( cd $(PO_DIR) ; $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) $@ )
922         -( cd $(LOADABLES_DIR) && $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) $@ )
924 distclean:      basic-clean maybe-clean
925         ( cd $(DOCDIR) && $(MAKE) $(MFLAGS) $@ )
926         ( cd builtins && $(MAKE) $(MFLAGS) $@ )
927         -( cd $(SDIR) && $(MAKE) $(MFLAGS) $@ )
928         -for libdir in ${LIB_SUBDIRS}; do \
929                 (cd $$libdir && test -f Makefile && $(MAKE) $(MFLAGS) $@) ;\
930         done
931         -( cd $(PO_DIR) ; $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) $@ )
932         -( cd $(LOADABLES_DIR) && $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) $@ )
933         $(RM) $(CREATED_CONFIGURE) tags TAGS 
934         $(RM) $(CREATED_SUPPORT) Makefile $(CREATED_MAKEFILES) src/pathnames.h
936 maintainer-clean:       basic-clean
937         @echo This command is intended for maintainers to use.
938         @echo It deletes files that may require special tools to rebuild.
939         $(RM) src/y.tab.c src/y.tab.h parser-built tags TAGS
940         ( cd $(DOCDIR) && $(MAKE) $(MFLAGS) $@ )
941         ( cd builtins && $(MAKE) $(MFLAGS) $@ )
942         ( cd $(SDIR) && $(MAKE) $(MFLAGS) $@ )
943         -for libdir in ${LIB_SUBDIRS}; do \
944                 (cd $$libdir && test -f Makefile && $(MAKE) $(MFLAGS) $@) ;\
945         done
946         -( cd $(PO_DIR) ; $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) $@ )
947         -( cd $(LOADABLES_DIR) && $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) $@ )
948         $(RM) $(CREATED_CONFIGURE) $(CREATED_MAKEFILES)
949         $(RM) $(CREATED_SUPPORT) Makefile src/pathnames.h
951 maybe-clean:
952         -if test X"`cd $(topdir) && pwd -P`" != X"`cd $(BUILD_DIR) && pwd -P`" ; then \
953                 $(RM) parser-built src/y.tab.c src/y.tab.h ; \
954         fi
957 test tests check:       force $(Program) $(TESTS_SUPPORT)
958         @-test -d tests || mkdir tests
959         @cp $(TESTS_SUPPORT) tests
960         @( cd $(srcdir)/tests && \
961                 BUILD_DIR=$(BUILD_DIR) PATH=$(BUILD_DIR)/tests:$$PATH THIS_SH=$(THIS_SH) $(SHELL) ${TESTSCRIPT} )
963 symlinks:
964         $(SHELL) $(SUPPORT_SRC)fixlinks -s $(srcdir)
966 dist:   force
967         @echo Bush distributions are created using $(srcdir)/support/mkdist.
968         @echo Here is a sample of the necessary commands:
969         @echo $(Program) $(srcdir)/support/mkdist -m $(srcdir)/MANIFEST -s $(srcdir) -r ${PACKAGE} -t $(PACKAGE_VERSION)
971 xdist:  force
972         ( cd $(DOCDIR) && $(MAKE) $(MFLAGS) $@ )
973         ( cd po && $(MAKE) $(MFLAGS) $@ )
975 depend: depends
977 depends: force
978         $(Program) $(SUPPORT_SRC)mkdep -c ${CC} -- ${CCFLAGS} ${CSOURCES}
980 #### PRIVATE TARGETS ####
981 hashtest:       src/hashlib.c
982         $(CC) -DTEST_HASHING $(CCFLAGS) $(TEST_NBUCKETS) -o $@ $(srcdir)/src/hashlib.c xmalloc.o $(INTL_LIB) $(MALLOC_LIBRARY)
984 ############################ DEPENDENCIES ###############################
986 # most of dep info can be generated by compiler.
988 builtins/alias.o: $(DEFSRC)/alias.def
989 builtins/bind.o: $(DEFSRC)/bind.def
990 builtins/break.o: $(DEFSRC)/break.def
991 builtins/builtin.o: $(DEFSRC)/builtin.def
992 builtins/caller.o: $(DEFSRC)/caller.def
993 builtins/cd.o: $(DEFSRC)/cd.def
994 builtins/colon.o: $(DEFSRC)/colon.def
995 builtins/command.o: $(DEFSRC)/command.def
996 builtins/complete.o: $(DEFSRC)/complete.def
997 builtins/declare.o: $(DEFSRC)/declare.def
998 builtins/echo.o: $(DEFSRC)/echo.def
999 builtins/enable.o: $(DEFSRC)/enable.def
1000 builtins/eval.o: $(DEFSRC)/eval.def
1001 builtins/exec.o: $(DEFSRC)/exec.def
1002 builtins/exit.o: $(DEFSRC)/exit.def
1003 builtins/fc.o: $(DEFSRC)/fc.def
1004 builtins/fg_bg.o: $(DEFSRC)/fg_bg.def
1005 builtins/getopts.o: $(DEFSRC)/getopts.def
1006 builtins/hash.o: $(DEFSRC)/hash.def
1007 builtins/help.o: $(DEFSRC)/help.def
1008 builtins/history.o: $(DEFSRC)/history.def
1009 builtins/inlib.o: $(DEFSRC)/inlib.def
1010 builtins/jobs.o: $(DEFSRC)/jobs.def
1011 builtins/kill.o: $(DEFSRC)/kill.def
1012 builtins/let.o: $(DEFSRC)/let.def
1013 builtins/mapfile.o: $(DEFSRC)/mapfile.def
1014 builtins/pushd.o: $(DEFSRC)/pushd.def
1015 builtins/read.o: $(DEFSRC)/read.def
1016 builtins/reserved.o: $(DEFSRC)/reserved.def
1017 builtins/return.o: $(DEFSRC)/return.def
1018 builtins/set.o: $(DEFSRC)/set.def
1019 builtins/setattr.o: $(DEFSRC)/setattr.def
1020 builtins/shift.o: $(DEFSRC)/shift.def
1021 builtins/shopt.o: $(DEFSRC)/shopt.def
1022 builtins/source.o: $(DEFSRC)/source.def
1023 builtins/suspend.o: $(DEFSRC)/suspend.def
1024 builtins/test.o: $(DEFSRC)/test.def
1025 builtins/times.o: $(DEFSRC)/times.def
1026 builtins/trap.o: $(DEFSRC)/trap.def
1027 builtins/type.o: $(DEFSRC)/type.def
1028 builtins/ulimit.o: $(DEFSRC)/ulimit.def
1029 builtins/umask.o: $(DEFSRC)/umask.def
1030 builtins/wait.o: $(DEFSRC)/wait.def