]>
Commit | Line | Data |
---|---|---|
bd5635a1 RP |
1 | ## -*- text -*- #################################################### |
2 | # # | |
3 | # Makefile for readline and history libraries. # | |
4 | # # | |
5 | #################################################################### | |
6 | ||
7da15eff RP |
7 | srcdir = . |
8 | destdir = /usr/local | |
9 | ||
7187e60c RP |
10 | INSTALL_PROG = install -c |
11 | INSTALL_FILE = $(INSTALL_PROG) | |
12 | ||
7da15eff RP |
13 | #### host and target dependent Makefile fragments come in here. |
14 | ## | |
15 | ||
bd5635a1 RP |
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. | |
7da15eff RP |
23 | DESTDIR = $(destdir)/lib |
24 | INCDIR = $(destdir)/include | |
bd5635a1 RP |
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 | |
7da15eff | 50 | RANLIB = /bin/ranlib |
bd5635a1 | 51 | AR = ar |
7da15eff | 52 | AR_FLAGS = clq |
bd5635a1 RP |
53 | RM = rm |
54 | CP = cp | |
55 | ||
7da15eff | 56 | LOCAL_INCLUDES = -I$(srcdir)/../ |
bd5635a1 RP |
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 | ||
502ef32a | 73 | STAGESTUFF = *.o |
7da15eff | 74 | |
bd5635a1 RP |
75 | all: libreadline.a |
76 | ||
77 | libreadline.a: readline.o history.o funmap.o keymaps.o | |
78 | $(RM) -f libreadline.a | |
7da15eff RP |
79 | $(AR) $(AR_FLAGS) libreadline.a readline.o history.o funmap.o keymaps.o |
80 | $(RANLIB) libreadline.a | |
bd5635a1 RP |
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 | |
7187e60c | 108 | $(INSTALL_FILE) readline.h keymaps.h chardefs.h $(INCDIR)/readline/ |
bd5635a1 | 109 | clean: |
502ef32a | 110 | rm -f $(STAGESTUFF) *.a *.log *.cp *.tp *.vr *.fn *.aux *.pg *.toc |
bd5635a1 RP |
111 | |
112 | $(DESTDIR)/libreadline.a: libreadline.a | |
113 | -mv $(DESTDIR)/libreadline.a $(DESTDIR)/libreadline.old | |
7187e60c | 114 | $(INSTALL_PROG) libreadline.a $(DESTDIR)/libreadline.a |
bd5635a1 | 115 | $(RANLIB) -t $(DESTDIR)/libreadline.a |
7da15eff RP |
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 | ||
30ba1dfe RP |
130 | against=stage2 |
131 | ||
132 | comparison: force | |
133 | for i in $(STAGESTUFF) ; do cmp $$i $(against)/$$i ; done | |
134 | ||
7da15eff RP |
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 |