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