(emacs-copyright): Add emacs-copyright.
[emacs.git] / lib-src / Makefile.in
blob5d8da71dbdda743843c0e876d62c679dadd43f1b
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.
5 # This file is part of GNU Emacs.
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.
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.
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.
22 # Avoid trouble on systems where the `SHELL' variable might be
23 # inherited from the environment.
24 SHELL = /bin/sh
26 # Following ../lisp/Makefile.in.
27 EMACS = ../src/emacs
28 EMACSOPT = -batch --no-site-file --multibyte
30 # ==================== Things `configure' will edit ====================
32 CC=@CC@
33 CFLAGS=@CFLAGS@
34 version=@version@
35 configuration=@configuration@
36 EXEEXT=@EXEEXT@
38 # Program name transformation.
39 TRANSFORM = @program_transform_name@
41 # ==================== Where To Install Things ====================
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@
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@
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@
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@
65 # Directory for local state files for all programs.
66 localstatedir=@localstatedir@
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.
73 # We use $(srcdir) explicitly in dependencies so as not to depend on VPATH.
74 srcdir=@srcdir@
75 VPATH=@srcdir@
77 # The top-level source directory, also set by configure.
78 top_srcdir=@top_srcdir@
80 # ==================== Emacs-specific directories ====================
82 # These variables hold the values Emacs will actually use. They are
83 # based on the values of the standard Make variables above.
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@
92 gamedir=@gamedir@
93 gameuser=@gameuser@
95 # ==================== Utility Programs for the Build =================
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 =
105 # ========================== Lists of Files ===========================
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
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}
117 DONT_INSTALL= test-distrib${EXEEXT} make-docfile${EXEEXT}
119 # Like UTILITIES, but they're not system-dependent, and should not be
120 # deleted by the distclean target.
121 SCRIPTS= rcs2log vcdiff
123 EXECUTABLES= ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}
125 SOURCES = COPYING ChangeLog Makefile.in README emacs.csh \
126 makedoc.com *.[chy] rcs2log vcdiff
128 # Additional -D flags for movemail (add to MOVE_FLAGS if desired):
129 # MAIL_USE_POP Support mail retrieval from a POP mailbox.
130 # MAIL_USE_MMDF Support MMDF mailboxes.
131 # MAIL_USE_FLOCK Use flock for file locking (see the comments
132 # about locking in movemail.c)
133 # MAIL_UNLINK_SPOOL Unlink the user's spool mailbox after reading
134 # it (instead of just emptying it).
135 # KERBEROS Support Kerberized POP.
136 # KRB5 Support Kerberos Version 5 pop instead of
137 # Version 4 (define this in addition to
138 # KERBEROS).
139 # HESIOD Support Hesiod lookups of user mailboxes.
140 # MAILHOST A string, the host name of the default POP
141 # mail host for the site.
142 MOVE_FLAGS=
144 # ========================== start of cpp stuff =======================
145 /* From here on, comments must be done in C syntax. */
147 #define NO_SHORTNAMES
148 #define THIS_IS_MAKEFILE
149 #define NOT_C_CODE
150 #include "../src/config.h"
152 /* Some machines don\'t find the standard C libraries in the usual place. */
153 #ifndef ORDINARY_LINK
154 #ifndef LIB_STANDARD_LIBSRC
155 #define LIB_STANDARD_LIBSRC -lc
156 #endif
157 #else
158 #ifndef LIB_STANDARD_LIBSRC
159 #define LIB_STANDARD_LIBSRC
160 #endif
161 #endif
163 /* Some s/SYSTEM.h files define this to request special libraries. */
164 #ifndef LIBS_SYSTEM
165 #define LIBS_SYSTEM
166 #endif
168 /* Some m/MACHINE.h files define this to request special libraries. */
169 #ifndef LIBS_MACHINE
170 #define LIBS_MACHINE
171 #endif
173 #ifndef C_SWITCH_SYSTEM
174 #define C_SWITCH_SYSTEM
175 #endif
177 #ifndef C_SWITCH_MACHINE
178 #define C_SWITCH_MACHINE
179 #endif
181 #undef MOVEMAIL_NEEDS_BLESSING
182 #ifndef MAIL_USE_FLOCK
183 #ifndef MAIL_USE_LOCKF
184 #define MOVEMAIL_NEEDS_BLESSING
185 #endif
186 #endif
188 #ifdef MOVEMAIL_NEEDS_BLESSING
189 #define BLESSMAIL blessmail
190 #else
191 #define BLESSMAIL
192 #endif
194 #ifdef KERBEROS
195 # ifdef HAVE_LIBKRB
196 KRB4LIB = -lkrb
197 # else
198 # ifdef HAVE_LIBKRB4
199 KRB4LIB = -lkrb4
200 # endif
201 # endif
202 # ifdef HAVE_LIBDES
203 DESLIB = -ldes
204 # else
205 # ifdef HAVE_LIBDES425
206 DESLIB = -ldes425
207 # endif
208 # endif
209 # ifdef HAVE_LIBKRB5
210 KRB5LIB = -lkrb5
211 # endif
212 # ifdef HAVE_LIBK5CRYPTO
213 CRYPTOLIB = -lk5crypto
214 # else
215 # ifdef HAVE_LIBCRYPTO
216 CRYPTOLIB = -lcrypto
217 # endif
218 # endif
219 # ifdef HAVE_LIBCOM_ERR
220 COM_ERRLIB = -lcom_err
221 # endif
222 #endif /* KERBEROS */
224 /* If HESIOD is defined, set this to "-lhesiod". */
225 #ifdef HAVE_LIBHESIOD
226 # ifdef HAVE_LIBRESOLV
227 HESIODLIB= -lhesiod -lresolv
228 # else
229 HESIODLIB= -lhesiod
230 # endif
231 #endif
233 LIBS_MOVE=$(KRB4LIB) $(DESLIB) $(KRB5LIB) $(CRYPTOLIB) $(COM_ERRLIB) $(HESIODLIB)
235 #ifdef HAVE_LIBLOCKFILE
236 LIBS_MAIL=-llockfile
237 #else
238 #ifdef HAVE_LIBMAIL
239 LIBS_MAIL=-lmail
240 #endif
241 #endif
243 LOADLIBES=LIBS_SYSTEM LIBS_MACHINE LIB_STANDARD_LIBSRC
245 /* We need to #define emacs to get the right versions of some files.
246 Some other files - those shared with other GNU utilities - need
247 HAVE_CONFIG_H #defined before they know they can take advantage of
248 the information in ../src/config.h. */
249 ALL_CFLAGS = C_SWITCH_SYSTEM C_SWITCH_MACHINE -DHAVE_CONFIG_H \
250 -I. -I../src -I${srcdir} -I${srcdir}/../src ${LDFLAGS} ${CPPFLAGS} ${CFLAGS}
251 LINK_CFLAGS = C_SWITCH_SYSTEM C_SWITCH_MACHINE -DHAVE_CONFIG_H \
252 -I. -I../src -I${srcdir} -I${srcdir}/../src ${LDFLAGS} ${CFLAGS}
253 CPP_CFLAGS = C_SWITCH_SYSTEM C_SWITCH_MACHINE -DHAVE_CONFIG_H \
254 -I. -I../src -I${srcdir} -I${srcdir}/../src ${CPPFLAGS} ${CFLAGS}
255 /* This was all of CPP_CFLAGS except -Demacs.
256 Now that -Demacs has been deleted from CPP_CFLAGS,
257 this is actually the same as CPP_CFLAGS, but let\'s not delete it yet. */
258 BASE_CFLAGS = C_SWITCH_SYSTEM C_SWITCH_MACHINE -DHAVE_CONFIG_H \
259 -I. -I../src -I${srcdir} -I${srcdir}/../src ${CPPFLAGS} ${CFLAGS}
261 /* This is the default compilation command.
262 But we should never rely on it, because some make version
263 failed to find it for getopt.o.
264 Using an explicit command made it work. */
265 .c.o:
266 ${CC} -c ${CPP_CFLAGS} $<
268 all: ${DONT_INSTALL} ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}
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
278 rcs-checkin: $(srcdir)/rcs-checkin
279 -cp -p $(srcdir)/rcs-checkin rcs-checkin
281 grep-changelog: $(srcdir)/grep-changelog
282 -cp -p $(srcdir)/grep-changelog grep-changelog
284 vcdiff: $(srcdir)/vcdiff
285 -cp -p $(srcdir)/vcdiff vcdiff
287 #ifdef MOVEMAIL_NEEDS_BLESSING
288 blessmail:
289 $(EMACS) $(EMACSOPT) -l $(srcdir)/../lisp/mail/blessmail.el
290 chmod +x blessmail
291 #endif
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.; \
304 #endif
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 ; \
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}; \
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 ; \
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
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})
354 mostlyclean:
355 -rm -f core *.o getopt.h getopt.h-t
357 clean: mostlyclean
358 -rm -f ${INSTALLABLES} ${UTILITIES} ${DONT_INSTALL}
359 -rm -f fns*.el *.tab.c *.tab.h
361 distclean: clean
362 -rm -f TAGS
363 -rm -f Makefile Makefile.c blessmail
365 maintainer-clean: distclean
366 true
368 extraclean: maintainer-clean
369 -rm -f *~ \#*
371 unlock:
372 chmod u+w $(SOURCES)
374 relock:
375 chmod u-w $(SOURCES)
377 /* Test the contents of the directory. */
378 check:
379 @echo "We don't have any tests for GNU Emacs yet."
381 tags: TAGS
382 TAGS: etags${EXEEXT}
383 etags *.[ch]
385 /* This verifies that the non-ASCII characters in the file \`testfile\'
386 have not been clobbered by whatever means were used to copy and
387 distribute Emacs. If they were clobbered, all the .elc files were
388 clobbered too. */
389 test-distrib${EXEEXT}: ${srcdir}/test-distrib.c
390 $(CC) ${ALL_CFLAGS} -o test-distrib ${srcdir}/test-distrib.c
391 ./test-distrib ${srcdir}/testfile
393 /* We need the following in order to create a <getopt.h> when the system
394 doesn't have one that works with the given compiler. */
395 GETOPT_H = @GETOPT_H@
396 getopt.h: getopt_.h
397 cp $(srcdir)/getopt_.h $@-t
398 mv $@-t $@
400 GETOPTOBJS = @GETOPTOBJS@
401 GETOPTDEPS = $(GETOPTOBJS) $(GETOPT_H)
402 getopt.o: ${srcdir}/getopt.c $(GETOPT_H) ${srcdir}/gettext.h
403 ${CC} -c ${CPP_CFLAGS} ${srcdir}/getopt.c
404 getopt1.o: ${srcdir}/getopt1.c $(GETOPT_H)
405 ${CC} -c ${CPP_CFLAGS} ${srcdir}/getopt1.c
407 #ifdef REGEXP_IN_LIBC
408 REGEXPOBJ =
409 REGEXPDEPS =
410 #else
411 REGEXPOBJ = regex.o
412 REGEXPDEPS = $(REGEXPOBJ) $(srcdir)/../src/regex.h
413 #endif
415 regex.o: $(srcdir)/../src/regex.c $(srcdir)/../src/regex.h ../src/config.h
416 ${CC} -c ${BASE_CFLAGS} -DCONFIG_BROKETS -DINHIBIT_STRING_HEADER ${srcdir}/../src/regex.c
418 etags${EXEEXT}: ${srcdir}/etags.c $(GETOPTDEPS) $(REGEXPDEPS) ../src/config.h
419 $(CC) ${ALL_CFLAGS} -DEMACS_NAME="\"GNU Emacs"\" -DVERSION="\"${version}\"" ${srcdir}/etags.c $(GETOPTOBJS) $(REGEXPOBJ) $(LOADLIBES) -o etags
421 ebrowse${EXEEXT}: ${srcdir}/ebrowse.c $(GETOPTDEPS) ../src/config.h
422 $(CC) ${ALL_CFLAGS} -DVERSION="\"${version}\"" ${srcdir}/ebrowse.c $(GETOPTOBJS) $(LOADLIBES) -o ebrowse
424 /* We depend on etags to assure that parallel makes don\'t write two
425 etags.o files on top of each other. */
426 ctags${EXEEXT}: etags${EXEEXT}
427 $(CC) ${ALL_CFLAGS} -DCTAGS -DEMACS_NAME="\"GNU Emacs"\" -DVERSION="\"${version}\"" ${srcdir}/etags.c $(GETOPTOBJS) $(REGEXPOBJ) $(LOADLIBES) -o ctags
429 profile${EXEEXT}: ${srcdir}/profile.c ../src/config.h
430 $(CC) ${ALL_CFLAGS} ${srcdir}/profile.c $(LOADLIBES) -o profile
432 make-docfile${EXEEXT}: ${srcdir}/make-docfile.c ../src/config.h
433 $(CC) ${ALL_CFLAGS} ${srcdir}/make-docfile.c $(LOADLIBES) -o make-docfile
435 digest-doc${EXEEXT}: ${srcdir}/digest-doc.c
436 $(CC) ${ALL_CFLAGS} ${srcdir}/digest-doc.c $(LOADLIBES) -o digest-doc
438 sorted-doc${EXEEXT}: ${srcdir}/sorted-doc.c
439 $(CC) ${ALL_CFLAGS} ${srcdir}/sorted-doc.c $(LOADLIBES) -o sorted-doc
441 b2m${EXEEXT}: ${srcdir}/b2m.c ../src/config.h $(GETOPTDEPS)
442 $(CC) ${ALL_CFLAGS} ${srcdir}/b2m.c -DVERSION="\"${version}\"" \
443 $(GETOPTOBJS) $(LOADLIBES) -o b2m
445 movemail${EXEEXT}: movemail.o pop.o $(GETOPTDEPS)
446 $(CC) ${LINK_CFLAGS} ${MOVE_FLAGS} movemail.o pop.o $(GETOPTOBJS) $(LOADLIBES) $(LIBS_MAIL) $(LIBS_MOVE) -o movemail
448 movemail.o: ${srcdir}/movemail.c ../src/config.h $(GETOPT_H)
449 $(CC) -c ${CPP_CFLAGS} -Demacs ${MOVE_FLAGS} ${srcdir}/movemail.c
451 pop.o: ${srcdir}/pop.c ../src/config.h
452 $(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/pop.c
454 cvtmail${EXEEXT}: ${srcdir}/cvtmail.c
455 $(CC) ${ALL_CFLAGS} ${srcdir}/cvtmail.c $(LOADLIBES) -o cvtmail
457 fakemail${EXEEXT}: ${srcdir}/fakemail.c ../src/config.h
458 $(CC) ${ALL_CFLAGS} ${srcdir}/fakemail.c $(LOADLIBES) -o fakemail
460 emacsclient${EXEEXT}: ${srcdir}/emacsclient.c ../src/config.h $(GETOPTDEPS)
461 $(CC) ${ALL_CFLAGS} ${srcdir}/emacsclient.c $(GETOPTOBJS) \
462 -DVERSION="\"${version}\"" \
463 $(LOADLIBES) -o emacsclient
465 hexl${EXEEXT}: ${srcdir}/hexl.c ../src/config.h
466 $(CC) ${ALL_CFLAGS} ${srcdir}/hexl.c $(LOADLIBES) -o hexl
468 update-game-score${EXEEXT}: update-game-score.o $(GETOPTDEPS)
469 $(CC) ${LINK_CFLAGS} ${MOVE_FLAGS} update-game-score.o $(GETOPTOBJS) $(LOADLIBES) -o update-game-score
471 update-game-score.o: ${srcdir}/update-game-score.c ../src/config.h $(GETOPT_H)
472 $(CC) -c ${CPP_CFLAGS} ${srcdir}/update-game-score.c \
473 -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\""
475 /* These are NOT included in INSTALLABLES or UTILITIES.
476 See ../src/Makefile.in. */
477 emacstool${EXEEXT}: ${srcdir}/emacstool.c
478 $(CC) ${srcdir}/emacstool.c -o emacstool ${ALL_CFLAGS} \
479 -lsuntool -lsunwindow -lpixrect $(LOADLIBES)
481 /* For SUN Japanese Language Environment. */
482 nemacstool${EXEEXT}: ${srcdir}/emacstool.c
483 $(CC) -o nemacstool -DJLE ${ALL_CFLAGS} ${srcdir}/emacstool.c \
484 -lsuntool -lmle -lsunwindow -lpixrect $(LOADLIBES)
486 xvetool${EXEEXT}: ${srcdir}/emacstool.c
487 $(CC) -o xvetool -DXVIEW ${ALL_CFLAGS} ${srcdir}/emacstool.c \
488 -lxview -lX -I$(OPENWINHOME)/include -L$(OPENWINHOME)/lib \
489 $(LOADLIBES)
491 xveterm${EXEEXT}: ${srcdir}/emacstool.c
492 $(CC) -o xveterm -DXVIEW -DTTERM ${ALL_CFLAGS} ${srcdir}/emacstool.c \
493 -lxview -lolgx -lX -I$(OPENWINHOME)/include -L$(OPENWINHOME)/lib \
494 $(LOADLIBES)