# Copyright (C) 1998 Free Software Foundation, Inc.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
RL_LIBRARY_VERSION = 4.3
RL_LIBRARY_NAME = readline

srcdir = ../../shlib
VPATH = .:../..
topdir = ../..
includedir =
BUILD_DIR = .

INSTALL = install -c
INSTALL_PROGRAM = $(INSTALL)
INSTALL_DATA = $(INSTALL) -m 644

RM = rm -f
CP = cp
MV = mv

CFLAGS = -Os
LOCAL_CFLAGS =
CPPFLAGS = 
LDFLAGS =  -s

DEFS = -DHAVE_CONFIG_H
LOCAL_DEFS = -DBUILDING_DLL

prefix = /usr/local
exec_prefix = $(prefix)

bindir = $(exec_prefix)/bin
libdir = $(exec_prefix)/lib
mandir = $(prefix)/man
includedir = $(prefix)/include

infodir = $(prefix)/info

man3dir = $(mandir)/man3

#
# These values are generated for configure by $(topdir)/support/shobj-conf.
# If your system is not supported by that script, but includes facilities for
# dynamic loading of shared objects, please update the script and send the
# changes to bash-maintainers@gnu.org.
#
SHOBJ_CC = gcc -mno-cygwin
SHOBJ_CFLAGS =
DLLWRAP = dllwrap
DLLTOOL = dlltool

SHOBJ_LIBS = 
SHLIB_LIBS =

# For libraries which include headers from other libraries.
INCLUDES = -I. -I.. -I$(topdir) -I$(includedir)

CCFLAGS = $(DEFS) $(LOCAL_DEFS) $(CPPFLAGS) $(INCLUDES) $(LOCAL_CFLAGS) $(CFLAGS)

.SUFFIXES:	.so

.c.so:
	$(RM) $@
	$(SHOBJ_CC) -c $(CCFLAGS) $(SHOBJ_CFLAGS) -o $*.so $< 
#	$(MV) $*.o $@

# The name of the main library target.

IMPORT_READLINE = libreadline.a
DEFINE_READLINE = libreadlinedl.def
EXPORT_READLINE = readline.dll
IMPORT_HISTORY = libhistory.a
DEFINE_HISTORY = libhistorydl.def
SHARED_LIBS = $(EXPORT_READLINE) $(IMPORT_READLINE) $(IMPORT_HISTORY)
DLLTOOL_HISTORY_FLAGS = --input-def $(DEFINE_HISTORY) --output-lib \
		$(IMPORT_HISTORY) --dllname $(EXPORT_READLINE)

# The C code source files for this library.
CSOURCES = $(topdir)/readline.c $(topdir)/funmap.c $(topdir)/keymaps.c \
	   $(topdir)/vi_mode.c $(topdir)/parens.c $(topdir)/rltty.c \
	   $(topdir)/complete.c $(topdir)/bind.c $(topdir)/isearch.c \
	   $(topdir)/display.c $(topdir)/signals.c $(topdir)/emacs_keymap.c \
	   $(topdir)/vi_keymap.c $(topdir)/util.c $(topdir)/kill.c \
	   $(topdir)/undo.c $(topdir)/macro.c $(topdir)/input.c \
	   $(topdir)/callback.c $(topdir)/terminal.c $(topdir)/xmalloc.c \
	   $(topdir)/history.c $(topdir)/histsearch.c $(topdir)/histexpand.c \
	   $(topdir)/histfile.c $(topdir)/nls.c $(topdir)/search.c \
	   $(topdir)/shell.c $(topdir)/savestring.c $(topdir)/tilde.c

# The header files for this library.
HSOURCES = readline.h rldefs.h chardefs.h keymaps.h history.h histlib.h \
	   posixstat.h posixdir.h posixjmp.h tilde.h rlconf.h rltty.h \
	   ansi_stdlib.h tcap.h rldynlink.h

SHARED_HISTOBJ = history.so histexpand.so histfile.so histsearch.so shell.so
SHARED_TILDEOBJ = tilde.so
SHARED_OBJ = readline.so vi_mode.so funmap.so keymaps.so parens.so search.so \
	  rltty.so complete.so bind.so isearch.so display.so signals.so \
	  util.so kill.so undo.so macro.so input.so callback.so terminal.so \
	  nls.so xmalloc.so $(SHARED_HISTOBJ) $(SHARED_TILDEOBJ) \
	  text.so mbutil.so misc.so

INSTALLED_HEADERS = readline.h chardefs.h keymaps.h history.h tilde.h \
		    rlstdc.h rlconf.h rldynlink.h rltypedefs.h

##########################################################################

all: $(SHARED_LIBS)

supported: $(SHARED_LIBS)

$(EXPORT_READLINE) $(IMPORT_READLINE):	$(SHARED_OBJ) $(DEFINE_READLINE)
	$(RM) $@
	$(SHOBJ_CC) -shared -o $@ $(SHARED_OBJ) -Wl,--out-implib=$(IMPORT_READLINE) $(SHLIB_LIBS)


