2 # Master Makefile for the GNU readline library.
3 # Copyright (C) 1994, 1998 Free Software Foundation, Inc.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2, or (at your option)
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
18 RL_LIBRARY_VERSION = @LIBVERSION@
19 RL_LIBRARY_NAME = readline
23 top_srcdir = @top_srcdir@
24 BUILD_DIR = @BUILD_DIR@
27 INSTALL_PROGRAM = @INSTALL_PROGRAM@
28 INSTALL_DATA = @INSTALL_DATA@
42 exec_prefix = @exec_prefix@
47 includedir = @includedir@
51 man3dir = $(mandir)/man3
53 # Support an alternate destination root directory for package building
56 # Programs to make tags files.
61 LOCAL_CFLAGS = @LOCAL_CFLAGS@ -DRL_LIBRARY_VERSION='"$(RL_LIBRARY_VERSION)"'
65 LOCAL_DEFS = @LOCAL_DEFS@
67 TERMCAP_LIB = @TERMCAP_LIB@
69 # For libraries which include headers from other libraries.
70 INCLUDES = -I. -I$(srcdir)
72 XCCFLAGS = $(DEFS) $(LOCAL_DEFS) $(CPPFLAGS) $(INCLUDES)
73 CCFLAGS = $(XCCFLAGS) $(LOCAL_CFLAGS) $(CFLAGS)
75 # could add -Werror here
76 GCC_LINT_FLAGS = -ansi -Wall -Wshadow -Wpointer-arith -Wcast-qual \
77 -Wwrite-strings -Wstrict-prototypes \
78 -Wmissing-prototypes -Wno-implicit -pedantic
79 GCC_LINT_CFLAGS = $(XCCFLAGS) $(GCC_LINT_FLAGS) @CFLAGS@ @LOCAL_CFLAGS@
83 $(CC) -c $(CCFLAGS) $<
85 # The name of the main library target.
86 LIBRARY_NAME = libreadline.a
87 STATIC_LIBS = libreadline.a libhistory.a
89 WCWIDTH_OBJ = @WCWIDTH_OBJ@
91 # The C code source files for this library.
92 CSOURCES = $(srcdir)/readline.c $(srcdir)/funmap.c $(srcdir)/keymaps.c \
93 $(srcdir)/vi_mode.c $(srcdir)/parens.c $(srcdir)/rltty.c \
94 $(srcdir)/complete.c $(srcdir)/bind.c $(srcdir)/isearch.c \
95 $(srcdir)/display.c $(srcdir)/signals.c $(srcdir)/emacs_keymap.c \
96 $(srcdir)/vi_keymap.c $(srcdir)/util.c $(srcdir)/kill.c \
97 $(srcdir)/undo.c $(srcdir)/macro.c $(srcdir)/input.c \
98 $(srcdir)/callback.c $(srcdir)/terminal.c $(srcdir)/xmalloc.c \
99 $(srcdir)/history.c $(srcdir)/histsearch.c $(srcdir)/histexpand.c \
100 $(srcdir)/histfile.c $(srcdir)/nls.c $(srcdir)/search.c \
101 $(srcdir)/shell.c $(srcdir)/savestring.c $(srcdir)/tilde.c \
102 $(srcdir)/text.c $(srcdir)/misc.c $(srcdir)/compat.c \
103 $(srcdir)/mbutil.c $(srcdir)/support/wcwidth.c
105 # The header files for this library.
106 HSOURCES = readline.h rldefs.h chardefs.h keymaps.h history.h histlib.h \
107 posixstat.h posixdir.h posixjmp.h tilde.h rlconf.h rltty.h \
108 ansi_stdlib.h tcap.h rlstdc.h xmalloc.h rlprivate.h rlshell.h \
109 rltypedefs.h rlmbutil.h
111 HISTOBJ = history.o histexpand.o histfile.o histsearch.o shell.o mbutil.o
113 OBJECTS = readline.o vi_mode.o funmap.o keymaps.o parens.o search.o \
114 rltty.o complete.o bind.o isearch.o display.o signals.o \
115 util.o kill.o undo.o macro.o input.o callback.o terminal.o \
116 text.o nls.o misc.o compat.o xmalloc.o $(HISTOBJ) $(TILDEOBJ) \
119 # The texinfo files which document this library.
120 DOCSOURCE = doc/rlman.texinfo doc/rltech.texinfo doc/rluser.texinfo
121 DOCOBJECT = doc/readline.dvi
122 DOCSUPPORT = doc/Makefile
123 DOCUMENTATION = $(DOCSOURCE) $(DOCOBJECT) $(DOCSUPPORT)
125 CREATED_MAKEFILES = Makefile doc/Makefile examples/Makefile shlib/Makefile
126 CREATED_CONFIGURE = config.status config.h config.cache config.log \
128 CREATED_TAGS = TAGS tags
130 INSTALLED_HEADERS = readline.h chardefs.h keymaps.h history.h tilde.h \
131 rlstdc.h rlconf.h rltypedefs.h
133 ##########################################################################
134 TARGETS = @STATIC_TARGET@ @SHARED_TARGET@
135 INSTALL_TARGETS = @STATIC_INSTALL_TARGET@ @SHARED_INSTALL_TARGET@
139 everything: all examples
141 static: $(STATIC_LIBS)
143 libreadline.a: $(OBJECTS)
145 $(AR) $(ARFLAGS) $@ $(OBJECTS)
146 -test -n "$(RANLIB)" && $(RANLIB) $@
148 libhistory.a: $(HISTOBJ) xmalloc.o
150 $(AR) $(ARFLAGS) $@ $(HISTOBJ) xmalloc.o
151 -test -n "$(RANLIB)" && $(RANLIB) $@
153 wcwidth.o: $(srcdir)/support/wcwidth.c
155 $(CC) $(CCFLAGS) -c $(srcdir)/support/wcwidth.c
157 # Since tilde.c is shared between readline and bash, make sure we compile
158 # it with the right flags when it's built as part of readline
161 $(CC) $(CCFLAGS) -DREADLINE_LIBRARY -c $(srcdir)/tilde.c
163 readline: $(OBJECTS) readline.h rldefs.h chardefs.h ./libreadline.a
164 $(CC) $(CCFLAGS) -o $@ ./examples/rl.c ./libreadline.a ${TERMCAP_LIB}
167 $(MAKE) $(MFLAGS) CCFLAGS='$(GCC_LINT_CFLAGS)' static
169 Makefile makefile: config.status $(srcdir)/Makefile.in
170 CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status
172 Makefiles makefiles: config.status $(srcdir)/Makefile.in
173 @for mf in $(CREATED_MAKEFILES); do \
174 CONFIG_FILES=$$mf CONFIG_HEADERS= $(SHELL) ./config.status ; \
177 config.status: configure
178 $(SHELL) ./config.status --recheck
182 stamp-h: config.status $(srcdir)/config.h.in
183 CONFIG_FILES= CONFIG_HEADERS=config.h ./config.status
186 #$(srcdir)/configure: $(srcdir)/configure.in ## Comment-me-out in distribution
187 # cd $(srcdir) && autoconf ## Comment-me-out in distribution
190 -test -d shlib || mkdir shlib
191 -( cd shlib ; ${MAKE} ${MFLAGS} all )
194 -test -d doc || mkdir doc
195 -( cd doc && $(MAKE) $(MFLAGS) )
198 -test -d examples || mkdir examples
199 -(cd examples && ${MAKE} ${MFLAGS} all )
203 install-headers: installdirs ${INSTALLED_HEADERS}
204 for f in ${INSTALLED_HEADERS}; do \
205 $(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(includedir)/readline ; \
209 -test -n "$(includedir)" && cd $(DESTDIR)$(includedir)/readline && \
210 ${RM} ${INSTALLED_HEADERS}
212 maybe-uninstall-headers: uninstall-headers
215 ## Don't mess with people's installed readline's.
216 ## This tries to install this version of readline over whatever
217 ## version is already installed on the system (which could be a
218 ## newer version). There is no real reason for us to install
219 ## readline along with GDB. GDB links statically against readline,
220 ## so it doesn't depend on us installing it on the system.
224 #install: $(INSTALL_TARGETS)
226 install-static: installdirs $(STATIC_LIBS) install-headers
227 -$(MV) $(DESTDIR)$(libdir)/libreadline.a $(DESTDIR)$(libdir)/libreadline.old
228 $(INSTALL_DATA) libreadline.a $(DESTDIR)$(libdir)/libreadline.a
229 -test -n "$(RANLIB)" && $(RANLIB) $(DESTDIR)$(libdir)/libreadline.a
230 -$(MV) $(DESTDIR)$(libdir)/libhistory.a $(DESTDIR)$(libdir)/libhistory.old
231 $(INSTALL_DATA) libhistory.a $(DESTDIR)$(libdir)/libhistory.a
232 -test -n "$(RANLIB)" && $(RANLIB) $(DESTDIR)$(libdir)/libhistory.a
233 -( if test -d doc ; then \
235 ${MAKE} ${MFLAGS} infodir=$(infodir) DESTDIR=${DESTDIR} install; \
238 installdirs: $(srcdir)/support/mkdirs
239 -$(SHELL) $(srcdir)/support/mkdirs $(DESTDIR)$(includedir) \
240 $(DESTDIR)$(includedir)/readline $(DESTDIR)$(libdir) \
241 $(DESTDIR)$(infodir) $(DESTDIR)$(man3dir)
243 uninstall: uninstall-headers
244 -test -n "$(DESTDIR)$(libdir)" && cd $(DESTDIR)$(libdir) && \
245 ${RM} libreadline.a libreadline.old libhistory.a libhistory.old $(SHARED_LIBS)
246 -( if test -d doc ; then \
248 ${MAKE} ${MFLAGS} infodir=$(infodir) DESTDIR=${DESTDIR} $@; \
250 -( cd shlib; ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} uninstall )
252 install-shared: installdirs install-headers shared
253 -( cd shlib ; ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} install )
255 uninstall-shared: maybe-uninstall-headers
256 -( cd shlib; ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} uninstall )
259 $(ETAGS) $(CSOURCES) $(HSOURCES)
262 $(CTAGS) $(CSOURCES) $(HSOURCES)
265 $(RM) $(OBJECTS) $(STATIC_LIBS)
266 $(RM) readline readline.exe
267 -( cd shlib && $(MAKE) $(MFLAGS) $@ )
268 -( cd doc && $(MAKE) $(MFLAGS) $@ )
269 -( cd examples && $(MAKE) $(MFLAGS) $@ )
272 -( cd shlib && $(MAKE) $(MFLAGS) $@ )
273 -( cd doc && $(MAKE) $(MFLAGS) $@ )
274 -( cd examples && $(MAKE) $(MFLAGS) $@ )
276 distclean maintainer-clean: clean
277 -( cd shlib && $(MAKE) $(MFLAGS) $@ )
278 -( cd doc && $(MAKE) $(MFLAGS) $@ )
279 -( cd examples && $(MAKE) $(MFLAGS) $@ )
281 $(RM) $(CREATED_CONFIGURE)
282 $(RM) $(CREATED_TAGS)
285 -( cd doc && $(MAKE) $(MFLAGS) $@ )
292 @echo Readline distributions are created using $(srcdir)/support/mkdist.
293 @echo Here is a sample of the necessary commands:
294 @echo bash $(srcdir)/support/mkdist -m $(srcdir)/MANIFEST -s $(srcdir) -r $(RL_LIBRARY_NAME) $(RL_LIBRARY_VERSION)
295 @echo tar cf $(RL_LIBRARY_NAME)-${RL_LIBRARY_VERSION}.tar ${RL_LIBRARY_NAME}-$(RL_LIBRARY_VERSION)
296 @echo gzip $(RL_LIBRARY_NAME)-$(RL_LIBRARY_VERSION).tar
298 # Tell versions [3.59,3.63) of GNU make not to export all variables.
299 # Otherwise a system limit (for SysV at least) may be exceeded.
303 bind.o: ansi_stdlib.h posixstat.h
304 bind.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
305 bind.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h rlstdc.h
308 callback.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
309 callback.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h rlstdc.h
311 complete.o: ansi_stdlib.h posixdir.h posixstat.h
312 complete.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
313 complete.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h rlstdc.h
314 display.o: ansi_stdlib.h posixstat.h
315 display.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
317 display.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
318 display.o: history.h rlstdc.h
319 funmap.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
320 funmap.o: rlconf.h ansi_stdlib.h rlstdc.h
321 funmap.o: ${BUILD_DIR}/config.h
322 histexpand.o: ansi_stdlib.h
323 histexpand.o: history.h histlib.h rlstdc.h rltypedefs.h
324 histexpand.o: ${BUILD_DIR}/config.h
325 histfile.o: ansi_stdlib.h
326 histfile.o: history.h histlib.h rlstdc.h rltypedefs.h
327 histfile.o: ${BUILD_DIR}/config.h
328 history.o: ansi_stdlib.h
329 history.o: history.h histlib.h rlstdc.h rltypedefs.h
330 history.o: ${BUILD_DIR}/config.h
331 histsearch.o: ansi_stdlib.h
332 histsearch.o: history.h histlib.h rlstdc.h rltypedefs.h
333 histsearch.o: ${BUILD_DIR}/config.h
334 input.o: ansi_stdlib.h
335 input.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
336 input.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h rlstdc.h
337 isearch.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
338 isearch.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
339 isearch.o: ansi_stdlib.h history.h rlstdc.h
340 keymaps.o: emacs_keymap.c vi_keymap.c
341 keymaps.o: keymaps.h rltypedefs.h chardefs.h rlconf.h ansi_stdlib.h
342 keymaps.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
343 keymaps.o: ${BUILD_DIR}/config.h rlstdc.h
344 kill.o: ansi_stdlib.h
345 kill.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
346 kill.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
347 kill.o: history.h rlstdc.h
348 macro.o: ansi_stdlib.h
349 macro.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
350 macro.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
351 macro.o: history.h rlstdc.h
352 mbutil.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
353 mbutil.o: readline.h keymaps.h rltypedefs.h chardefs.h rlstdc.h
354 misc.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
355 misc.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
356 misc.o: history.h rlstdc.h ansi_stdlib.h
358 nls.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
359 nls.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
360 nls.o: history.h rlstdc.h
362 parens.o: ${BUILD_DIR}/config.h
363 parens.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h rlstdc.h
364 readline.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
365 readline.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
366 readline.o: history.h rlstdc.h
367 readline.o: posixstat.h ansi_stdlib.h posixjmp.h
368 rltty.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
370 rltty.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h rlstdc.h
371 search.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
372 search.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
373 search.o: ansi_stdlib.h history.h rlstdc.h
374 shell.o: ${BUILD_DIR}/config.h
375 shell.o: ansi_stdlib.h
376 signals.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
377 signals.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
378 signals.o: history.h rlstdc.h
379 terminal.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
381 terminal.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
382 terminal.o: history.h rlstdc.h
383 text.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
384 text.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
385 text.o: history.h rlstdc.h ansi_stdlib.h
386 tilde.o: ansi_stdlib.h
387 tilde.o: ${BUILD_DIR}/config.h
389 undo.o: ansi_stdlib.h
390 undo.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
391 undo.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
392 undo.o: history.h rlstdc.h
393 util.o: posixjmp.h ansi_stdlib.h
394 util.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
395 util.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h rlstdc.h
396 vi_mode.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
397 vi_mode.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
398 vi_mode.o: history.h ansi_stdlib.h rlstdc.h
399 xmalloc.o: ${BUILD_DIR}/config.h
400 xmalloc.o: ansi_stdlib.h
403 histfile.o: rlshell.h
405 readline.o: rlshell.h
407 terminal.o: rlshell.h
408 histexpand.o: rlshell.h
411 callback.o: rlprivate.h
412 complete.o: rlprivate.h
413 display.o: rlprivate.h
415 isearch.o: rlprivate.h
418 mbutil.o: rlprivate.h
421 parens.o: rlprivate.h
422 readline.o: rlprivate.h
424 search.o: rlprivate.h
425 signals.o: rlprivate.h
426 terminal.o: rlprivate.h
430 vi_mode.o: rlprivate.h
433 complete.o: xmalloc.h
436 histexpand.o: xmalloc.h
437 histfile.o: xmalloc.h
446 readline.o: xmalloc.h
447 savestring.o: xmalloc.h
450 terminal.o: xmalloc.h
458 complete.o: rlmbutil.h
459 display.o: rlmbutil.h
460 histexpand.o: rlmbutil.h
462 isearch.o: rlmbutil.h
465 readline.o: rlmbutil.h
468 vi_mode.o: rlmbutil.h
470 bind.o: $(srcdir)/bind.c
471 callback.o: $(srcdir)/callback.c
472 compat.o: $(srcdir)/compat.c
473 complete.o: $(srcdir)/complete.c
474 display.o: $(srcdir)/display.c
475 funmap.o: $(srcdir)/funmap.c
476 input.o: $(srcdir)/input.c
477 isearch.o: $(srcdir)/isearch.c
478 keymaps.o: $(srcdir)/keymaps.c $(srcdir)/emacs_keymap.c $(srcdir)/vi_keymap.c
479 kill.o: $(srcdir)/kill.c
480 macro.o: $(srcdir)/macro.c
481 mbutil.o: $(srcdir)/mbutil.c
482 misc.o: $(srcdir)/misc.c
483 nls.o: $(srcdir)/nls.c
484 parens.o: $(srcdir)/parens.c
485 readline.o: $(srcdir)/readline.c
486 rltty.o: $(srcdir)/rltty.c
487 savestring.o: $(srcdir)/savestring.c
488 search.o: $(srcdir)/search.c
489 shell.o: $(srcdir)/shell.c
490 signals.o: $(srcdir)/signals.c
491 terminal.o: $(srcdir)/terminal.c
492 text.o: $(srcdir)/text.c
493 tilde.o: $(srcdir)/tilde.c
494 undo.o: $(srcdir)/undo.c
495 util.o: $(srcdir)/util.c
496 vi_mode.o: $(srcdir)/vi_mode.c
497 xmalloc.o: $(srcdir)/xmalloc.c
499 histexpand.o: $(srcdir)/histexpand.c
500 histfile.o: $(srcdir)/histfile.c
501 history.o: $(srcdir)/history.c
502 histsearch.o: $(srcdir)/histsearch.c
505 callback.o: callback.c
507 complete.o: complete.c
512 keymaps.o: keymaps.c emacs_keymap.c vi_keymap.c
519 readline.o: readline.c
521 savestring.o: savestring.c
525 terminal.o: terminal.c
533 histexpand.o: histexpand.c
534 histfile.o: histfile.c
536 histsearch.o: histsearch.c