2 # Master Makefile for the GNU readline library.
3 # Copyright (C) 1994-2009 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 3 of the License, or
8 # (at your option) any later version.
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, see <http://www.gnu.org/licenses/>.
18 RL_LIBRARY_VERSION = @LIBVERSION@
19 RL_LIBRARY_NAME = readline
21 PACKAGE = @PACKAGE_NAME@
22 VERSION = @PACKAGE_VERSION@
24 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
25 PACKAGE_NAME = @PACKAGE_NAME@
26 PACKAGE_STRING = @PACKAGE_STRING@
27 PACKAGE_VERSION = @PACKAGE_VERSION@
31 top_srcdir = @top_srcdir@
32 BUILD_DIR = @BUILD_DIR@
35 INSTALL_PROGRAM = @INSTALL_PROGRAM@
36 INSTALL_DATA = @INSTALL_DATA@
52 exec_prefix = @exec_prefix@
54 datarootdir = @datarootdir@
59 includedir = @includedir@
61 localedir = @localedir@
65 man3dir = $(mandir)/man3
67 # Support an alternate destination root directory for package building
70 # Programs to make tags files.
75 LOCAL_CFLAGS = @LOCAL_CFLAGS@ -DRL_LIBRARY_VERSION='"$(RL_LIBRARY_VERSION)"'
78 DEFS = @DEFS@ @CROSS_COMPILE@
79 LOCAL_DEFS = @LOCAL_DEFS@
81 TERMCAP_LIB = @TERMCAP_LIB@
83 # For libraries which include headers from other libraries.
84 INCLUDES = -I. -I$(srcdir)
86 XCCFLAGS = $(DEFS) $(LOCAL_DEFS) $(CPPFLAGS) $(INCLUDES)
87 CCFLAGS = $(XCCFLAGS) $(LOCAL_CFLAGS) $(CFLAGS)
89 # could add -Werror here
90 GCC_LINT_FLAGS = -ansi -Wall -Wshadow -Wpointer-arith -Wcast-qual \
91 -Wwrite-strings -Wstrict-prototypes \
92 -Wmissing-prototypes -Wno-implicit -pedantic
93 GCC_LINT_CFLAGS = $(XCCFLAGS) $(GCC_LINT_FLAGS) @CFLAGS@ @LOCAL_CFLAGS@
97 $(CC) -c $(CCFLAGS) $<
99 # The name of the main library target.
100 LIBRARY_NAME = libreadline.a
101 STATIC_LIBS = libreadline.a libhistory.a
103 # The C code source files for this library.
104 CSOURCES = $(srcdir)/readline.c $(srcdir)/funmap.c $(srcdir)/keymaps.c \
105 $(srcdir)/vi_mode.c $(srcdir)/parens.c $(srcdir)/rltty.c \
106 $(srcdir)/complete.c $(srcdir)/bind.c $(srcdir)/isearch.c \
107 $(srcdir)/display.c $(srcdir)/signals.c $(srcdir)/emacs_keymap.c \
108 $(srcdir)/vi_keymap.c $(srcdir)/util.c $(srcdir)/kill.c \
109 $(srcdir)/undo.c $(srcdir)/macro.c $(srcdir)/input.c \
110 $(srcdir)/callback.c $(srcdir)/terminal.c $(srcdir)/xmalloc.c $(srcdir)/xfree.c \
111 $(srcdir)/history.c $(srcdir)/histsearch.c $(srcdir)/histexpand.c \
112 $(srcdir)/histfile.c $(srcdir)/nls.c $(srcdir)/search.c \
113 $(srcdir)/shell.c $(srcdir)/savestring.c $(srcdir)/tilde.c \
114 $(srcdir)/text.c $(srcdir)/misc.c $(srcdir)/compat.c \
117 # The header files for this library.
118 HSOURCES = $(srcdir)/readline.h $(srcdir)/rldefs.h $(srcdir)/chardefs.h \
119 $(srcdir)/keymaps.h $(srcdir)/history.h $(srcdir)/histlib.h \
120 $(srcdir)/posixstat.h $(srcdir)/posixdir.h $(srcdir)/posixjmp.h \
121 $(srcdir)/tilde.h $(srcdir)/rlconf.h $(srcdir)/rltty.h \
122 $(srcdir)/ansi_stdlib.h $(srcdir)/tcap.h $(srcdir)/rlstdc.h \
123 $(srcdir)/xmalloc.h $(srcdir)/rlprivate.h $(srcdir)/rlshell.h \
124 $(srcdir)/rltypedefs.h $(srcdir)/rlmbutil.h
126 HISTOBJ = history.o histexpand.o histfile.o histsearch.o shell.o mbutil.o
128 OBJECTS = readline.o vi_mode.o funmap.o keymaps.o parens.o search.o \
129 rltty.o complete.o bind.o isearch.o display.o signals.o \
130 util.o kill.o undo.o macro.o input.o callback.o terminal.o \
131 text.o nls.o misc.o compat.o xfree.o xmalloc.o $(HISTOBJ) $(TILDEOBJ)
133 # The texinfo files which document this library.
134 DOCSOURCE = doc/rlman.texinfo doc/rltech.texinfo doc/rluser.texinfo
135 DOCOBJECT = doc/readline.dvi
136 DOCSUPPORT = doc/Makefile
137 DOCUMENTATION = $(DOCSOURCE) $(DOCOBJECT) $(DOCSUPPORT)
139 CREATED_MAKEFILES = Makefile doc/Makefile examples/Makefile shlib/Makefile
140 CREATED_CONFIGURE = config.status config.h config.cache config.log \
142 CREATED_TAGS = TAGS tags
144 INSTALLED_HEADERS = readline.h chardefs.h keymaps.h history.h tilde.h \
145 rlstdc.h rlconf.h rltypedefs.h
147 ##########################################################################
148 TARGETS = @STATIC_TARGET@ @SHARED_TARGET@
149 INSTALL_TARGETS = @STATIC_INSTALL_TARGET@ @SHARED_INSTALL_TARGET@
153 everything: all examples
155 static: $(STATIC_LIBS)
157 libreadline.a: $(OBJECTS)
159 $(AR) $(ARFLAGS) $@ $(OBJECTS)
160 -test -n "$(RANLIB)" && $(RANLIB) $@
162 libhistory.a: $(HISTOBJ) xmalloc.o xfree.o
164 $(AR) $(ARFLAGS) $@ $(HISTOBJ) xmalloc.o xfree.o
165 -test -n "$(RANLIB)" && $(RANLIB) $@
167 # Since tilde.c is shared between readline and bash, make sure we compile
168 # it with the right flags when it's built as part of readline
171 $(CC) $(CCFLAGS) -DREADLINE_LIBRARY -c $(srcdir)/tilde.c
173 readline: $(OBJECTS) readline.h rldefs.h chardefs.h ./libreadline.a
174 $(CC) $(CCFLAGS) -DREADLINE_LIBRARY -o $@ $(top_srcdir)/examples/rl.c ./libreadline.a ${TERMCAP_LIB}
177 $(MAKE) $(MFLAGS) CCFLAGS='$(GCC_LINT_CFLAGS)' static
179 Makefile makefile: config.status $(srcdir)/Makefile.in
180 CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status
182 Makefiles makefiles: config.status $(srcdir)/Makefile.in
183 @for mf in $(CREATED_MAKEFILES); do \
184 CONFIG_FILES=$$mf CONFIG_HEADERS= $(SHELL) ./config.status ; \
187 config.status: configure
188 $(SHELL) ./config.status --recheck
192 stamp-h: config.status $(srcdir)/config.h.in
193 CONFIG_FILES= CONFIG_HEADERS=config.h ./config.status
196 #$(srcdir)/configure: $(srcdir)/configure.in ## Comment-me-out in distribution
197 # cd $(srcdir) && autoconf ## Comment-me-out in distribution
201 -test -d shlib || mkdir shlib
202 -( cd shlib ; ${MAKE} ${MFLAGS} all )
205 -test -d doc || mkdir doc
206 -( cd doc && $(MAKE) $(MFLAGS) )
209 -test -d examples || mkdir examples
210 -(cd examples && ${MAKE} ${MFLAGS} all )
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-headers: installdirs ${INSTALLED_HEADERS}
227 for f in ${INSTALLED_HEADERS}; do \
228 $(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(includedir)/readline ; \
232 -test -n "$(includedir)" && cd $(DESTDIR)$(includedir)/readline && \
233 ${RM} ${INSTALLED_HEADERS}
235 maybe-uninstall-headers: uninstall-headers
237 install-static: installdirs $(STATIC_LIBS) install-headers install-doc install-examples
238 -$(MV) $(DESTDIR)$(libdir)/libreadline.a $(DESTDIR)$(libdir)/libreadline.old
239 $(INSTALL_DATA) libreadline.a $(DESTDIR)$(libdir)/libreadline.a
240 -test -n "$(RANLIB)" && $(RANLIB) $(DESTDIR)$(libdir)/libreadline.a
241 -$(MV) $(DESTDIR)$(libdir)/libhistory.a $(DESTDIR)$(libdir)/libhistory.old
242 $(INSTALL_DATA) libhistory.a $(DESTDIR)$(libdir)/libhistory.a
243 -test -n "$(RANLIB)" && $(RANLIB) $(DESTDIR)$(libdir)/libhistory.a
245 installdirs: $(srcdir)/support/mkinstalldirs
246 -$(SHELL) $(srcdir)/support/mkinstalldirs $(DESTDIR)$(includedir) \
247 $(DESTDIR)$(includedir)/readline $(DESTDIR)$(libdir) \
248 $(DESTDIR)$(infodir) $(DESTDIR)$(man3dir)
250 uninstall: uninstall-headers uninstall-doc uninstall-examples
251 -test -n "$(DESTDIR)$(libdir)" && cd $(DESTDIR)$(libdir) && \
252 ${RM} libreadline.a libreadline.old libhistory.a libhistory.old $(SHARED_LIBS)
253 -( cd shlib; ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} uninstall )
255 install-shared: installdirs install-headers shared install-doc
256 -( cd shlib ; ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} install )
258 uninstall-shared: maybe-uninstall-headers
259 -( cd shlib; ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} uninstall )
261 install-examples: installdirs install-headers shared
262 -( cd examples ; ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} install )
264 uninstall-examples: maybe-uninstall-headers
265 -( cd examples; ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} uninstall )
267 install-doc: installdirs
268 -( if test -d doc ; then \
270 ${MAKE} ${MFLAGS} infodir=$(infodir) DESTDIR=${DESTDIR} install; \
274 -( if test -d doc ; then \
276 ${MAKE} ${MFLAGS} infodir=$(infodir) DESTDIR=${DESTDIR} uninstall; \
280 -( cd $(srcdir) && $(ETAGS) $(CSOURCES) $(HSOURCES) )
283 -( cd $(srcdir) && $(CTAGS) $(CSOURCES) $(HSOURCES) )
286 $(RM) $(OBJECTS) $(STATIC_LIBS)
287 $(RM) readline readline.exe
288 -( cd shlib && $(MAKE) $(MFLAGS) $@ )
289 -( cd doc && $(MAKE) $(MFLAGS) $@ )
290 -( cd examples && $(MAKE) $(MFLAGS) $@ )
293 -( cd shlib && $(MAKE) $(MFLAGS) $@ )
294 -( cd doc && $(MAKE) $(MFLAGS) $@ )
295 -( cd examples && $(MAKE) $(MFLAGS) $@ )
297 distclean maintainer-clean: clean
298 -( cd shlib && $(MAKE) $(MFLAGS) $@ )
299 -( cd doc && $(MAKE) $(MFLAGS) $@ )
300 -( cd examples && $(MAKE) $(MFLAGS) $@ )
302 $(RM) $(CREATED_CONFIGURE)
303 $(RM) $(CREATED_TAGS)
305 info dvi html pdf ps:
306 -( cd doc && $(MAKE) $(MFLAGS) $@ )
317 @echo Readline distributions are created using $(srcdir)/support/mkdist.
318 @echo Here is a sample of the necessary commands:
319 @echo bash $(srcdir)/support/mkdist -m $(srcdir)/MANIFEST -s $(srcdir) -r $(RL_LIBRARY_NAME) $(RL_LIBRARY_VERSION)
320 @echo tar cf $(RL_LIBRARY_NAME)-${RL_LIBRARY_VERSION}.tar ${RL_LIBRARY_NAME}-$(RL_LIBRARY_VERSION)
321 @echo gzip $(RL_LIBRARY_NAME)-$(RL_LIBRARY_VERSION).tar
323 # Tell versions [3.59,3.63) of GNU make not to export all variables.
324 # Otherwise a system limit (for SysV at least) may be exceeded.
328 bind.o: ansi_stdlib.h posixstat.h
329 bind.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
330 bind.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h rlstdc.h
333 callback.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
334 callback.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h rlstdc.h
336 complete.o: ansi_stdlib.h posixdir.h posixstat.h
337 complete.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
338 complete.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h rlstdc.h
339 display.o: ansi_stdlib.h posixstat.h
340 display.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
342 display.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
343 display.o: history.h rlstdc.h
344 funmap.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
345 funmap.o: rlconf.h ansi_stdlib.h rlstdc.h
346 funmap.o: ${BUILD_DIR}/config.h
347 histexpand.o: ansi_stdlib.h
348 histexpand.o: history.h histlib.h rlstdc.h rltypedefs.h
349 histexpand.o: ${BUILD_DIR}/config.h
350 histfile.o: ansi_stdlib.h
351 histfile.o: history.h histlib.h rlstdc.h rltypedefs.h
352 histfile.o: ${BUILD_DIR}/config.h
353 history.o: ansi_stdlib.h
354 history.o: history.h histlib.h rlstdc.h rltypedefs.h
355 history.o: ${BUILD_DIR}/config.h
356 histsearch.o: ansi_stdlib.h
357 histsearch.o: history.h histlib.h rlstdc.h rltypedefs.h
358 histsearch.o: ${BUILD_DIR}/config.h
359 input.o: ansi_stdlib.h
360 input.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
361 input.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h rlstdc.h
362 isearch.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
363 isearch.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
364 isearch.o: ansi_stdlib.h history.h rlstdc.h
365 keymaps.o: emacs_keymap.c vi_keymap.c
366 keymaps.o: keymaps.h rltypedefs.h chardefs.h rlconf.h ansi_stdlib.h
367 keymaps.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
368 keymaps.o: ${BUILD_DIR}/config.h rlstdc.h
369 kill.o: ansi_stdlib.h
370 kill.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
371 kill.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
372 kill.o: history.h rlstdc.h
373 macro.o: ansi_stdlib.h
374 macro.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
375 macro.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
376 macro.o: history.h rlstdc.h
377 mbutil.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
378 mbutil.o: readline.h keymaps.h rltypedefs.h chardefs.h rlstdc.h
379 misc.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
380 misc.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
381 misc.o: history.h rlstdc.h ansi_stdlib.h
383 nls.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
384 nls.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
385 nls.o: history.h rlstdc.h
387 parens.o: ${BUILD_DIR}/config.h
388 parens.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h rlstdc.h
389 readline.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
390 readline.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
391 readline.o: history.h rlstdc.h
392 readline.o: posixstat.h ansi_stdlib.h posixjmp.h
393 rltty.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
395 rltty.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h rlstdc.h
396 search.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
397 search.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
398 search.o: ansi_stdlib.h history.h rlstdc.h
399 shell.o: ${BUILD_DIR}/config.h
400 shell.o: ansi_stdlib.h
401 signals.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
402 signals.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
403 signals.o: history.h rlstdc.h
404 terminal.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
406 terminal.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
407 terminal.o: history.h rlstdc.h
408 text.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
409 text.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
410 text.o: history.h rlstdc.h ansi_stdlib.h
411 tilde.o: ansi_stdlib.h
412 tilde.o: ${BUILD_DIR}/config.h
414 undo.o: ansi_stdlib.h
415 undo.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
416 undo.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
417 undo.o: history.h rlstdc.h
418 util.o: posixjmp.h ansi_stdlib.h
419 util.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
420 util.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h rlstdc.h
421 vi_mode.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
422 vi_mode.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
423 vi_mode.o: history.h ansi_stdlib.h rlstdc.h
424 xfree.o: ${BUILD_DIR}/config.h
425 xfree.o: ansi_stdlib.h readline.h
426 xmalloc.o: ${BUILD_DIR}/config.h
427 xmalloc.o: ansi_stdlib.h
430 histfile.o: rlshell.h
432 readline.o: rlshell.h
434 terminal.o: rlshell.h
435 histexpand.o: rlshell.h
438 callback.o: rlprivate.h
439 complete.o: rlprivate.h
440 display.o: rlprivate.h
442 isearch.o: rlprivate.h
445 mbutil.o: rlprivate.h
448 parens.o: rlprivate.h
449 readline.o: rlprivate.h
451 search.o: rlprivate.h
452 signals.o: rlprivate.h
453 terminal.o: rlprivate.h
457 vi_mode.o: rlprivate.h
460 callback.o: xmalloc.h
461 complete.o: xmalloc.h
464 histexpand.o: xmalloc.h
465 histfile.o: xmalloc.h
474 readline.o: xmalloc.h
475 savestring.o: xmalloc.h
478 terminal.o: xmalloc.h
487 complete.o: rlmbutil.h
488 display.o: rlmbutil.h
489 histexpand.o: rlmbutil.h
491 isearch.o: rlmbutil.h
494 readline.o: rlmbutil.h
497 vi_mode.o: rlmbutil.h
499 bind.o: $(srcdir)/bind.c
500 callback.o: $(srcdir)/callback.c
501 compat.o: $(srcdir)/compat.c
502 complete.o: $(srcdir)/complete.c
503 display.o: $(srcdir)/display.c
504 funmap.o: $(srcdir)/funmap.c
505 input.o: $(srcdir)/input.c
506 isearch.o: $(srcdir)/isearch.c
507 keymaps.o: $(srcdir)/keymaps.c $(srcdir)/emacs_keymap.c $(srcdir)/vi_keymap.c
508 kill.o: $(srcdir)/kill.c
509 macro.o: $(srcdir)/macro.c
510 mbutil.o: $(srcdir)/mbutil.c
511 misc.o: $(srcdir)/misc.c
512 nls.o: $(srcdir)/nls.c
513 parens.o: $(srcdir)/parens.c
514 readline.o: $(srcdir)/readline.c
515 rltty.o: $(srcdir)/rltty.c
516 savestring.o: $(srcdir)/savestring.c
517 search.o: $(srcdir)/search.c
518 shell.o: $(srcdir)/shell.c
519 signals.o: $(srcdir)/signals.c
520 terminal.o: $(srcdir)/terminal.c
521 text.o: $(srcdir)/text.c
522 tilde.o: $(srcdir)/tilde.c
523 undo.o: $(srcdir)/undo.c
524 util.o: $(srcdir)/util.c
525 vi_mode.o: $(srcdir)/vi_mode.c
526 xfree.o: $(srcdir)/xfree.c
527 xmalloc.o: $(srcdir)/xmalloc.c
529 histexpand.o: $(srcdir)/histexpand.c
530 histfile.o: $(srcdir)/histfile.c
531 history.o: $(srcdir)/history.c
532 histsearch.o: $(srcdir)/histsearch.c
535 callback.o: callback.c
537 complete.o: complete.c
542 keymaps.o: keymaps.c emacs_keymap.c vi_keymap.c
549 readline.o: readline.c
551 savestring.o: savestring.c
555 terminal.o: terminal.c
564 histexpand.o: histexpand.c
565 histfile.o: histfile.c
567 histsearch.o: histsearch.c