$(IMPORT_HISTORY):	$(DEFINE_HISTORY) $(SHARED_HISTOBJ) xmalloc.so
	$(RM) $@
	$(DLLTOOL) $(DLLTOOL_HISTORY_FLAGS)

install: installdirs $(STATIC_LIBS)
	for f in $(INSTALLED_HEADERS); do \
		$(INSTALL_DATA) $(topdir)/$$f $(includedir)/readline ; \
	done
	$(INSTALL_PROGRAM) $(EXPORT_READLINE) $(exec_prefix)/bin
	$(INSTALL_DATA) $(IMPORT_READLINE) $(libdir)
	$(INSTALL_DATA) $(IMPORT_HISTORY) $(libdir)

installdirs: $(topdir)/support/mkdirs
	-$(SHELL) $(topdir)/support/mkdirs $(includedir) \
		$(includedir)/readline $(bindir) $(libdir) $(infodir) $(man3dir)
clean mostlyclean:	force
	$(RM) $(SHARED_OBJ) $(SHARED_LIBS) *~

force:

# Tell versions [3.59,3.63) of GNU make not to export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

# Dependencies
bind.so: $(topdir)/ansi_stdlib.h $(topdir)/posixstat.h
bind.so: $(topdir)/rldefs.h $(BUILD_DIR)/config.h $(topdir)/rlconf.h
bind.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h
bind.so: $(topdir)/tilde.h $(topdir)/history.h $(topdir)/rldynlink.h
callback.so: $(topdir)/rlconf.h
callback.so: $(topdir)/rldefs.h $(BUILD_DIR)/config.h
callback.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h
callback.so: $(topdir)/tilde.h $(topdir)/rldynlink.h
complete.so: $(topdir)/ansi_stdlib.h posixdir.h $(topdir)/posixstat.h
complete.so: $(topdir)/rldefs.h $(BUILD_DIR)/config.h $(topdir)/rlconf.h
complete.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h
complete.so: $(topdir)/tilde.h $(topdir)/rldynlink.h
display.so: $(topdir)/ansi_stdlib.h $(topdir)/posixstat.h
display.so: $(topdir)/rldefs.h $(BUILD_DIR)/config.h $(topdir)/rlconf.h
display.so: $(topdir)/tcap.h
display.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h
display.so: $(topdir)/tilde.h $(topdir)/history.h $(topdir)/rldynlink.h
funmap.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h
funmap.so: $(topdir)/rlconf.h $(topdir)/ansi_stdlib.h
funmap.so: $(BUILD_DIR)/config.h $(topdir)/tilde.h $(topdir)/rldynlink.h
histexpand.so: $(topdir)/ansi_stdlib.h
histexpand.so: $(topdir)/history.h histlib.h
histexpand.so: $(BUILD_DIR)/config.h $(topdir)/rldynlink.h
histfile.so: $(topdir)/ansi_stdlib.h
histfile.so: $(topdir)/history.h histlib.h
histfile.so: $(BUILD_DIR)/config.h
history.so: $(topdir)/ansi_stdlib.h
history.so: $(topdir)/history.h histlib.h
history.so: $(BUILD_DIR)/config.h $(topdir)/rldynlink.h
histsearch.so: $(topdir)/ansi_stdlib.h
histsearch.so: $(topdir)/history.h histlib.h
histsearch.so: $(BUILD_DIR)/config.h $(topdir)/rldynlink.h
input.so: $(topdir)/ansi_stdlib.h
input.so: $(topdir)/rldefs.h $(BUILD_DIR)/config.h $(topdir)/rlconf.h
input.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h
input.so: $(topdir)/tilde.h $(topdir)/rldynlink.h
isearch.so: $(topdir)/rldefs.h $(BUILD_DIR)/config.h $(topdir)/rlconf.h
isearch.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h
isearch.so: $(topdir)/ansi_stdlib.h $(topdir)/history.h $(topdir)/tilde.h
isearch.so: $(topdir)/rldynlink.h
keymaps.so: emacs_keymap.c vi_keymap.c
keymaps.so: $(topdir)/keymaps.h $(topdir)/chardefs.h $(topdir)/rlconf.h
keymaps.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h
keymaps.so: $(BUILD_DIR)/config.h $(topdir)/ansi_stdlib.h $(topdir)/tilde.h
keymaps.so: $(topdir)/rldynlink.h
kill.so: $(topdir)/ansi_stdlib.h
kill.so: $(topdir)/rldefs.h $(BUILD_DIR)/config.h $(topdir)/rlconf.h
kill.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h
kill.so: $(topdir)/tilde.h $(topdir)/history.h $(topdir)/rldynlink.h
macro.so: $(topdir)/ansi_stdlib.h
macro.so: $(topdir)/rldefs.h $(BUILD_DIR)/config.h $(topdir)/rlconf.h
macro.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h
macro.so: $(topdir)/tilde.h $(topdir)/history.h $(topdir)/rldynlink.h
nls.so: $(topdir)/ansi_stdlib.h
nls.so: $(topdir)/rldefs.h $(BUILD_DIR)/config.h $(topdir)/rlconf.h
parens.so: $(topdir)/rlconf.h $(BUILD_DIR)/config.h
parens.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h
parens.so: $(topdir)/tilde.h $(topdir)/rldynlink.h
readline.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h
readline.so: $(topdir)/rldefs.h $(BUILD_DIR)/config.h $(topdir)/rlconf.h
readline.so: $(topdir)/history.h $(topdir)/tilde.h $(topdir)/rldynlink.h
readline.so: $(topdir)/posixstat.h $(topdir)/ansi_stdlib.h $(topdir)/posixjmp.h
rltty.so: $(topdir)/rldefs.h $(BUILD_DIR)/config.h $(topdir)/rlconf.h
rltty.so: $(topdir)/rltty.h $(topdir)/tilde.h $(topdir)/rldynlink.h
rltty.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h
search.so: $(topdir)/rldefs.h $(BUILD_DIR)/config.h $(topdir)/rlconf.h
search.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h
search.so: $(topdir)/ansi_stdlib.h $(topdir)/history.h $(topdir)/tilde.h
search.so: $(topdir)/rldynlink.h
signals.so: $(topdir)/rldefs.h $(BUILD_DIR)/config.h $(topdir)/rlconf.h
signals.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h
signals.so: $(topdir)/history.h $(topdir)/tilde.h $(topdir)/rldynlink.h
terminal.so: $(topdir)/rldefs.h $(BUILD_DIR)/config.h $(topdir)/rlconf.h
terminal.so: $(topdir)/tcap.h
terminal.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h
terminal.so: $(topdir)/tilde.h $(topdir)/history.h $(topdir)/rldynlink.h
tilde.so: $(topdir)/ansi_stdlib.h $(BUILD_DIR)/config.h $(topdir)/tilde.h
tilde.so: $(topdir)/rldynlink.h
undo.so: $(topdir)/ansi_stdlib.h
undo.so: $(topdir)/rldefs.h $(BUILD_DIR)/config.h $(topdir)/rlconf.h
undo.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h
undo.so: $(topdir)/tilde.h $(topdir)/history.h $(topdir)/rldynlink.h
util.so: $(topdir)/posixjmp.h $(topdir)/ansi_stdlib.h
util.so: $(topdir)/rldefs.h $(BUILD_DIR)/config.h $(topdir)/rlconf.h
util.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h
util.so: $(topdir)/tilde.h $(topdir)/rldynlink.h
vi_mode.so: $(topdir)/rldefs.h $(BUILD_DIR)/config.h $(topdir)/rlconf.h
vi_mode.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h
vi_mode.so: $(topdir)/history.h $(topdir)/ansi_stdlib.h $(topdir)/tilde.h
vi_mode.so: $(topdir)/rldynlink.h
xmalloc.so: $(BUILD_DIR)/config.h
xmalloc.so: $(topdir)/ansi_stdlib.h

