1 ## -*- text -*- ####################################################
3 # Makefile for readline and history libraries. #
5 ####################################################################
10 INSTALL_PROG = install -c
11 INSTALL_FILE = $(INSTALL_PROG)
13 #### host and target dependent Makefile fragments come in here.
16 # Here is a rule for making .o files from .c files that doesn't force
17 # the type of the machine (like -sun3) into the flags.
19 $(CC) -c $(CFLAGS) $(LOCAL_INCLUDES) $(CPPFLAGS) $(READLINE_DEFINES) $<
21 # Destination installation directory. The libraries are copied to DESTDIR
22 # when you do a `make install', and the header files to INCDIR/readline/*.h.
23 DESTDIR = $(destdir)/lib
24 INCDIR = $(destdir)/include
26 # Define TYPES as -DVOID_SIGHANDLER if your operating system uses
27 # a return type of "void" for signal handlers.
28 TYPES = -DVOID_SIGHANDLER
30 # Define SYSV as -DSYSV if you are using a System V operating system.
33 # HP-UX compilation requires the BSD library.
36 # Xenix compilation requires -ldir -lx
37 #LOCAL_LIBS = -ldir -lx
39 # Comment out "-DVI_MODE" if you don't think that anyone will ever desire
40 # the vi line editing mode and features.
41 READLINE_DEFINES = $(TYPES) -DVI_MODE
44 LDFLAGS = $(DEBUG_FLAGS)
45 CFLAGS = $(DEBUG_FLAGS) $(SYSV) -I.
47 # A good alternative is gcc -traditional.
48 #CC = gcc -traditional
56 LOCAL_INCLUDES = -I$(srcdir)/../
58 CSOURCES = readline.c history.c funmap.c keymaps.c vi_mode.c \
59 emacs_keymap.c vi_keymap.c
61 HSOURCES = readline.h chardefs.h history.h keymaps.h
62 SOURCES = $(CSOURCES) $(HSOURCES)
64 DOCUMENTATION = readline.texinfo inc-readline.texinfo \
65 history.texinfo inc-history.texinfo
67 SUPPORT = COPYING Makefile $(DOCUMENTATION) ChangeLog
69 THINGS_TO_TAR = $(SOURCES) $(SUPPORT)
71 ##########################################################################
77 libreadline.a: readline.o history.o funmap.o keymaps.o
78 $(RM) -f libreadline.a
79 $(AR) $(AR_FLAGS) libreadline.a readline.o history.o funmap.o keymaps.o
80 $(RANLIB) libreadline.a
82 readline.o: readline.h chardefs.h keymaps.h history.h readline.c vi_mode.c
83 history.o: history.c history.h
85 keymaps.o: emacs_keymap.c vi_keymap.c keymaps.h chardefs.h keymaps.c
87 libtest: libreadline.a libtest.c
88 $(CC) -o libtest $(CFLAGS) $(CPPFLAGS) -L. libtest.c -lreadline -ltermcap
90 readline: readline.c history.o keymaps.o funmap.o readline.h chardefs.h
91 $(CC) $(CFLAGS) $(CPPFLAGS) $(READLINE_DEFINES) \
92 $(LOCAL_INCLUDES) -DTEST -o readline readline.c funmap.o \
93 keymaps.o history.o -L. -ltermcap
95 readline.tar: $(THINGS_TO_TAR)
96 tar -cf readline.tar $(THINGS_TO_TAR)
98 readline.tar.Z: readline.tar
99 compress -f readline.tar
101 install: $(DESTDIR)/libreadline.a includes
104 if [ ! -r $(INCDIR)/readline ]; then\
105 mkdir $(INCDIR)/readline;\
106 chmod a+r $(INCDIR)/readline;\
108 $(INSTALL_FILE) readline.h keymaps.h chardefs.h $(INCDIR)/readline/
110 rm -f $(STAGESTUFF) *.a *.log *.cp *.tp *.vr *.fn *.aux *.pg *.toc
112 $(DESTDIR)/libreadline.a: libreadline.a
113 -mv $(DESTDIR)/libreadline.a $(DESTDIR)/libreadline.old
114 $(INSTALL_PROG) libreadline.a $(DESTDIR)/libreadline.a
115 $(RANLIB) -t $(DESTDIR)/libreadline.a
117 # Copy the object files from a particular stage into a subdirectory.
120 -mv $(STAGESTUFF) stage1
124 -mv $(STAGESTUFF) stage2
128 -mv $(STAGESTUFF) stage3
133 for i in $(STAGESTUFF) ; do cmp $$i $(against)/$$i ; done
136 - (cd stage1 ; mv -f * ..)
140 - (cd stage2 ; mv -f * ..)
144 - (cd stage3 ; mv -f * ..)
149 # with the gnu make, this is done automatically.
151 Makefile: $(srcdir)/Makefile.in $(srcdir)/configure
153 ./configure +destdir=$(destdir) +norecurse \
154 `if [ "$(srcdir)" != "." ] ; then echo +f; fi` \
155 $(host) +target=$(target))