1 ## -*- text -*- ####################################################
3 # Makefile for readline and history libraries. #
5 ####################################################################
10 #### host and target dependent Makefile fragments come in here.
13 # Here is a rule for making .o files from .c files that doesn't force
14 # the type of the machine (like -sun3) into the flags.
16 $(CC) -c $(CFLAGS) $(LOCAL_INCLUDES) $(CPPFLAGS) $(READLINE_DEFINES) $<
18 # Destination installation directory. The libraries are copied to DESTDIR
19 # when you do a `make install', and the header files to INCDIR/readline/*.h.
20 DESTDIR = $(destdir)/lib
21 INCDIR = $(destdir)/include
23 # Define TYPES as -DVOID_SIGHANDLER if your operating system uses
24 # a return type of "void" for signal handlers.
25 TYPES = -DVOID_SIGHANDLER
27 # Define SYSV as -DSYSV if you are using a System V operating system.
30 # HP-UX compilation requires the BSD library.
33 # Xenix compilation requires -ldir -lx
34 #LOCAL_LIBS = -ldir -lx
36 # Comment out "-DVI_MODE" if you don't think that anyone will ever desire
37 # the vi line editing mode and features.
38 READLINE_DEFINES = $(TYPES) -DVI_MODE
41 LDFLAGS = $(DEBUG_FLAGS)
42 CFLAGS = $(DEBUG_FLAGS) $(SYSV) -I.
44 # A good alternative is gcc -traditional.
45 #CC = gcc -traditional
53 LOCAL_INCLUDES = -I$(srcdir)/../
55 CSOURCES = readline.c history.c funmap.c keymaps.c vi_mode.c \
56 emacs_keymap.c vi_keymap.c
58 HSOURCES = readline.h chardefs.h history.h keymaps.h
59 SOURCES = $(CSOURCES) $(HSOURCES)
61 DOCUMENTATION = readline.texinfo inc-readline.texinfo \
62 history.texinfo inc-history.texinfo
64 SUPPORT = COPYING Makefile $(DOCUMENTATION) ChangeLog
66 THINGS_TO_TAR = $(SOURCES) $(SUPPORT)
68 ##########################################################################
70 STAGESTUFF = *.o *.a *.log *.cp *.tp *.vr *.fn *.aux *.pg *.toc
74 libreadline.a: readline.o history.o funmap.o keymaps.o
75 $(RM) -f libreadline.a
76 $(AR) $(AR_FLAGS) libreadline.a readline.o history.o funmap.o keymaps.o
77 $(RANLIB) libreadline.a
79 readline.o: readline.h chardefs.h keymaps.h history.h readline.c vi_mode.c
80 history.o: history.c history.h
82 keymaps.o: emacs_keymap.c vi_keymap.c keymaps.h chardefs.h keymaps.c
84 libtest: libreadline.a libtest.c
85 $(CC) -o libtest $(CFLAGS) $(CPPFLAGS) -L. libtest.c -lreadline -ltermcap
87 readline: readline.c history.o keymaps.o funmap.o readline.h chardefs.h
88 $(CC) $(CFLAGS) $(CPPFLAGS) $(READLINE_DEFINES) \
89 $(LOCAL_INCLUDES) -DTEST -o readline readline.c funmap.o \
90 keymaps.o history.o -L. -ltermcap
92 readline.tar: $(THINGS_TO_TAR)
93 tar -cf readline.tar $(THINGS_TO_TAR)
95 readline.tar.Z: readline.tar
96 compress -f readline.tar
98 install: $(DESTDIR)/libreadline.a includes
101 if [ ! -r $(INCDIR)/readline ]; then\
102 mkdir $(INCDIR)/readline;\
103 chmod a+r $(INCDIR)/readline;\
105 $(CP) readline.h keymaps.h chardefs.h $(INCDIR)/readline/
109 $(DESTDIR)/libreadline.a: libreadline.a
110 -mv $(DESTDIR)/libreadline.a $(DESTDIR)/libreadline.old
111 cp libreadline.a $(DESTDIR)/libreadline.a
112 $(RANLIB) -t $(DESTDIR)/libreadline.a
114 # Copy the object files from a particular stage into a subdirectory.
117 -mv $(STAGESTUFF) stage1
121 -mv $(STAGESTUFF) stage2
125 -mv $(STAGESTUFF) stage3
130 for i in $(STAGESTUFF) ; do cmp $$i $(against)/$$i ; done
133 - (cd stage1 ; mv -f * ..)
137 - (cd stage2 ; mv -f * ..)
141 - (cd stage3 ; mv -f * ..)
146 # with the gnu make, this is done automatically.
148 Makefile: $(srcdir)/Makefile.in $(srcdir)/configure
150 ./configure +destdir=$(destdir) +norecurse \
151 `if [ "$(srcdir)" != "." ] ; then echo +f; fi` \
152 $(host) +target=$(target))