readline.so: $(topdir)/readline.c
vi_mode.so: $(topdir)/vi_mode.c
funmap.so: $(topdir)/funmap.c
keymaps.so: $(topdir)/keymaps.c
parens.so: $(topdir)/parens.c
search.so: $(topdir)/search.c
rltty.so: $(topdir)/rltty.c
complete.so: $(topdir)/complete.c
bind.so: $(topdir)/bind.c
isearch.so: $(topdir)/isearch.c
display.so: $(topdir)/display.c
signals.so: $(topdir)/signals.c
util.so: $(topdir)/util.c
kill.so: $(topdir)/kill.c
undo.so: $(topdir)/undo.c
macro.so: $(topdir)/macro.c
input.so: $(topdir)/input.c
callback.so: $(topdir)/callback.c
terminal.so: $(topdir)/terminal.c
nls.so: $(topdir)/nls.c
xmalloc.so: $(topdir)/xmalloc.c
history.so: $(topdir)/history.c
histexpand.so: $(topdir)/histexpand.c
histfile.so: $(topdir)/histfile.c
histsearch.so: $(topdir)/histsearch.c
savestring.so: $(topdir)/savestring.c
shell.so: $(topdir)/shell.c
tilde.so: $(topdir)/tilde.c

readline.so: readline.c
vi_mode.so: vi_mode.c
funmap.so: funmap.c
keymaps.so: keymaps.c
parens.so: parens.c
search.so: search.c
rltty.so: rltty.c
complete.so: complete.c
bind.so: bind.c
isearch.so: isearch.c
display.so: display.c
signals.so: signals.c
util.so: util.c
kill.so: kill.c
undo.so: undo.c
macro.so: macro.c
input.so: input.c
callback.so: callback.c
terminal.so: terminal.c
nls.so: nls.c
xmalloc.so: xmalloc.c
history.so: history.c
histexpand.so: histexpand.c
histfile.so: histfile.c
histsearch.so: histsearch.c
savestring.so: savestring.c
shell.so: shell.c
tilde.so: tilde.c

