1## -*- text -*- #################################################### 2# # 3# Makefile for readline and history libraries. # 4# # 5#################################################################### 6 7# Here is a rule for making .o files from .c files that doesn't force 8# the type of the machine (like -sun3) into the flags. 9.c.o: 10 $(CC) -c $(CFLAGS) $(LOCAL_INCLUDES) $(CPPFLAGS) $*.c 11 12# Destination installation directory. The libraries are copied to DESTDIR 13# when you do a `make install', and the header files to INCDIR/readline/*.h. 14DESTDIR = /usr/local/lib 15INCDIR = /usr/local/include 16 17# Define TYPES as -DVOID_SIGHANDLER if your operating system uses 18# a return type of "void" for signal handlers. 19TYPES = -DVOID_SIGHANDLER 20 21# Define USG as -DUSG if you are using a System V operating system. 22#USG = -DUSG 23 24# HP-UX compilation requires the BSD library. 25#LOCAL_LIBS = -lBSD 26 27# Xenix compilation requires -ldir -lx 28#LOCAL_LIBS = -ldir -lx 29 30# Comment out "-DVI_MODE" if you don't think that anyone will ever desire 31# the vi line editing mode and features. 32# READLINE_DEFINES = $(TYPES) -DVI_MODE 33READLINE_DEFINES = $(TYPES) 34 35DEBUG_FLAGS = -g 36LDFLAGS = $(DEBUG_FLAGS) 37CFLAGS = $(DEBUG_FLAGS) $(USG) -I. 38 39# A good alternative is gcc -traditional. 40#CC = gcc -traditional 41CC = cc 42RANLIB = /usr/bin/ranlib 43AR = ar 44RM = rm 45CP = cp 46 47LOCAL_INCLUDES = -I../ 48 49CSOURCES = readline.c history.c funmap.c keymaps.c vi_mode.c \ 50 emacs_keymap.c vi_keymap.c 51 52HSOURCES = readline.h chardefs.h history.h keymaps.h 53SOURCES = $(CSOURCES) $(HSOURCES) 54 55DOCSOURCE = doc/rlman.texinfo doc/rltech.texinfo doc/rluser.texinfo \ 56 doc/hist.texinfo doc/hsuser.texinfo doc/hstech.texinfo 57DOCOBJECT = doc/readline.dvi doc/history.dvi 58DOCSUPPORT = doc/Makefile doc/texinfo.tex 59DOCUMENTATION = $(DOCSOURCE) $(DOCOBJECT) $(DOCSUPPORT) 60 61SUPPORT = COPYING Makefile $(DOCUMENTATION) ChangeLog examples 62 63THINGS_TO_TAR = $(SOURCES) $(SUPPORT) 64 65########################################################################## 66 67all: libreadline.a 68 69libreadline.a: readline.o history.o funmap.o keymaps.o 70 $(RM) -f libreadline.a 71 $(AR) clq libreadline.a readline.o history.o funmap.o keymaps.o 72 -if [ -f $(RANLIB) ]; then $(RANLIB) libreadline.a; fi 73 74readline.o: readline.c readline.h chardefs.h keymaps.h history.h vi_mode.c 75 $(CC) -c $(CFLAGS) $(CPPFLAGS) $(READLINE_DEFINES) \ 76 $(LOCAL_INCLUDES) $*.c 77 78history.o: history.c history.h 79 $(CC) -c $(CFLAGS) $(CPPFLAGS) $(READLINE_DEFINES) \ 80 $(LOCAL_INCLUDES) $*.c 81 82funmap.o: funmap.c readline.h 83 $(CC) -c $(CFLAGS) $(CPPFLAGS) $(READLINE_DEFINES) \ 84 $(LOCAL_INCLUDES) $*.c 85 86keymaps.o: keymaps.c emacs_keymap.c vi_keymap.c keymaps.h chardefs.h 87 $(CC) -c $(CFLAGS) $(CPPFLAGS) $(READLINE_DEFINES) \ 88 $(LOCAL_INCLUDES) $*.c 89 90libtest: libreadline.a libtest.c 91 $(CC) -o libtest $(CFLAGS) $(CPPFLAGS) \ 92 -L. libtest.c -lreadline -ltermcap 93 94readline: readline.c history.o keymaps.o funmap.o readline.h chardefs.h 95 $(CC) $(CFLAGS) $(CPPFLAGS) $(READLINE_DEFINES) \ 96 $(LOCAL_INCLUDES) -DTEST -o readline readline.c funmap.o \ 97 keymaps.o history.o -L. -ltermcap 98 99documentation: force 100 (cd doc; make) 101force: 102 103readline.tar: $(THINGS_TO_TAR) 104 tar -cf readline.tar $(THINGS_TO_TAR) 105 106readline.tar.Z: readline.tar 107 compress -f readline.tar 108 109install: $(DESTDIR)/libreadline.a includes 110 111# The rule for 'includes' is written funny so that the if statement 112# always returns TRUE unless there really was an error installing the 113# include files. 114includes: 115 if [ -r $(INCDIR)/readline ]; then \ 116 :; \ 117 else \ 118 mkdir $(INCDIR)/readline && chmod a+r $(INCDIR)/readline; \ 119 fi 120 $(CP) readline.h keymaps.h chardefs.h $(INCDIR)/readline/ 121clean: 122 rm -f *.o *.a 123 (cd doc; make clean) 124 125$(DESTDIR)/libreadline.a: libreadline.a 126 -mv $(DESTDIR)/libreadline.a $(DESTDIR)/libreadline.old 127 cp libreadline.a $(DESTDIR)/libreadline.a 128 if [ -f $(RANLIB) ]; then $(RANLIB) -t $(DESTDIR)/libreadline.a; fi 129