*** empty log message ***
[bpt/emacs.git] / lib-src / Makefile.in
1 # Makefile for lib-src subdirectory in GNU Emacs.
2 # Copyright (C) 1985, 1987, 1988, 1993, 1994 Free Software Foundation, Inc.
3
4 # This file is part of GNU Emacs.
5
6 # GNU Emacs is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2, or (at your option)
9 # any later version.
10
11 # GNU Emacs is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15
16 # You should have received a copy of the GNU General Public License
17 # along with GNU Emacs; see the file COPYING. If not, write to
18 # the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 # Boston, MA 02111-1307, USA.
20
21 # Avoid trouble on systems where the `SHELL' variable might be
22 # inherited from the environment.
23 SHELL = /bin/sh
24
25 # ==================== Things `configure' will edit ====================
26
27 CC=@CC@
28 CFLAGS=@CFLAGS@
29 ALLOCA=@ALLOCA@
30 YACC=@YACC@
31 version=@version@
32 configuration=@configuration@
33
34 # Program name transformation.
35 TRANSFORM = @program_transform_name@
36
37 # ==================== Where To Install Things ====================
38
39 # The default location for installation. Everything is placed in
40 # subdirectories of this directory. The default values for many of
41 # the variables below are expressed in terms of this one, so you may
42 # not need to change them. This is set with the --prefix option to
43 # `../configure'.
44 prefix=@prefix@
45
46 # Like `prefix', but used for architecture-specific files. This is
47 # set with the --exec-prefix option to `../configure'.
48 exec_prefix=@exec_prefix@
49
50 # Where to install Emacs and other binaries that people will want to
51 # run directly (like etags). This is set with the --bindir option
52 # to `../configure'.
53 bindir=@bindir@
54
55 # Where to install and expect executable files to be run by Emacs
56 # rather than directly by users, and other architecture-dependent
57 # data. ${archlibdir} is usually below this. This is set with the
58 # --libexecdir option to `../configure'.
59 libexecdir=@libexecdir@
60
61 # Where to find the source code. This is set by the configure
62 # script's `--srcdir' option. However, the value of ${srcdir} in
63 # this makefile is not identical to what was specified with --srcdir,
64 # since the variable here has `/lib-src' added at the end.
65
66 # We use $(srcdir) explicitly in dependencies so as not to depend on VPATH.
67 srcdir=@srcdir@
68 VPATH=@srcdir@
69
70 # The top-level source directory, also set by configure.
71 top_srcdir=@top_srcdir@
72
73 # ==================== Emacs-specific directories ====================
74
75 # These variables hold the values Emacs will actually use. They are
76 # based on the values of the standard Make variables above.
77
78 # Where to put executables to be run by Emacs rather than the user.
79 # This path usually includes the Emacs version and configuration name,
80 # so that multiple configurations for multiple versions of Emacs may
81 # be installed at once. This can be set with the --archlibdir option
82 # to `../configure'.
83 archlibdir=@archlibdir@
84
85 # ==================== Utility Programs for the Build =================
86
87 # ../configure figures out the correct values for these.
88 INSTALL = @INSTALL@
89 INSTALL_PROGRAM = @INSTALL_PROGRAM@
90 INSTALL_DATA = @INSTALL_DATA@
91 # By default, we uphold the dignity of our programs.
92 INSTALL_STRIP =
93
94 # ========================== Lists of Files ===========================
95
96 # Things that a user might actually run,
97 # which should be installed in bindir.
98 INSTALLABLES = etags ctags emacsclient b2m ebrowse
99 INSTALLABLE_SCRIPTS = rcs-checkin grep-changelog
100
101 # Things that Emacs runs internally, or during the build process,
102 # which should not be installed in bindir.
103 UTILITIES= profile digest-doc \
104 sorted-doc movemail cvtmail fakemail yow emacsserver hexl
105
106 DONT_INSTALL= test-distrib make-docfile
107
108 # Like UTILITIES, but they're not system-dependent, and should not be
109 # deleted by the distclean target.
110 SCRIPTS= rcs2log vcdiff
111
112 EXECUTABLES= ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}
113
114 SOURCES = COPYING ChangeLog Makefile.in README emacs.csh \
115 makedoc.com *.[chy] rcs2log vcdiff
116
117 # Additional -D flags for movemail (add to MOVE_FLAGS if desired):
118 # MAIL_USE_POP Support mail retrieval from a POP mailbox.
119 # MAIL_USE_MMDF Support MMDF mailboxes.
120 # MAIL_USE_FLOCK Use flock for file locking (see the comments
121 # about locking in movemail.c)
122 # MAIL_UNLINK_SPOOL Unlink the user's spool mailbox after reading
123 # it (instead of just emptying it).
124 # KERBEROS Support Kerberized POP.
125 # KRB5 Support Kerberos Version 5 pop instead of
126 # Version 4 (define this in addition to
127 # KERBEROS).
128 # HESIOD Support Hesiod lookups of user mailboxes.
129 # MAILHOST A string, the host name of the default POP
130 # mail host for the site.
131 MOVE_FLAGS=
132
133 # ========================== start of cpp stuff =======================
134 /* From here on, comments must be done in C syntax. */
135
136 #define NO_SHORTNAMES
137 #define THIS_IS_MAKEFILE
138 #define NOT_C_CODE
139 #include "../src/config.h"
140
141 /* We won't really call alloca;
142 don't let the file name alloca.c get messed up. */
143 #ifdef alloca
144 #undef alloca
145 #endif
146
147 /* Some machines don't find the standard C libraries in the usual place. */
148 #ifndef ORDINARY_LINK
149 #ifndef LIB_STANDARD_LIBSRC
150 #define LIB_STANDARD_LIBSRC -lc
151 #endif
152 #else
153 #ifndef LIB_STANDARD_LIBSRC
154 #define LIB_STANDARD_LIBSRC
155 #endif
156 #endif
157
158 /* Some s/SYSTEM.h files define this to request special libraries. */
159 #ifndef LIBS_SYSTEM
160 #define LIBS_SYSTEM
161 #endif
162
163 /* Some m/MACHINE.h files define this to request special libraries. */
164 #ifndef LIBS_MACHINE
165 #define LIBS_MACHINE
166 #endif
167
168 #ifndef C_SWITCH_SYSTEM
169 #define C_SWITCH_SYSTEM
170 #endif
171
172 #ifndef C_SWITCH_MACHINE
173 #define C_SWITCH_MACHINE
174 #endif
175
176 #undef MOVEMAIL_NEEDS_BLESSING
177 #ifndef MAIL_USE_FLOCK
178 #ifndef MAIL_USE_LOCKF
179 #define MOVEMAIL_NEEDS_BLESSING
180 #endif
181 #endif
182
183 #ifdef MOVEMAIL_NEEDS_BLESSING
184 #define BLESSMAIL blessmail
185 #else
186 #define BLESSMAIL
187 #endif
188
189 #ifdef KERBEROS
190 # ifdef HAVE_LIBKRB
191 KRB4LIB = -lkrb
192 # else
193 # ifdef HAVE_LIBKRB4
194 KRB4LIB = -lkrb4
195 # endif
196 # endif
197 # ifdef HAVE_LIBDES
198 DESLIB = -ldes
199 # else
200 # ifdef HAVE_LIBDES425
201 DESLIB = -ldes425
202 # endif
203 # endif
204 # ifdef HAVE_LIBKRB5
205 KRB5LIB = -lkrb5
206 # endif
207 # ifdef HAVE_LIBK5CRYPTO
208 CRYPTOLIB = -lk5crypto
209 # else
210 # ifdef HAVE_LIBCRYPTO
211 CRYPTOLIB = -lcrypto
212 # endif
213 # endif
214 # ifdef HAVE_LIBCOM_ERR
215 COM_ERRLIB = -lcom_err
216 # endif
217 #endif /* KERBEROS */
218
219 /* If HESIOD is defined, set this to "-lhesiod". */
220 #ifdef HAVE_LIBHESIOD
221 # ifdef HAVE_LIBRESOLV
222 HESIODLIB= -lhesiod -lresolv
223 # else
224 HESIODLIB= -lhesiod
225 # endif
226 #endif
227
228 MOVE_LIBS=$(KRB4LIB) $(DESLIB) $(KRB5LIB) $(CRYPTOLIB) $(COM_ERRLIB) $(HESIODLIB)
229
230 #ifdef HAVE_LIBMAIL
231 LIBMAIL=-lmail
232 #endif
233
234 LOADLIBES=LIBS_SYSTEM LIBS_MACHINE LIB_STANDARD_LIBSRC
235
236 /* We need to #define emacs to get the right versions of some files.
237 Some other files - those shared with other GNU utilities - need
238 HAVE_CONFIG_H #defined before they know they can take advantage of
239 the information in ../src/config.h. */
240 ALL_CFLAGS = C_SWITCH_SYSTEM C_SWITCH_MACHINE -DHAVE_CONFIG_H \
241 -I. -I../src -I${srcdir} -I${srcdir}/../src ${LDFLAGS} ${CPPFLAGS} ${CFLAGS}
242 LINK_CFLAGS = C_SWITCH_SYSTEM C_SWITCH_MACHINE -DHAVE_CONFIG_H \
243 -I. -I../src -I${srcdir} -I${srcdir}/../src ${LDFLAGS} ${CFLAGS}
244 CPP_CFLAGS = C_SWITCH_SYSTEM C_SWITCH_MACHINE -DHAVE_CONFIG_H \
245 -I. -I../src -I${srcdir} -I${srcdir}/../src ${CPPFLAGS} ${CFLAGS}
246 /* This was all of CPP_CFLAGS except -Demacs.
247 Now that -Demacs has been deleted from CPP_CFLAGS,
248 this is actually the same as CPP_CFLAGS, but let's not delete it yet. */
249 BASE_CFLAGS = C_SWITCH_SYSTEM C_SWITCH_MACHINE -DHAVE_CONFIG_H \
250 -I. -I../src -I${srcdir} -I${srcdir}/../src ${CPPFLAGS} ${CFLAGS}
251 \f
252 /* This is the default compilation command.
253 But we should never rely on it, because some make version
254 failed to find it for getopt.o.
255 Using an explicit command made it work. */
256 .c.o:
257 ${CC} -c ${CPP_CFLAGS} $<
258
259 all: ${DONT_INSTALL} ${UTILITIES} ${INSTALLABLES}
260
261 #ifdef MOVEMAIL_NEEDS_BLESSING
262 blessmail:
263 ../src/emacs -batch -l $(srcdir)/../lisp/mail/blessmail.el
264 chmod +x blessmail
265 #endif
266
267 maybe-blessmail: BLESSMAIL
268 #ifdef MOVEMAIL_NEEDS_BLESSING
269 /* Don't charge ahead and do it! Let the installer decide.
270 ./blessmail ${archlibdir}/movemail */
271 @if [ `wc -l <blessmail` != 2 ] ; then \
272 dir=`sed -n -e 's/echo mail directory = \(.*\)/\1/p' blessmail`; \
273 echo Assuming $$dir is really the mail spool directory, you should; \
274 echo run lib-src/blessmail ${archlibdir}/movemail; \
275 echo as root, to give movemail appropriate permissions.; \
276 echo Do that after running make install.; \
277 fi
278 #endif
279
280 /* Install the internal utilities. Until they are installed, we can
281 just run them directly from lib-src. */
282 ${archlibdir}: all
283 @echo
284 @echo "Installing utilities run internally by Emacs."
285 $(top_srcdir)/mkinstalldirs ${archlibdir}
286 if [ `(cd ${archlibdir} && /bin/pwd)` != `/bin/pwd` ]; then \
287 for file in ${UTILITIES}; do \
288 $(INSTALL_PROGRAM) $(INSTALL_STRIP) $$file ${archlibdir}/$$file ; \
289 done ; \
290 fi
291 if [ `(cd ${archlibdir} && /bin/pwd)` \
292 != `(cd ${srcdir} && /bin/pwd)` ]; then \
293 for file in ${SCRIPTS}; do \
294 $(INSTALL_PROGRAM) ${srcdir}/$$file ${archlibdir}/$$file; \
295 done ; \
296 fi
297
298 install: ${archlibdir}
299 @echo
300 @echo "Installing utilities for users to run."
301 for file in ${INSTALLABLES} ; do \
302 $(INSTALL_PROGRAM) $(INSTALL_STRIP) $${file} ${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \
303 chmod a+rx ${bindir}/`echo $${file} | sed '$(TRANSFORM)'`; \
304 done
305 for file in ${INSTALLABLE_SCRIPTS} ; do \
306 $(INSTALL_PROGRAM) ${srcdir}/$${file} ${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \
307 chmod a+rx ${bindir}/`echo $${file} | sed '$(TRANSFORM)'`; \
308 done
309
310 uninstall:
311 (cd ${bindir}; \
312 for file in ${INSTALLABLES} ${INSTALLABLE_SCRIPTS}; do \
313 rm -f ${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \
314 done)
315 (cd ${archlibdir}; \
316 rm -f ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS})
317
318 mostlyclean:
319 -rm -f core *.o
320
321 clean: mostlyclean
322 -rm -f ${INSTALLABLES} ${UTILITIES} ${DONT_INSTALL}
323 -rm -f fns*.el *.tab.c *.tab.h
324
325 distclean: clean
326 -rm -f TAGS
327 -rm -f Makefile Makefile.c blessmail
328
329 maintainer-clean: distclean
330 true
331
332 extraclean: maintainer-clean
333 -rm -f *~ \#*
334
335 unlock:
336 chmod u+w $(SOURCES)
337
338 relock:
339 chmod u-w $(SOURCES)
340
341 /* Test the contents of the directory. */
342 check:
343 @echo "We don't have any tests for GNU Emacs yet."
344
345 tags: TAGS
346 TAGS: etags
347 etags *.[ch]
348
349 /* This verifies that the non-ASCII characters in the file `testfile'
350 have not been clobbered by whatever means were used to copy and
351 distribute Emacs. If they were clobbered, all the .elc files were
352 clobbered too. */
353 test-distrib: ${srcdir}/test-distrib.c
354 $(CC) ${ALL_CFLAGS} -o test-distrib ${srcdir}/test-distrib.c
355 ./test-distrib ${srcdir}/testfile
356
357 GETOPTOBJS = getopt.o getopt1.o $(ALLOCA)
358 GETOPTDEPS = $(GETOPTOBJS) ${srcdir}/getopt.h
359 getopt.o: ${srcdir}/getopt.c ${srcdir}/getopt.h
360 ${CC} -c ${CPP_CFLAGS} ${srcdir}/getopt.c
361 getopt1.o: ${srcdir}/getopt1.c ${srcdir}/getopt.h
362 ${CC} -c ${CPP_CFLAGS} ${srcdir}/getopt1.c
363 alloca.o: ${srcdir}/alloca.c
364 ${CC} -Demacs -c ${BASE_CFLAGS} ${srcdir}/alloca.c
365
366 #ifdef REGEXP_IN_LIBC
367 REGEXPOBJ =
368 REGEXPDEPS =
369 #else
370 REGEXPOBJ = regex.o
371 REGEXPDEPS = $(REGEXPOBJ) $(srcdir)/../src/regex.h
372 #endif
373
374 regex.o: $(srcdir)/../src/regex.c $(srcdir)/../src/regex.h ../src/config.h
375 ${CC} -c ${BASE_CFLAGS} -DCONFIG_BROKETS -DINHIBIT_STRING_HEADER ${srcdir}/../src/regex.c
376
377 etags: ${srcdir}/etags.c $(GETOPTDEPS) $(REGEXPDEPS) ../src/config.h
378 $(CC) ${ALL_CFLAGS} -DVERSION="\"${version}\"" ${srcdir}/etags.c $(GETOPTOBJS) $(REGEXPOBJ) $(LOADLIBES) -o etags
379
380 ebrowse: ${srcdir}/ebrowse.c $(GETOPTDEPS) ../src/config.h
381 $(CC) ${ALL_CFLAGS} -DVERSION="\"${version}\"" ${srcdir}/ebrowse.c $(GETOPTOBJS) $(LOADLIBES) -o ebrowse
382
383 /* We depend on etags to assure that parallel makes don't write two
384 etags.o files on top of each other. */
385 ctags: etags
386 $(CC) ${ALL_CFLAGS} -DCTAGS -DVERSION="\"${version}\"" ${srcdir}/etags.c $(GETOPTOBJS) $(REGEXPOBJ) $(LOADLIBES) -o ctags
387
388 profile: ${srcdir}/profile.c ../src/config.h
389 $(CC) ${ALL_CFLAGS} ${srcdir}/profile.c $(LOADLIBES) -o profile
390
391 make-docfile: ${srcdir}/make-docfile.c ../src/config.h
392 $(CC) ${ALL_CFLAGS} ${srcdir}/make-docfile.c $(LOADLIBES) -o make-docfile
393
394 digest-doc: ${srcdir}/digest-doc.c
395 $(CC) ${ALL_CFLAGS} ${srcdir}/digest-doc.c $(LOADLIBES) -o digest-doc
396
397 sorted-doc: ${srcdir}/sorted-doc.c ${ALLOCA}
398 $(CC) ${ALL_CFLAGS} ${srcdir}/sorted-doc.c ${ALLOCA} $(LOADLIBES) -o sorted-doc
399
400 b2m: ${srcdir}/b2m.c ../src/config.h $(GETOPTDEPS)
401 $(CC) ${ALL_CFLAGS} ${srcdir}/b2m.c -DVERSION="\"${version}\"" \
402 $(GETOPTOBJS) $(LOADLIBES) -o b2m
403
404 movemail: movemail.o pop.o $(GETOPTDEPS)
405 $(CC) ${LINK_CFLAGS} ${MOVE_FLAGS} movemail.o pop.o $(GETOPTOBJS) $(LOADLIBES) $(LIBMAIL) $(MOVE_LIBS) -o movemail
406
407 movemail.o: ${srcdir}/movemail.c ../src/config.h
408 $(CC) -c ${CPP_CFLAGS} -Demacs ${MOVE_FLAGS} ${srcdir}/movemail.c
409
410 pop.o: ${srcdir}/pop.c ../src/config.h
411 $(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/pop.c
412
413 cvtmail: ${srcdir}/cvtmail.c
414 $(CC) ${ALL_CFLAGS} ${srcdir}/cvtmail.c $(LOADLIBES) -o cvtmail
415
416 fakemail: ${srcdir}/fakemail.c ../src/config.h
417 $(CC) ${ALL_CFLAGS} ${srcdir}/fakemail.c $(LOADLIBES) -o fakemail
418
419 yow: ${srcdir}/yow.c ../src/epaths.h
420 $(CC) ${ALL_CFLAGS} ${srcdir}/yow.c $(LOADLIBES) -o yow
421
422 emacsserver: ${srcdir}/emacsserver.c ../src/config.h
423 $(CC) ${ALL_CFLAGS} ${srcdir}/emacsserver.c $(LOADLIBES) -o emacsserver
424
425 emacsclient: ${srcdir}/emacsclient.c ../src/config.h $(GETOPTDEPS)
426 $(CC) ${ALL_CFLAGS} ${srcdir}/emacsclient.c $(GETOPTOBJS) \
427 -DVERSION=`sed -n -e '/(defconst emacs-version/ s/^[^"]*\("[^"]*"\).*/\1/p' ${srcdir}/../lisp/version.el` \
428 $(LOADLIBES) -o emacsclient
429
430 hexl: ${srcdir}/hexl.c ../src/config.h
431 $(CC) ${ALL_CFLAGS} ${srcdir}/hexl.c $(LOADLIBES) -o hexl
432
433 /* These are NOT included in INSTALLABLES or UTILITIES.
434 See ../src/Makefile.in. */
435 emacstool: ${srcdir}/emacstool.c
436 $(CC) ${srcdir}/emacstool.c -o emacstool ${ALL_CFLAGS} \
437 -lsuntool -lsunwindow -lpixrect $(LOADLIBES)
438
439 /* For SUN Japanese Language Environment. */
440 nemacstool: ${srcdir}/emacstool.c
441 $(CC) -o nemacstool -DJLE ${ALL_CFLAGS} ${srcdir}/emacstool.c \
442 -lsuntool -lmle -lsunwindow -lpixrect $(LOADLIBES)
443
444 xvetool: ${srcdir}/emacstool.c
445 $(CC) -o xvetool -DXVIEW ${ALL_CFLAGS} ${srcdir}/emacstool.c \
446 -lxview -lX -I$(OPENWINHOME)/include -L$(OPENWINHOME)/lib \
447 $(LOADLIBES)
448
449 xveterm: ${srcdir}/emacstool.c
450 $(CC) -o xveterm -DXVIEW -DTTERM ${ALL_CFLAGS} ${srcdir}/emacstool.c \
451 -lxview -lolgx -lX -I$(OPENWINHOME)/include -L$(OPENWINHOME)/lib \
452 $(LOADLIBES)