Commit | Line | Data |
---|---|---|
bd5635a1 RP |
1 | # # |
2 | # Makefile for readline and history libraries. # | |
3 | # # | |
bcb14db5 | 4 | |
bd5635a1 | 5 | |
7da15eff RP |
6 | srcdir = . |
7 | destdir = /usr/local | |
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. | |
7da15eff RP |
22 | DESTDIR = $(destdir)/lib |
23 | INCDIR = $(destdir)/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 | ||
39 | DEBUG_FLAGS = -g | |
40 | LDFLAGS = $(DEBUG_FLAGS) | |
41 | CFLAGS = $(DEBUG_FLAGS) $(SYSV) -I. | |
42 | ||
43 | # A good alternative is gcc -traditional. | |
44 | #CC = gcc -traditional | |
45 | CC = cc | |
7da15eff | 46 | RANLIB = /bin/ranlib |
bd5635a1 | 47 | AR = ar |
7da15eff | 48 | AR_FLAGS = clq |
bd5635a1 RP |
49 | RM = rm |
50 | CP = cp | |
51 | ||
7da15eff | 52 | LOCAL_INCLUDES = -I$(srcdir)/../ |
bd5635a1 RP |
53 | |
54 | CSOURCES = readline.c history.c funmap.c keymaps.c vi_mode.c \ | |
55 | emacs_keymap.c vi_keymap.c | |
56 | ||
57 | HSOURCES = readline.h chardefs.h history.h keymaps.h | |
58 | SOURCES = $(CSOURCES) $(HSOURCES) | |
59 | ||
60 | DOCUMENTATION = readline.texinfo inc-readline.texinfo \ | |
61 | history.texinfo inc-history.texinfo | |
62 | ||
63 | SUPPORT = COPYING Makefile $(DOCUMENTATION) ChangeLog | |
64 | ||
65 | THINGS_TO_TAR = $(SOURCES) $(SUPPORT) | |
66 | ||
67 | ########################################################################## | |
68 | ||
502ef32a | 69 | STAGESTUFF = *.o |
7da15eff | 70 | |
bd5635a1 RP |
71 | all: libreadline.a |
72 | ||
73 | libreadline.a: readline.o history.o funmap.o keymaps.o | |
74 | $(RM) -f libreadline.a | |
7da15eff RP |
75 | $(AR) $(AR_FLAGS) libreadline.a readline.o history.o funmap.o keymaps.o |
76 | $(RANLIB) libreadline.a | |
bd5635a1 RP |
77 | |
78 | readline.o: readline.h chardefs.h keymaps.h history.h readline.c vi_mode.c | |
79 | history.o: history.c history.h | |
80 | funmap.o: readline.h | |
81 | keymaps.o: emacs_keymap.c vi_keymap.c keymaps.h chardefs.h keymaps.c | |
82 | ||
83 | libtest: libreadline.a libtest.c | |
84 | $(CC) -o libtest $(CFLAGS) $(CPPFLAGS) -L. libtest.c -lreadline -ltermcap | |
85 | ||
86 | readline: readline.c history.o keymaps.o funmap.o readline.h chardefs.h | |
87 | $(CC) $(CFLAGS) $(CPPFLAGS) $(READLINE_DEFINES) \ | |
88 | $(LOCAL_INCLUDES) -DTEST -o readline readline.c funmap.o \ | |
89 | keymaps.o history.o -L. -ltermcap | |
90 | ||
91 | readline.tar: $(THINGS_TO_TAR) | |
92 | tar -cf readline.tar $(THINGS_TO_TAR) | |
93 | ||
94 | readline.tar.Z: readline.tar | |
95 | compress -f readline.tar | |
96 | ||
97 | install: $(DESTDIR)/libreadline.a includes | |
98 | ||
99 | includes: | |
100 | if [ ! -r $(INCDIR)/readline ]; then\ | |
101 | mkdir $(INCDIR)/readline;\ | |
102 | chmod a+r $(INCDIR)/readline;\ | |
103 | fi | |
bcb14db5 RP |
104 | $(INSTALL_FILE) $(srcdir)/readline.h $(INCDIR)/readline/ |
105 | $(INSTALL_FILE) $(srcdir)/keymaps.h $(INCDIR)/readline/ | |
106 | $(INSTALL_FILE) $(srcdir)/chardefs.h $(INCDIR)/readline/ | |
bd5635a1 | 107 | clean: |
502ef32a | 108 | rm -f $(STAGESTUFF) *.a *.log *.cp *.tp *.vr *.fn *.aux *.pg *.toc |
bd5635a1 RP |
109 | |
110 | $(DESTDIR)/libreadline.a: libreadline.a | |
111 | -mv $(DESTDIR)/libreadline.a $(DESTDIR)/libreadline.old | |
7187e60c | 112 | $(INSTALL_PROG) libreadline.a $(DESTDIR)/libreadline.a |
bcb14db5 | 113 | $(RANLIB) $(DESTDIR)/libreadline.a |
7da15eff RP |
114 | |
115 | # Copy the object files from a particular stage into a subdirectory. | |
116 | stage1: force | |
117 | -mkdir stage1 | |
118 | -mv $(STAGESTUFF) stage1 | |
119 | ||
120 | stage2: force | |
121 | -mkdir stage2 | |
122 | -mv $(STAGESTUFF) stage2 | |
123 | ||
124 | stage3: force | |
125 | -mkdir stage3 | |
126 | -mv $(STAGESTUFF) stage3 | |
127 | ||
30ba1dfe RP |
128 | against=stage2 |
129 | ||
130 | comparison: force | |
131 | for i in $(STAGESTUFF) ; do cmp $$i $(against)/$$i ; done | |
132 | ||
7da15eff RP |
133 | de-stage1: force |
134 | - (cd stage1 ; mv -f * ..) | |
135 | - rmdir stage1 | |
136 | ||
137 | de-stage2: force | |
138 | - (cd stage2 ; mv -f * ..) | |
139 | - rmdir stage2 | |
140 | ||
141 | de-stage3: force | |
142 | - (cd stage3 ; mv -f * ..) | |
143 | - rmdir stage3 | |
144 | ||
145 | force: | |
146 | ||
147 | # with the gnu make, this is done automatically. | |
148 | ||
bcb14db5 RP |
149 | Makefile: $(srcdir)/Makefile.in $(srcdir)/configure $(host_makefile_frag) $(target_makefile_frag) |
150 | $(SHELL) ./config.status |