| 1 |
## -*- text -*- #################################################### |
| 2 |
# # |
| 3 |
# Makefile for the GNU Readline and History Libraries. # |
| 4 |
# # |
| 5 |
#################################################################### |
| 6 |
|
| 7 |
# This Makefile is hand made from a template file, found in |
| 8 |
# ../template. Each library must provide several Makefile |
| 9 |
# targets: `all', `clean', `documentation', `install', and |
| 10 |
# `what-tar'. The `what-tar' target reports the names of the |
| 11 |
# files that need to be included in a tarfile to build the full |
| 12 |
# code and documentation for this library. |
| 13 |
|
| 14 |
# Please note that the values for INCLUDES, CC, AR, RM, CP, |
| 15 |
# RANLIB, and selfdir are passed in from ../Makefile, and do |
| 16 |
# not need to be defined here. |
| 17 |
|
| 18 |
# Here is a rule for making .o files from .c files that doesn't force |
| 19 |
# the type of the machine (like -sun3) into the flags. |
| 20 |
.c.o: |
| 21 |
$(CC) -c $(CFLAGS) $(INCLUDES) $(LOCAL_DEFINES) $(CPPFLAGS) $*.c |
| 22 |
|
| 23 |
# LOCAL_DEFINES are flags that are specific to this library. |
| 24 |
# Comment out "-DVI_MODE" if you don't think that anyone will ever desire |
| 25 |
# the vi line editing mode and features. Define -DUSG if you are using a |
| 26 |
# System V operating system. |
| 27 |
LOCAL_DEFINES = $(LOCAL_INCLUDES) -DVI_MODE #-DUSG |
| 28 |
|
| 29 |
# Some systems need to define this (like older NeXT systems) in order |
| 30 |
# to prevent namespace conflicts. |
| 31 |
CFLAGS = # -DSTATIC_MALLOC |
| 32 |
|
| 33 |
# For libraries which include headers from other libraries. |
| 34 |
LOCAL_INCLUDES = -I. -I../ |
| 35 |
|
| 36 |
# The name of the main library target. |
| 37 |
LIBRARY_NAME = libreadline.a |
| 38 |
|
| 39 |
# The C code source files for this library. |
| 40 |
CSOURCES = readline.c funmap.c keymaps.c vi_mode.c parens.c \ |
| 41 |
rltty.c complete.c bind.c isearch.c display.c signals.c \ |
| 42 |
emacs_keymap.c vi_keymap.c history.c tilde.c xmalloc.c |
| 43 |
|
| 44 |
# The header files for this library. |
| 45 |
HSOURCES = readline.h rldefs.h chardefs.h keymaps.h history.h \ |
| 46 |
posixstat.h tilde.h |
| 47 |
|
| 48 |
OBJECTS = readline.o vi_mode.o funmap.o keymaps.o parens.o search.o \ |
| 49 |
rltty.o complete.o bind.o isearch.o display.o signals.o \ |
| 50 |
history.o tilde.o xmalloc.o |
| 51 |
|
| 52 |
# The texinfo files which document this library. |
| 53 |
DOCSOURCE = doc/rlman.texinfo doc/rltech.texinfo doc/rluser.texinfo |
| 54 |
DOCOBJECT = doc/readline.dvi |
| 55 |
DOCSUPPORT = doc/Makefile |
| 56 |
DOCUMENTATION = $(DOCSOURCE) $(DOCOBJECT) $(DOCSUPPORT) |
| 57 |
|
| 58 |
SUPPORT = Makefile ChangeLog $(DOCSUPPORT) examples/[-a-z.]* |
| 59 |
|
| 60 |
SOURCES = $(CSOURCES) $(HSOURCES) $(DOCSOURCE) |
| 61 |
|
| 62 |
THINGS_TO_TAR = $(SOURCES) $(SUPPORT) |
| 63 |
|
| 64 |
########################################################################## |
| 65 |
|
| 66 |
all: libreadline.a libhistory.a |
| 67 |
|
| 68 |
libreadline.a: $(OBJECTS) |
| 69 |
$(RM) -f $@ |
| 70 |
$(AR) cq $@ $(OBJECTS) |
| 71 |
-if [ -f "$(RANLIB)" ]; then $(RANLIB) $@; fi |
| 72 |
|
| 73 |
libhistory.a: history.o |
| 74 |
$(RM) -f $@ |
| 75 |
$(AR) cq $@ history.o |
| 76 |
-if [ -f "$(RANLIB)" ]; then $(RANLIB) $@; fi |
| 77 |
|
| 78 |
what-tar: |
| 79 |
@for file in $(THINGS_TO_TAR); do \ |
| 80 |
echo $(selfdir)$$file; \ |
| 81 |
done |
| 82 |
|
| 83 |
documentation: force |
| 84 |
(cd doc; make) |
| 85 |
force: |
| 86 |
|
| 87 |
# The rule for 'includes' is written funny so that the if statement |
| 88 |
# always returns TRUE unless there really was an error installing the |
| 89 |
# include files. |
| 90 |
install: |
| 91 |
if [ -r $(incdir)/readline ]; then \ |
| 92 |
:; \ |
| 93 |
else \ |
| 94 |
mkdir $(incdir)/readline && chmod a+r $(incdir)/readline; \ |
| 95 |
fi |
| 96 |
$(CP) readline.h keymaps.h chardefs.h history.h $(incdir)/readline/ |
| 97 |
-mv $(bindir)/libreadline.a $(bindir)/libreadline.old |
| 98 |
cp libreadline.a $(bindir)/libreadline.a |
| 99 |
if [ -f "$(RANLIB)" ]; then $(RANLIB) -t $(bindir)/libreadline.a; fi |
| 100 |
|
| 101 |
clean: |
| 102 |
rm -f $(OBJECTS) *.a |
| 103 |
(cd doc; make clean) |
| 104 |
|
| 105 |
readline: readline.h rldefs.h chardefs.h |
| 106 |
readline: $(OBJECTS) |
| 107 |
$(CC) $(CFLAGS) $(CPPFLAGS) $(READLINE_DEFINES) \ |
| 108 |
$(LOCAL_INCLUDES) -DTEST -o readline readline.c vi_mode.o funmap.o \ |
| 109 |
keymaps.o -ltermcap |
| 110 |
|
| 111 |
readline.o: readline.c readline.h rldefs.h chardefs.h |
| 112 |
readline.o: keymaps.h history.h |
| 113 |
vi_mode.o: vi_mode.c |
| 114 |
funmap.o: funmap.c readline.h |
| 115 |
keymaps.o: keymaps.c emacs_keymap.c vi_keymap.c keymaps.h chardefs.h |