Polishing install.
[external/binutils.git] / readline / Makefile.in
1 ## -*- text -*- ####################################################
2 #                                                                  #
3 # Makefile for readline and history libraries.                     #
4 #                                                                  #
5 ####################################################################
6
7 srcdir = .
8 destdir = /usr/local
9
10 INSTALL_PROG = install -c
11 INSTALL_FILE = $(INSTALL_PROG)
12
13 #### host and target dependent Makefile fragments come in here.
14 ##
15
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.
18 .c.o:
19         $(CC) -c $(CFLAGS) $(LOCAL_INCLUDES) $(CPPFLAGS) $(READLINE_DEFINES) $<
20
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
25
26 # Define TYPES as -DVOID_SIGHANDLER if your operating system uses
27 # a return type of "void" for signal handlers.
28 TYPES = -DVOID_SIGHANDLER
29
30 # Define SYSV as -DSYSV if you are using a System V operating system.
31 #SYSV = -DSYSV
32
33 # HP-UX compilation requires the BSD library.
34 #LOCAL_LIBS = -lBSD
35
36 # Xenix compilation requires -ldir -lx
37 #LOCAL_LIBS = -ldir -lx
38
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
42
43 DEBUG_FLAGS = -g
44 LDFLAGS = $(DEBUG_FLAGS) 
45 CFLAGS = $(DEBUG_FLAGS) $(SYSV) -I.
46
47 # A good alternative is gcc -traditional.
48 #CC = gcc -traditional
49 CC = cc
50 RANLIB = /bin/ranlib
51 AR = ar
52 AR_FLAGS = clq
53 RM = rm
54 CP = cp
55
56 LOCAL_INCLUDES = -I$(srcdir)/../
57
58 CSOURCES = readline.c history.c funmap.c keymaps.c vi_mode.c \
59            emacs_keymap.c vi_keymap.c
60
61 HSOURCES = readline.h chardefs.h history.h keymaps.h
62 SOURCES  = $(CSOURCES) $(HSOURCES)
63
64 DOCUMENTATION = readline.texinfo inc-readline.texinfo \
65                 history.texinfo inc-history.texinfo
66
67 SUPPORT = COPYING Makefile $(DOCUMENTATION) ChangeLog
68
69 THINGS_TO_TAR = $(SOURCES) $(SUPPORT)
70
71 ##########################################################################
72
73 STAGESTUFF = *.o
74
75 all: libreadline.a
76
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
81
82 readline.o:     readline.h chardefs.h  keymaps.h history.h readline.c vi_mode.c
83 history.o:      history.c history.h
84 funmap.o:       readline.h
85 keymaps.o:      emacs_keymap.c vi_keymap.c keymaps.h chardefs.h keymaps.c
86
87 libtest:        libreadline.a libtest.c
88                 $(CC) -o libtest $(CFLAGS) $(CPPFLAGS) -L. libtest.c -lreadline -ltermcap
89
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
94
95 readline.tar:   $(THINGS_TO_TAR)
96                 tar -cf readline.tar $(THINGS_TO_TAR)
97
98 readline.tar.Z: readline.tar
99                 compress -f readline.tar
100
101 install:        $(DESTDIR)/libreadline.a includes
102
103 includes:
104                 if [ ! -r $(INCDIR)/readline ]; then\
105                  mkdir $(INCDIR)/readline;\
106                  chmod a+r $(INCDIR)/readline;\
107                 fi
108                 $(INSTALL_FILE) readline.h keymaps.h chardefs.h $(INCDIR)/readline/
109 clean:
110                 rm -f $(STAGESTUFF) *.a *.log *.cp *.tp *.vr *.fn *.aux *.pg *.toc
111
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
116
117 # Copy the object files from a particular stage into a subdirectory.
118 stage1: force
119         -mkdir stage1
120         -mv $(STAGESTUFF) stage1
121
122 stage2: force
123         -mkdir stage2
124         -mv $(STAGESTUFF) stage2
125
126 stage3: force
127         -mkdir stage3
128         -mv $(STAGESTUFF) stage3
129
130 against=stage2
131
132 comparison: force
133         for i in $(STAGESTUFF) ; do cmp $$i $(against)/$$i ; done
134
135 de-stage1: force
136         - (cd stage1 ; mv -f * ..)
137         - rmdir stage1
138
139 de-stage2: force
140         - (cd stage2 ; mv -f * ..)
141         - rmdir stage2
142
143 de-stage3: force
144         - (cd stage3 ; mv -f * ..)
145         - rmdir stage3
146
147 force:
148
149 # with the gnu make, this is done automatically.
150
151 Makefile: $(srcdir)/Makefile.in $(srcdir)/configure
152         (cd $(srcdir) ; \
153                 ./configure +destdir=$(destdir) +norecurse \
154                  `if [ "$(srcdir)" != "." ] ; then echo +f; fi` \
155                 $(host) +target=$(target))
156