]>
Commit | Line | Data |
---|---|---|
bd5635a1 RP |
1 | # # |
2 | # Makefile for readline and history libraries. # | |
3 | # # | |
bcb14db5 | 4 | |
bd5635a1 | 5 | |
7da15eff | 6 | srcdir = . |
c21b1b26 | 7 | ddestdir = /usr/local |
7da15eff | 8 | |
7187e60c RP |
9 | INSTALL_PROG = install -c |
10 | INSTALL_FILE = $(INSTALL_PROG) | |
11 | ||
7da15eff RP |
12 | #### host and target dependent Makefile fragments come in here. |
13 | ## | |
14 | ||
bd5635a1 RP |
15 | # Here is a rule for making .o files from .c files that doesn't force |
16 | # the type of the machine (like -sun3) into the flags. | |
17 | .c.o: | |
18 | $(CC) -c $(CFLAGS) $(LOCAL_INCLUDES) $(CPPFLAGS) $(READLINE_DEFINES) $< | |
19 | ||
20 | # Destination installation directory. The libraries are copied to DESTDIR | |
21 | # when you do a `make install', and the header files to INCDIR/readline/*.h. | |
c21b1b26 SC |
22 | DESTDIR = $(ddestdir)/lib |
23 | INCDIR = $(ddestdir)/include | |
bd5635a1 RP |
24 | |
25 | # Define TYPES as -DVOID_SIGHANDLER if your operating system uses | |
26 | # a return type of "void" for signal handlers. | |
27 | TYPES = -DVOID_SIGHANDLER | |
28 | ||
bd5635a1 RP |
29 | # HP-UX compilation requires the BSD library. |
30 | #LOCAL_LIBS = -lBSD | |
31 | ||
32 | # Xenix compilation requires -ldir -lx | |
33 | #LOCAL_LIBS = -ldir -lx | |
34 | ||
35 | # Comment out "-DVI_MODE" if you don't think that anyone will ever desire | |
36 | # the vi line editing mode and features. | |
37 | READLINE_DEFINES = $(TYPES) -DVI_MODE | |
38 | ||
c21b1b26 SC |
39 | MINUS_G=-g |
40 | DEBUG_FLAGS = $(MINUS_G) | |
bd5635a1 RP |
41 | LDFLAGS = $(DEBUG_FLAGS) |
42 | CFLAGS = $(DEBUG_FLAGS) $(SYSV) -I. | |
43 | ||
44 | # A good alternative is gcc -traditional. | |
45 | #CC = gcc -traditional | |
46 | CC = cc | |
7da15eff | 47 | RANLIB = /bin/ranlib |
bd5635a1 | 48 | AR = ar |
7da15eff | 49 | AR_FLAGS = clq |
bd5635a1 RP |
50 | RM = rm |
51 | CP = cp | |
52 | ||
7da15eff | 53 | LOCAL_INCLUDES = -I$(srcdir)/../ |
bd5635a1 RP |
54 | |
55 | CSOURCES = readline.c history.c funmap.c keymaps.c vi_mode.c \ | |
56 | emacs_keymap.c vi_keymap.c | |
57 | ||
58 | HSOURCES = readline.h chardefs.h history.h keymaps.h | |
59 | SOURCES = $(CSOURCES) $(HSOURCES) | |
60 | ||
fff3e61f RP |
61 | DOCUMENTATION = readline.texi inc-read.texi \ |
62 | history.texi inc-hist.texi | |
bd5635a1 RP |
63 | |
64 | SUPPORT = COPYING Makefile $(DOCUMENTATION) ChangeLog | |
65 | ||
66 | THINGS_TO_TAR = $(SOURCES) $(SUPPORT) | |
67 | ||
68 | ########################################################################## | |
69 | ||
502ef32a | 70 | STAGESTUFF = *.o |
7da15eff | 71 | |
fff3e61f RP |
72 | all: libreadline.a history.info readline.info |
73 | ||
74 | history.info: history.texi | |
75 | - $(MAKEINFO) -o history.info $(srcdir)/history.texi | |
76 | ||
77 | readline.info: readline.texi | |
78 | - $(MAKEINFO) -o readline.info $(srcdir)/readline.texi | |
bd5635a1 RP |
79 | |
80 | libreadline.a: readline.o history.o funmap.o keymaps.o | |
81 | $(RM) -f libreadline.a | |
7da15eff RP |
82 | $(AR) $(AR_FLAGS) libreadline.a readline.o history.o funmap.o keymaps.o |
83 | $(RANLIB) libreadline.a | |
bd5635a1 RP |
84 | |
85 | readline.o: readline.h chardefs.h keymaps.h history.h readline.c vi_mode.c | |
86 | history.o: history.c history.h | |
87 | funmap.o: readline.h | |
88 | keymaps.o: emacs_keymap.c vi_keymap.c keymaps.h chardefs.h keymaps.c | |
89 | ||
90 | libtest: libreadline.a libtest.c | |
91 | $(CC) -o libtest $(CFLAGS) $(CPPFLAGS) -L. libtest.c -lreadline -ltermcap | |
92 | ||
93 | readline: readline.c history.o keymaps.o funmap.o readline.h chardefs.h | |
94 | $(CC) $(CFLAGS) $(CPPFLAGS) $(READLINE_DEFINES) \ | |
95 | $(LOCAL_INCLUDES) -DTEST -o readline readline.c funmap.o \ | |
96 | keymaps.o history.o -L. -ltermcap | |
97 | ||
98 | readline.tar: $(THINGS_TO_TAR) | |
99 | tar -cf readline.tar $(THINGS_TO_TAR) | |
100 | ||
101 | readline.tar.Z: readline.tar | |
102 | compress -f readline.tar | |
103 | ||
fff3e61f RP |
104 | install: includes |
105 | $(INSTALL_PROG) libreadline.a $(DESTDIR)/libreadline.a.new | |
106 | -mv $(DESTDIR)/libreadline.a.new $(DESTDIR)/libreadline.a | |
107 | $(RANLIB) $(DESTDIR)/libreadline.a | |
108 | for i in *.info* ; do \ | |
109 | echo Installing $$i... ; \ | |
110 | (cp $$i $(idestdir)/info/$$i.new \ | |
111 | && mv -f $(idestdir)/info/$$i.new $(idestdir)/info/$$i) \ | |
112 | || exit 1 ; \ | |
113 | done | |
bd5635a1 RP |
114 | |
115 | includes: | |
116 | if [ ! -r $(INCDIR)/readline ]; then\ | |
117 | mkdir $(INCDIR)/readline;\ | |
118 | chmod a+r $(INCDIR)/readline;\ | |
119 | fi | |
bcb14db5 RP |
120 | $(INSTALL_FILE) $(srcdir)/readline.h $(INCDIR)/readline/ |
121 | $(INSTALL_FILE) $(srcdir)/keymaps.h $(INCDIR)/readline/ | |
122 | $(INSTALL_FILE) $(srcdir)/chardefs.h $(INCDIR)/readline/ | |
bd5635a1 | 123 | clean: |
fff3e61f RP |
124 | rm -f $(STAGESTUFF) *.a *.log *.cp *.tp *.vr *.fn |
125 | rm -f *.aux *.pg *.toc *.info* | |
bd5635a1 RP |
126 | |
127 | $(DESTDIR)/libreadline.a: libreadline.a | |
7da15eff RP |
128 | |
129 | # Copy the object files from a particular stage into a subdirectory. | |
130 | stage1: force | |
131 | -mkdir stage1 | |
132 | -mv $(STAGESTUFF) stage1 | |
133 | ||
134 | stage2: force | |
135 | -mkdir stage2 | |
136 | -mv $(STAGESTUFF) stage2 | |
137 | ||
138 | stage3: force | |
139 | -mkdir stage3 | |
140 | -mv $(STAGESTUFF) stage3 | |
141 | ||
30ba1dfe RP |
142 | against=stage2 |
143 | ||
144 | comparison: force | |
145 | for i in $(STAGESTUFF) ; do cmp $$i $(against)/$$i ; done | |
146 | ||
7da15eff RP |
147 | de-stage1: force |
148 | - (cd stage1 ; mv -f * ..) | |
149 | - rmdir stage1 | |
150 | ||
151 | de-stage2: force | |
152 | - (cd stage2 ; mv -f * ..) | |
153 | - rmdir stage2 | |
154 | ||
155 | de-stage3: force | |
156 | - (cd stage3 ; mv -f * ..) | |
157 | - rmdir stage3 | |
158 | ||
159 | force: | |
160 | ||
161 | # with the gnu make, this is done automatically. | |
162 | ||
c21b1b26 | 163 | Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag) |
bcb14db5 | 164 | $(SHELL) ./config.status |