Sync to HEAD
[bpt/emacs.git] / lib-src / Makefile.in
1 # Makefile for lib-src subdirectory in GNU Emacs.
2 # Copyright (C) 1985, 1987, 1988, 1993, 1994, 2002, 2003
3 # Free Software Foundation, Inc.
4
5 # This file is part of GNU Emacs.
6
7 # GNU Emacs is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2, or (at your option)
10 # any later version.
11
12 # GNU Emacs is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
16
17 # You should have received a copy of the GNU General Public License
18 # along with GNU Emacs; see the file COPYING. If not, write to
19 # the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 # Boston, MA 02111-1307, USA.
21
22 # Avoid trouble on systems where the `SHELL' variable might be
23 # inherited from the environment.
24 SHELL = /bin/sh
25
26 # ==================== Things `configure' will edit ====================
27
28 CC=@CC@
29 CFLAGS=@CFLAGS@
30 version=@version@
31 configuration=@configuration@
32 EXEEXT=@EXEEXT@
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 # Directory for local state files for all programs.
62 localstatedir=@localstatedir@
63
64 # Where to find the source code. This is set by the configure
65 # script's `--srcdir' option. However, the value of ${srcdir} in
66 # this makefile is not identical to what was specified with --srcdir,
67 # since the variable here has `/lib-src' added at the end.
68
69 # We use $(srcdir) explicitly in dependencies so as not to depend on VPATH.
70 srcdir=@srcdir@
71 VPATH=@srcdir@
72
73 # The top-level source directory, also set by configure.
74 top_srcdir=@top_srcdir@
75
76 # ==================== Emacs-specific directories ====================
77
78 # These variables hold the values Emacs will actually use. They are
79 # based on the values of the standard Make variables above.
80
81 # Where to put executables to be run by Emacs rather than the user.
82 # This path usually includes the Emacs version and configuration name,
83 # so that multiple configurations for multiple versions of Emacs may
84 # be installed at once. This can be set with the --archlibdir option
85 # to `../configure'.
86 archlibdir=@archlibdir@
87
88 gamedir=@gamedir@
89 gameuser=@gameuser@
90
91 # ==================== Utility Programs for the Build =================
92
93 # ../configure figures out the correct values for these.
94 INSTALL = @INSTALL@
95 INSTALL_PROGRAM = @INSTALL_PROGRAM@
96 INSTALL_DATA = @INSTALL_DATA@
97 # By default, we uphold the dignity of our programs.
98 INSTALL_STRIP =
99
100 # ========================== Lists of Files ===========================
101
102 # Things that a user might actually run,
103 # which should be installed in bindir.
104 INSTALLABLES = etags${EXEEXT} ctags${EXEEXT} emacsclient${EXEEXT} b2m${EXEEXT} ebrowse${EXEEXT}
105 INSTALLABLE_SCRIPTS = rcs-checkin grep-changelog
106
107 # Things that Emacs runs internally, or during the build process,
108 # which should not be installed in bindir.
109 UTILITIES= profile${EXEEXT} digest-doc${EXEEXT} sorted-doc${EXEEXT} movemail${EXEEXT} cvtmail${EXEEXT} fakemail${EXEEXT} \
110 yow${EXEEXT} hexl${EXEEXT} update-game-score${EXEEXT}
111
112 DONT_INSTALL= test-distrib${EXEEXT} make-docfile${EXEEXT}
113
114 # Like UTILITIES, but they're not system-dependent, and should not be
115 # deleted by the distclean target.
116 SCRIPTS= rcs2log vcdiff
117
118 EXECUTABLES= ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}
119
120 SOURCES = COPYING ChangeLog Makefile.in README emacs.csh \
121 makedoc.com *.[chy] rcs2log vcdiff
122
123 # Additional -D flags for movemail (add to MOVE_FLAGS if desired):
124 # MAIL_USE_POP Support mail retrieval from a POP mailbox.
125 # MAIL_USE_MMDF Support MMDF mailboxes.
126 # MAIL_USE_FLOCK Use flock for file locking (see the comments
127 # about locking in movemail.c)
128 # MAIL_UNLINK_SPOOL Unlink the user's spool mailbox after reading
129 # it (instead of just emptying it).
130 # KERBEROS Support Kerberized POP.
131 # KRB5 Support Kerberos Version 5 pop instead of
132 # Version 4 (define this in addition to
133 # KERBEROS).
134 # HESIOD Support Hesiod lookups of user mailboxes.
135 # MAILHOST A string, the host name of the default POP
136 # mail host for the site.
137 MOVE_FLAGS=
138
139 # ========================== start of cpp stuff =======================
140 /* From here on, comments must be done in C syntax. */
141
142 #define NO_SHORTNAMES
143 #define THIS_IS_MAKEFILE
144 #define NOT_C_CODE
145 #include "../src/config.h"
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 LIBS_MOVE=$(KRB4LIB) $(DESLIB) $(KRB5LIB) $(CRYPTOLIB) $(COM_ERRLIB) $(HESIODLIB)
229
230 #ifdef HAVE_LIBLOCKFILE
231 LIBS_MAIL=-llockfile
232 #else
233 #ifdef HAVE_LIBMAIL
234 LIBS_MAIL=-lmail
235 #endif
236 #endif
237
238 LOADLIBES=LIBS_SYSTEM LIBS_MACHINE LIB_STANDARD_LIBSRC
239
240 /* We need to #define emacs to get the right versions of some files.
241 Some other files - those shared with other GNU utilities - need
242 HAVE_CONFIG_H #defined before they know they can take advantage of
243 the information in ../src/config.h. */
244 ALL_CFLAGS = C_SWITCH_SYSTEM C_SWITCH_MACHINE -DHAVE_CONFIG_H \
245 -I. -I../src -I${srcdir} -I${srcdir}/../src ${LDFLAGS} ${CPPFLAGS} ${CFLAGS}
246 LINK_CFLAGS = C_SWITCH_SYSTEM C_SWITCH_MACHINE -DHAVE_CONFIG_H \
247 -I. -I../src -I${srcdir} -I${srcdir}/../src ${LDFLAGS} ${CFLAGS}
248 CPP_CFLAGS = C_SWITCH_SYSTEM C_SWITCH_MACHINE -DHAVE_CONFIG_H \
249 -I. -I../src -I${srcdir} -I${srcdir}/../src ${CPPFLAGS} ${CFLAGS}
250 /* This was all of CPP_CFLAGS except -Demacs.
251 Now that -Demacs has been deleted from CPP_CFLAGS,
252 this is actually the same as CPP_CFLAGS, but let\'s not delete it yet. */
253 BASE_CFLAGS = C_SWITCH_SYSTEM C_SWITCH_MACHINE -DHAVE_CONFIG_H \
254 -I. -I../src -I${srcdir} -I${srcdir}/../src ${CPPFLAGS} ${CFLAGS}
255 \f
256 /* This is the default compilation command.
257 But we should never rely on it, because some make version
258 failed to find it for getopt.o.
259 Using an explicit command made it work. */
260 .c.o:
261 ${CC} -c ${CPP_CFLAGS} $<
262
263 all: ${DONT_INSTALL} ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}
264
265 /* These targets copy the scripts into the build directory
266 so that they can be run from there in an uninstalled Emacs. */
267 rcs2log: $(srcdir)/rcs2log
268 cp -p $(srcdir)/rcs2log rcs2log
269
270 rcs-checkin: $(srcdir)/rcs-checkin
271 cp -p $(srcdir)/rcs-checkin rcs-checkin
272
273 grep-changelog: $(srcdir)/grep-changelog
274 cp -p $(srcdir)/grep-changelog grep-changelog
275
276 vcdiff: $(srcdir)/vcdiff
277 cp -p $(srcdir)/vcdiff vcdiff
278
279 #ifdef MOVEMAIL_NEEDS_BLESSING
280 blessmail:
281 ../src/emacs -batch -l $(srcdir)/../lisp/mail/blessmail.el
282 chmod +x blessmail
283 #endif
284
285 maybe-blessmail: BLESSMAIL
286 #ifdef MOVEMAIL_NEEDS_BLESSING
287 /* Don\'t charge ahead and do it! Let the installer decide.
288 ./blessmail ${archlibdir}/movemail${EXEEXT} */
289 @if [ `wc -l <blessmail` != 2 ] ; then \
290 dir=`sed -n -e 's/echo mail directory = \(.*\)/\1/p' blessmail`; \
291 echo Assuming $$dir is really the mail spool directory, you should; \
292 echo run lib-src/blessmail ${archlibdir}/movemail${EXEEXT}; \
293 echo as root, to give movemail${EXEEXT} appropriate permissions.; \
294 echo Do that after running make install.; \
295 fi
296 #endif
297
298 /* Install the internal utilities. Until they are installed, we can
299 just run them directly from lib-src. */
300 ${archlibdir}: all
301 @echo
302 @echo "Installing utilities run internally by Emacs."
303 $(top_srcdir)/mkinstalldirs ${archlibdir}
304 if [ `(cd ${archlibdir} && /bin/pwd)` != `/bin/pwd` ]; then \
305 for file in ${UTILITIES}; do \
306 $(INSTALL_PROGRAM) $(INSTALL_STRIP) $$file ${archlibdir}/$$file ; \
307 done ; \
308 fi
309 $(top_srcdir)/mkinstalldirs ${gamedir}
310 touch ${gamedir}/snake-scores
311 touch ${gamedir}/tetris-scores
312 /* If the following commands fail, that is not a big deal.
313 update-game-score will detect at runtime that it is not setuid,
314 and handle things accordingly. */
315 -if chown ${gameuser} ${archlibdir}/update-game-score && chmod u+s ${archlibdir}/update-game-score; then \
316 chown ${gameuser} ${gamedir}; \
317 chmod u=rwx,g=rwx,o=rx ${gamedir}; \
318 fi
319 if [ `(cd ${archlibdir} && /bin/pwd)` \
320 != `(cd ${srcdir} && /bin/pwd)` ]; then \
321 for file in ${SCRIPTS}; do \
322 $(INSTALL_PROGRAM) ${srcdir}/$$file ${archlibdir}/$$file; \
323 done ; \
324 fi
325
326 install: ${archlibdir}
327 @echo
328 @echo "Installing utilities for users to run."
329 for file in ${INSTALLABLES} ; do \
330 $(INSTALL_PROGRAM) $(INSTALL_STRIP) $${file} ${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \
331 chmod a+rx ${bindir}/`echo $${file} | sed '$(TRANSFORM)'`; \
332 done
333 for file in ${INSTALLABLE_SCRIPTS} ; do \
334 $(INSTALL_PROGRAM) ${srcdir}/$${file} ${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \
335 chmod a+rx ${bindir}/`echo $${file} | sed '$(TRANSFORM)'`; \
336 done
337
338 uninstall:
339 (cd ${bindir}; \
340 for file in ${INSTALLABLES} ${INSTALLABLE_SCRIPTS}; do \
341 rm -f ${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \
342 done)
343 (cd ${archlibdir}; \
344 rm -f ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS})
345
346 mostlyclean:
347 -rm -f core *.o
348
349 clean: mostlyclean
350 -rm -f ${INSTALLABLES} ${UTILITIES} ${DONT_INSTALL}
351 -rm -f fns*.el *.tab.c *.tab.h
352
353 distclean: clean
354 -rm -f TAGS
355 -rm -f Makefile Makefile.c blessmail
356
357 maintainer-clean: distclean
358 true
359
360 extraclean: maintainer-clean
361 -rm -f *~ \#*
362
363 unlock:
364 chmod u+w $(SOURCES)
365
366 relock:
367 chmod u-w $(SOURCES)
368
369 /* Test the contents of the directory. */
370 check:
371 @echo "We don't have any tests for GNU Emacs yet."
372
373 tags: TAGS
374 TAGS: etags${EXEEXT}
375 etags *.[ch]
376
377 /* This verifies that the non-ASCII characters in the file \`testfile\'
378 have not been clobbered by whatever means were used to copy and
379 distribute Emacs. If they were clobbered, all the .elc files were
380 clobbered too. */
381 test-distrib${EXEEXT}: ${srcdir}/test-distrib.c
382 $(CC) ${ALL_CFLAGS} -o test-distrib ${srcdir}/test-distrib.c
383 ./test-distrib ${srcdir}/testfile
384
385 GETOPTOBJS = getopt.o getopt1.o
386 GETOPTDEPS = $(GETOPTOBJS) ${srcdir}/getopt.h
387 getopt.o: ${srcdir}/getopt.c ${srcdir}/getopt.h
388 ${CC} -c ${CPP_CFLAGS} ${srcdir}/getopt.c
389 getopt1.o: ${srcdir}/getopt1.c ${srcdir}/getopt.h
390 ${CC} -c ${CPP_CFLAGS} ${srcdir}/getopt1.c
391
392 #ifdef REGEXP_IN_LIBC
393 REGEXPOBJ =
394 REGEXPDEPS =
395 #else
396 REGEXPOBJ = regex.o
397 REGEXPDEPS = $(REGEXPOBJ) $(srcdir)/../src/regex.h
398 #endif
399
400 regex.o: $(srcdir)/../src/regex.c $(srcdir)/../src/regex.h ../src/config.h
401 ${CC} -c ${BASE_CFLAGS} -DCONFIG_BROKETS -DINHIBIT_STRING_HEADER ${srcdir}/../src/regex.c
402
403 etags${EXEEXT}: ${srcdir}/etags.c $(GETOPTDEPS) $(REGEXPDEPS) ../src/config.h
404 $(CC) ${ALL_CFLAGS} -DVERSION="\"${version}\"" ${srcdir}/etags.c $(GETOPTOBJS) $(REGEXPOBJ) $(LOADLIBES) -o etags
405
406 ebrowse${EXEEXT}: ${srcdir}/ebrowse.c $(GETOPTDEPS) ../src/config.h
407 $(CC) ${ALL_CFLAGS} -DVERSION="\"${version}\"" ${srcdir}/ebrowse.c $(GETOPTOBJS) $(LOADLIBES) -o ebrowse
408
409 /* We depend on etags to assure that parallel makes don\'t write two
410 etags.o files on top of each other. */
411 ctags${EXEEXT}: etags${EXEEXT}
412 $(CC) ${ALL_CFLAGS} -DCTAGS -DVERSION="\"${version}\"" ${srcdir}/etags.c $(GETOPTOBJS) $(REGEXPOBJ) $(LOADLIBES) -o ctags
413
414 profile${EXEEXT}: ${srcdir}/profile.c ../src/config.h
415 $(CC) ${ALL_CFLAGS} ${srcdir}/profile.c $(LOADLIBES) -o profile
416
417 make-docfile${EXEEXT}: ${srcdir}/make-docfile.c ../src/config.h
418 $(CC) ${ALL_CFLAGS} ${srcdir}/make-docfile.c $(LOADLIBES) -o make-docfile
419
420 digest-doc${EXEEXT}: ${srcdir}/digest-doc.c
421 $(CC) ${ALL_CFLAGS} ${srcdir}/digest-doc.c $(LOADLIBES) -o digest-doc
422
423 sorted-doc${EXEEXT}: ${srcdir}/sorted-doc.c
424 $(CC) ${ALL_CFLAGS} ${srcdir}/sorted-doc.c $(LOADLIBES) -o sorted-doc
425
426 b2m${EXEEXT}: ${srcdir}/b2m.c ../src/config.h $(GETOPTDEPS)
427 $(CC) ${ALL_CFLAGS} ${srcdir}/b2m.c -DVERSION="\"${version}\"" \
428 $(GETOPTOBJS) $(LOADLIBES) -o b2m
429
430 movemail${EXEEXT}: movemail.o pop.o $(GETOPTDEPS)
431 $(CC) ${LINK_CFLAGS} ${MOVE_FLAGS} movemail.o pop.o $(GETOPTOBJS) $(LOADLIBES) $(LIBS_MAIL) $(LIBS_MOVE) -o movemail
432
433 movemail.o: ${srcdir}/movemail.c ../src/config.h
434 $(CC) -c ${CPP_CFLAGS} -Demacs ${MOVE_FLAGS} ${srcdir}/movemail.c
435
436 pop.o: ${srcdir}/pop.c ../src/config.h
437 $(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/pop.c
438
439 cvtmail${EXEEXT}: ${srcdir}/cvtmail.c
440 $(CC) ${ALL_CFLAGS} ${srcdir}/cvtmail.c $(LOADLIBES) -o cvtmail
441
442 fakemail${EXEEXT}: ${srcdir}/fakemail.c ../src/config.h
443 $(CC) ${ALL_CFLAGS} ${srcdir}/fakemail.c $(LOADLIBES) -o fakemail
444
445 yow${EXEEXT}: ${srcdir}/yow.c ../src/epaths.h
446 $(CC) ${ALL_CFLAGS} ${srcdir}/yow.c $(LOADLIBES) -o yow
447
448 emacsclient${EXEEXT}: ${srcdir}/emacsclient.c ../src/config.h $(GETOPTDEPS)
449 $(CC) ${ALL_CFLAGS} ${srcdir}/emacsclient.c $(GETOPTOBJS) \
450 -DVERSION=`sed -n -e '/(defconst emacs-version/ s/^[^"]*\("[^"]*"\).*/\1/p' ${srcdir}/../lisp/version.el` \
451 $(LOADLIBES) -o emacsclient
452
453 hexl${EXEEXT}: ${srcdir}/hexl.c ../src/config.h
454 $(CC) ${ALL_CFLAGS} ${srcdir}/hexl.c $(LOADLIBES) -o hexl
455
456 update-game-score${EXEEXT}: ${srcdir}/update-game-score.c ../src/config.h
457 $(CC) ${ALL_CFLAGS} ${srcdir}/update-game-score.c \
458 -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\"" \
459 $(LOADLIBES) -o update-game-score
460
461 /* These are NOT included in INSTALLABLES or UTILITIES.
462 See ../src/Makefile.in. */
463 emacstool${EXEEXT}: ${srcdir}/emacstool.c
464 $(CC) ${srcdir}/emacstool.c -o emacstool ${ALL_CFLAGS} \
465 -lsuntool -lsunwindow -lpixrect $(LOADLIBES)
466
467 /* For SUN Japanese Language Environment. */
468 nemacstool${EXEEXT}: ${srcdir}/emacstool.c
469 $(CC) -o nemacstool -DJLE ${ALL_CFLAGS} ${srcdir}/emacstool.c \
470 -lsuntool -lmle -lsunwindow -lpixrect $(LOADLIBES)
471
472 xvetool${EXEEXT}: ${srcdir}/emacstool.c
473 $(CC) -o xvetool -DXVIEW ${ALL_CFLAGS} ${srcdir}/emacstool.c \
474 -lxview -lX -I$(OPENWINHOME)/include -L$(OPENWINHOME)/lib \
475 $(LOADLIBES)
476
477 xveterm${EXEEXT}: ${srcdir}/emacstool.c
478 $(CC) -o xveterm -DXVIEW -DTTERM ${ALL_CFLAGS} ${srcdir}/emacstool.c \
479 -lxview -lolgx -lX -I$(OPENWINHOME)/include -L$(OPENWINHOME)/lib \
480 $(LOADLIBES)
481
482 /* arch-tag: cc40144d-fbd2-436b-9a22-dcb5b5b6a2af
483 (do not change this comment) */