Merge from emacs--rel--22
[bpt/emacs.git] / lib-src / Makefile.in
1 # Makefile for lib-src subdirectory in GNU Emacs.
2 # Copyright (C) 1985, 1987, 1988, 1993, 1994, 2001, 2002, 2003, 2004,
3 # 2005, 2006, 2007, 2008 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 3 of the License, or
10 # (at your option) 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. If not, see <http://www.gnu.org/licenses/>.
19
20
21 # Avoid trouble on systems where the `SHELL' variable might be
22 # inherited from the environment.
23 SHELL = /bin/sh
24
25 # Following ../lisp/Makefile.in.
26 EMACS = ../src/emacs
27 EMACSOPT = -batch --no-site-file --multibyte
28
29 # ==================== Things `configure' will edit ====================
30
31 CC=@CC@
32 CFLAGS=@CFLAGS@
33 version=@version@
34 configuration=@configuration@
35 EXEEXT=@EXEEXT@
36
37 # Program name transformation.
38 TRANSFORM = @program_transform_name@
39
40 # ==================== Where To Install Things ====================
41
42 # The default location for installation. Everything is placed in
43 # subdirectories of this directory. The default values for many of
44 # the variables below are expressed in terms of this one, so you may
45 # not need to change them. This is set with the --prefix option to
46 # `../configure'.
47 prefix=@prefix@
48
49 # Like `prefix', but used for architecture-specific files. This is
50 # set with the --exec-prefix option to `../configure'.
51 exec_prefix=@exec_prefix@
52
53 # Where to install Emacs and other binaries that people will want to
54 # run directly (like etags). This is set with the --bindir option
55 # to `../configure'.
56 bindir=@bindir@
57
58 # Where to install and expect executable files to be run by Emacs
59 # rather than directly by users, and other architecture-dependent
60 # data. ${archlibdir} is usually below this. This is set with the
61 # --libexecdir option to `../configure'.
62 libexecdir=@libexecdir@
63
64 # Directory for local state files for all programs.
65 localstatedir=@localstatedir@
66
67 # Where to find the source code. This is set by the configure
68 # script's `--srcdir' option. However, the value of ${srcdir} in
69 # this makefile is not identical to what was specified with --srcdir,
70 # since the variable here has `/lib-src' added at the end.
71
72 # We use $(srcdir) explicitly in dependencies so as not to depend on VPATH.
73 srcdir=@srcdir@
74 VPATH=@srcdir@
75
76 # The top-level source directory, also set by configure.
77 top_srcdir=@top_srcdir@
78
79 # ==================== Emacs-specific directories ====================
80
81 # These variables hold the values Emacs will actually use. They are
82 # based on the values of the standard Make variables above.
83
84 # Where to put executables to be run by Emacs rather than the user.
85 # This path usually includes the Emacs version and configuration name,
86 # so that multiple configurations for multiple versions of Emacs may
87 # be installed at once. This can be set with the --archlibdir option
88 # to `../configure'.
89 archlibdir=@archlibdir@
90
91 gamedir=@gamedir@
92 gameuser=@gameuser@
93
94 # ==================== Utility Programs for the Build =================
95
96 # ../configure figures out the correct values for these.
97 INSTALL = @INSTALL@
98 INSTALL_PROGRAM = @INSTALL_PROGRAM@
99 INSTALL_DATA = @INSTALL_DATA@
100 INSTALL_SCRIPT = @INSTALL_SCRIPT@
101 # By default, we uphold the dignity of our programs.
102 INSTALL_STRIP =
103
104 # ========================== Lists of Files ===========================
105
106 # Things that a user might actually run,
107 # which should be installed in bindir.
108 INSTALLABLES = etags${EXEEXT} ctags${EXEEXT} emacsclient${EXEEXT} b2m${EXEEXT} ebrowse${EXEEXT}
109 INSTALLABLE_SCRIPTS = rcs-checkin grep-changelog
110
111 # Things that Emacs runs internally, or during the build process,
112 # which should not be installed in bindir.
113 UTILITIES= profile${EXEEXT} digest-doc${EXEEXT} sorted-doc${EXEEXT} movemail${EXEEXT} cvtmail${EXEEXT} fakemail${EXEEXT} \
114 hexl${EXEEXT} update-game-score${EXEEXT}
115
116 DONT_INSTALL= test-distrib${EXEEXT} make-docfile${EXEEXT}
117
118 # Like UTILITIES, but they're not system-dependent, and should not be
119 # deleted by the distclean target.
120 SCRIPTS= rcs2log vcdiff
121
122 EXECUTABLES= ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}
123
124 # Additional -D flags for movemail (add to MOVE_FLAGS if desired):
125 # MAIL_USE_POP Support mail retrieval from a POP mailbox.
126 # MAIL_USE_MMDF Support MMDF mailboxes.
127 # MAIL_USE_FLOCK Use flock for file locking (see the comments
128 # about locking in movemail.c)
129 # MAIL_UNLINK_SPOOL Unlink the user's spool mailbox after reading
130 # it (instead of just emptying it).
131 # KERBEROS Support Kerberized POP.
132 # KRB5 Support Kerberos Version 5 pop instead of
133 # Version 4 (define this in addition to
134 # KERBEROS).
135 # HESIOD Support Hesiod lookups of user mailboxes.
136 # MAILHOST A string, the host name of the default POP
137 # mail host for the site.
138 MOVE_FLAGS=
139
140 # ========================== start of cpp stuff =======================
141 /* From here on, comments must be done in C syntax. */
142
143 #define THIS_IS_MAKEFILE
144 #define NOT_C_CODE
145 #include "../src/config.h"
146
147 #if defined(NS_IMPL_COCOA)
148 /* Build these programs as universal binaries. */
149 CFLAGS := $(CFLAGS) -universal
150 /* Add mac-fix-env for OS X systems running NS version. */
151 INSTALLABLES = etags${EXEEXT} ctags${EXEEXT} emacsclient${EXEEXT} b2m${EXEEXT} ebrowse${EXEEXT} mac-fix-env${EXEEXT}
152 #endif
153
154 /* Some s/SYSTEM.h files define this to request special libraries. */
155 #ifndef LIBS_SYSTEM
156 #define LIBS_SYSTEM
157 #endif
158
159 /* Some m/MACHINE.h files define this to request special libraries. */
160 #ifndef LIBS_MACHINE
161 #define LIBS_MACHINE
162 #endif
163
164 #ifndef C_SWITCH_SYSTEM
165 #define C_SWITCH_SYSTEM
166 #endif
167
168 #ifndef C_SWITCH_MACHINE
169 #define C_SWITCH_MACHINE
170 #endif
171
172 #undef MOVEMAIL_NEEDS_BLESSING
173 #ifndef MAIL_USE_FLOCK
174 #ifndef MAIL_USE_LOCKF
175 #define MOVEMAIL_NEEDS_BLESSING
176 #endif
177 #endif
178
179 #ifdef MOVEMAIL_NEEDS_BLESSING
180 #define BLESSMAIL blessmail
181 #else
182 #define BLESSMAIL
183 #endif
184
185 #ifdef KERBEROS
186 # ifdef HAVE_LIBKRB
187 KRB4LIB = -lkrb
188 # else
189 # ifdef HAVE_LIBKRB4
190 KRB4LIB = -lkrb4
191 # endif
192 # endif
193 # ifdef HAVE_LIBDES
194 DESLIB = -ldes
195 # else
196 # ifdef HAVE_LIBDES425
197 DESLIB = -ldes425
198 # endif
199 # endif
200 # ifdef HAVE_LIBKRB5
201 KRB5LIB = -lkrb5
202 # endif
203 # ifdef HAVE_LIBK5CRYPTO
204 CRYPTOLIB = -lk5crypto
205 # else
206 # ifdef HAVE_LIBCRYPTO
207 CRYPTOLIB = -lcrypto
208 # endif
209 # endif
210 # ifdef HAVE_LIBCOM_ERR
211 COM_ERRLIB = -lcom_err
212 # endif
213 #endif /* KERBEROS */
214
215 /* If HESIOD is defined, set this to "-lhesiod". */
216 #ifdef HAVE_LIBHESIOD
217 # ifdef HAVE_LIBRESOLV
218 HESIODLIB= -lhesiod -lresolv
219 # else
220 HESIODLIB= -lhesiod
221 # endif
222 #endif
223
224 LIBS_MOVE=$(KRB4LIB) $(DESLIB) $(KRB5LIB) $(CRYPTOLIB) $(COM_ERRLIB) $(HESIODLIB)
225
226 #ifdef HAVE_LIBLOCKFILE
227 LIBS_MAIL=-llockfile
228 #else
229 #ifdef HAVE_LIBMAIL
230 LIBS_MAIL=-lmail
231 #endif
232 #endif
233
234 LOADLIBES=LIBS_SYSTEM LIBS_MACHINE
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 .SUFFIXES: .m
253
254 /* This is the default compilation command.
255 But we should never rely on it, because some make version
256 failed to find it for getopt.o.
257 Using an explicit command made it work. */
258 .c.o:
259 ${CC} -c ${CPP_CFLAGS} $<
260
261 .m.o:
262 #ifdef NS_IMPL_GNUSTEP
263 $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) -fgnu-runtime -Wno-import -fconstant-string-class=NSConstantString $<
264 #else
265 $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $<
266 #endif
267
268 all: ${DONT_INSTALL} ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}
269
270 /* These targets copy the scripts into the build directory
271 so that they can be run from there in an uninstalled Emacs.
272 The "-" is prepended because some versions of cp barf when
273 srcdir is the current directory, and thus the file will be
274 copied into itself. */
275 rcs2log: $(srcdir)/rcs2log
276 -cp -p $(srcdir)/rcs2log rcs2log
277
278 rcs-checkin: $(srcdir)/rcs-checkin
279 -cp -p $(srcdir)/rcs-checkin rcs-checkin
280
281 grep-changelog: $(srcdir)/grep-changelog
282 -cp -p $(srcdir)/grep-changelog grep-changelog
283
284 vcdiff: $(srcdir)/vcdiff
285 -cp -p $(srcdir)/vcdiff vcdiff
286
287 #ifdef MOVEMAIL_NEEDS_BLESSING
288 blessmail:
289 $(EMACS) $(EMACSOPT) -l $(srcdir)/../lisp/mail/blessmail.el
290 chmod +x blessmail
291 #endif
292
293 maybe-blessmail: BLESSMAIL
294 #ifdef MOVEMAIL_NEEDS_BLESSING
295 /* Don\'t charge ahead and do it! Let the installer decide.
296 ./blessmail $(DESTDIR)${archlibdir}/movemail${EXEEXT} */
297 @if [ `wc -l <blessmail` != 2 ] ; then \
298 dir=`sed -n -e 's/echo mail directory = \(.*\)/\1/p' blessmail`; \
299 echo Assuming $$dir is really the mail spool directory, you should; \
300 echo run lib-src/blessmail $(DESTDIR)${archlibdir}/movemail${EXEEXT}; \
301 echo as root, to give movemail${EXEEXT} appropriate permissions.; \
302 echo Do that after running make install.; \
303 fi
304 #endif
305
306 /* Install the internal utilities. Until they are installed, we can
307 just run them directly from lib-src. */
308 $(DESTDIR)${archlibdir}: all
309 @echo
310 @echo "Installing utilities run internally by Emacs."
311 $(top_srcdir)/mkinstalldirs $(DESTDIR)${archlibdir}
312 if [ `(cd $(DESTDIR)${archlibdir} && /bin/pwd)` != `/bin/pwd` ]; then \
313 for file in ${UTILITIES}; do \
314 $(INSTALL_PROGRAM) $(INSTALL_STRIP) $$file $(DESTDIR)${archlibdir}/$$file ; \
315 done ; \
316 fi
317 $(top_srcdir)/mkinstalldirs $(DESTDIR)${gamedir}
318 touch $(DESTDIR)${gamedir}/snake-scores
319 touch $(DESTDIR)${gamedir}/tetris-scores
320 /* If the following commands fail, that is not a big deal.
321 update-game-score will detect at runtime that it is not setuid,
322 and handle things accordingly. */
323 -if chown ${gameuser} $(DESTDIR)${archlibdir}/update-game-score && chmod u+s $(DESTDIR)${archlibdir}/update-game-score; then \
324 chown ${gameuser} $(DESTDIR)${gamedir}; \
325 chmod u=rwx,g=rwx,o=rx $(DESTDIR)${gamedir}; \
326 fi
327 if [ `(cd $(DESTDIR)${archlibdir} && /bin/pwd)` \
328 != `(cd ${srcdir} && /bin/pwd)` ]; then \
329 for file in ${SCRIPTS}; do \
330 $(INSTALL_SCRIPT) ${srcdir}/$$file $(DESTDIR)${archlibdir}/$$file; \
331 done ; \
332 fi
333
334 install: $(DESTDIR)${archlibdir}
335 @echo
336 @echo "Installing utilities for users to run."
337 for file in ${INSTALLABLES} ; do \
338 $(INSTALL_PROGRAM) $(INSTALL_STRIP) $${file} $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \
339 chmod a+rx $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'`; \
340 done
341 for file in ${INSTALLABLE_SCRIPTS} ; do \
342 $(INSTALL_SCRIPT) ${srcdir}/$${file} $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \
343 chmod a+rx $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'`; \
344 done
345
346 uninstall:
347 (cd $(DESTDIR)${bindir}; \
348 for file in ${INSTALLABLES} ${INSTALLABLE_SCRIPTS}; do \
349 rm -f $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \
350 done)
351 (cd $(DESTDIR)${archlibdir}; \
352 rm -f ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS})
353
354 mostlyclean:
355 -rm -f core *.o getopt.h getopt.h-t
356
357 clean: mostlyclean
358 -rm -f ${INSTALLABLES} ${UTILITIES} ${DONT_INSTALL}
359 -rm -f fns*.el *.tab.c *.tab.h
360
361 distclean: clean
362 -rm -f TAGS
363 -rm -f Makefile Makefile.c blessmail
364
365 maintainer-clean: distclean
366 true
367
368 extraclean: maintainer-clean
369 -rm -f *~ \#*
370
371 /* Test the contents of the directory. */
372 check:
373 @echo "We don't have any tests for GNU Emacs yet."
374
375 tags: TAGS
376 TAGS: etags${EXEEXT}
377 etags *.[ch]
378
379 /* This verifies that the non-ASCII characters in the file \`testfile\'
380 have not been clobbered by whatever means were used to copy and
381 distribute Emacs. If they were clobbered, all the .elc files were
382 clobbered too. */
383 test-distrib${EXEEXT}: ${srcdir}/test-distrib.c
384 $(CC) ${ALL_CFLAGS} -o test-distrib ${srcdir}/test-distrib.c
385 ./test-distrib ${srcdir}/testfile
386
387 /* We need the following in order to create a <getopt.h> when the system
388 does not have one that works with the given compiler. */
389 GETOPT_H = @GETOPT_H@
390 getopt.h: getopt_.h
391 cp $(srcdir)/getopt_.h $@-t
392 mv $@-t $@
393
394 GETOPTOBJS = @GETOPTOBJS@
395 GETOPTDEPS = $(GETOPTOBJS) $(GETOPT_H)
396 getopt.o: ${srcdir}/getopt.c $(GETOPT_H) ${srcdir}/gettext.h
397 ${CC} -c ${CPP_CFLAGS} ${srcdir}/getopt.c
398 getopt1.o: ${srcdir}/getopt1.c $(GETOPT_H)
399 ${CC} -c ${CPP_CFLAGS} ${srcdir}/getopt1.c
400
401 REGEXPOBJ = regex.o
402 REGEXPDEPS = $(REGEXPOBJ) $(srcdir)/../src/regex.h
403
404 regex.o: $(srcdir)/../src/regex.c $(srcdir)/../src/regex.h ../src/config.h
405 ${CC} -c ${BASE_CFLAGS} -DCONFIG_BROKETS -DINHIBIT_STRING_HEADER ${srcdir}/../src/regex.c
406
407 etags${EXEEXT}: ${srcdir}/etags.c $(GETOPTDEPS) $(REGEXPDEPS) ../src/config.h
408 $(CC) ${ALL_CFLAGS} -DEMACS_NAME="\"GNU Emacs\"" -DVERSION="\"${version}\"" ${srcdir}/etags.c $(GETOPTOBJS) $(REGEXPOBJ) $(LOADLIBES) -o etags
409
410 ebrowse${EXEEXT}: ${srcdir}/ebrowse.c $(GETOPTDEPS) ../src/config.h
411 $(CC) ${ALL_CFLAGS} -DVERSION="\"${version}\"" ${srcdir}/ebrowse.c $(GETOPTOBJS) $(LOADLIBES) -o ebrowse
412
413 /* We depend on etags to assure that parallel makes don\'t write two
414 etags.o files on top of each other. */
415 ctags${EXEEXT}: etags${EXEEXT}
416 $(CC) ${ALL_CFLAGS} -DCTAGS -DEMACS_NAME="\"GNU Emacs\"" -DVERSION="\"${version}\"" ${srcdir}/etags.c $(GETOPTOBJS) $(REGEXPOBJ) $(LOADLIBES) -o ctags
417
418 profile${EXEEXT}: ${srcdir}/profile.c ../src/config.h
419 $(CC) ${ALL_CFLAGS} ${srcdir}/profile.c $(LOADLIBES) -o profile
420
421 make-docfile${EXEEXT}: ${srcdir}/make-docfile.c ../src/config.h
422 $(CC) ${ALL_CFLAGS} ${srcdir}/make-docfile.c $(LOADLIBES) -o make-docfile
423
424 digest-doc${EXEEXT}: ${srcdir}/digest-doc.c
425 $(CC) ${ALL_CFLAGS} ${srcdir}/digest-doc.c $(LOADLIBES) -o digest-doc
426
427 sorted-doc${EXEEXT}: ${srcdir}/sorted-doc.c
428 $(CC) ${ALL_CFLAGS} ${srcdir}/sorted-doc.c $(LOADLIBES) -o sorted-doc
429
430 b2m${EXEEXT}: ${srcdir}/b2m.c ../src/config.h $(GETOPTDEPS)
431 $(CC) ${ALL_CFLAGS} ${srcdir}/b2m.c -DVERSION="\"${version}\"" \
432 $(GETOPTOBJS) $(LOADLIBES) -o b2m
433
434 movemail${EXEEXT}: movemail.o pop.o $(GETOPTDEPS)
435 $(CC) ${LINK_CFLAGS} ${MOVE_FLAGS} movemail.o pop.o $(GETOPTOBJS) $(LOADLIBES) $(LIBS_MAIL) $(LIBS_MOVE) -o movemail
436
437 movemail.o: ${srcdir}/movemail.c ../src/config.h $(GETOPT_H)
438 $(CC) -c ${CPP_CFLAGS} -Demacs ${MOVE_FLAGS} ${srcdir}/movemail.c
439
440 pop.o: ${srcdir}/pop.c ../src/config.h
441 $(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/pop.c
442
443 cvtmail${EXEEXT}: ${srcdir}/cvtmail.c
444 $(CC) ${ALL_CFLAGS} ${srcdir}/cvtmail.c $(LOADLIBES) -o cvtmail
445
446 fakemail${EXEEXT}: ${srcdir}/fakemail.c ../src/config.h
447 $(CC) ${ALL_CFLAGS} ${srcdir}/fakemail.c $(LOADLIBES) -o fakemail
448
449 emacsclient${EXEEXT}: ${srcdir}/emacsclient.c ../src/config.h $(GETOPTDEPS)
450 $(CC) ${ALL_CFLAGS} ${srcdir}/emacsclient.c $(GETOPTOBJS) \
451 -DVERSION="\"${version}\"" \
452 $(LOADLIBES) -o emacsclient
453
454 hexl${EXEEXT}: ${srcdir}/hexl.c ../src/config.h
455 $(CC) ${ALL_CFLAGS} ${srcdir}/hexl.c $(LOADLIBES) -o hexl
456
457 update-game-score${EXEEXT}: update-game-score.o $(GETOPTDEPS)
458 $(CC) ${LINK_CFLAGS} ${MOVE_FLAGS} update-game-score.o $(GETOPTOBJS) $(LOADLIBES) -o update-game-score
459
460 update-game-score.o: ${srcdir}/update-game-score.c ../src/config.h $(GETOPT_H)
461 $(CC) -c ${CPP_CFLAGS} ${srcdir}/update-game-score.c \
462 -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\""
463
464 mac-fix-env: ${srcdir}/mac-fix-env.m
465 $(CC) -o mac-fix-env ${srcdir}/mac-fix-env.m -prebind -framework Foundation