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.
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 of the License, or
10 # (at your option) 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. If not, see <http://www.gnu.org/licenses/>.
21 # Avoid trouble on systems where the `SHELL' variable might be
22 # inherited from the environment.
25 # Following ../lisp/Makefile.in.
27 EMACSOPT
= -batch
--no-site-file
--multibyte
29 # ==================== Things `configure' will edit ====================
34 configuration
=@configuration@
37 # Program name transformation.
38 TRANSFORM
= @program_transform_name@
40 # ==================== Where To Install Things ====================
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
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@
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
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@
64 # Directory for local state files for all programs.
65 localstatedir
=@localstatedir@
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.
72 # We use $(srcdir) explicitly in dependencies so as not to depend on VPATH.
76 # The top-level source directory, also set by configure.
77 top_srcdir
=@top_srcdir@
79 # ==================== Emacs-specific directories ====================
81 # These variables hold the values Emacs will actually use. They are
82 # based on the values of the standard Make variables above.
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
89 archlibdir
=@archlibdir@
94 # ==================== Utility Programs for the Build =================
96 # ../configure figures out the correct values for these.
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.
104 # ========================== Lists of Files ===========================
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
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}
116 DONT_INSTALL
= test-distrib
${EXEEXT} make-docfile
${EXEEXT}
118 # Like UTILITIES, but they're not system-dependent, and should not be
119 # deleted by the distclean target.
120 SCRIPTS
= rcs2log vcdiff
122 EXECUTABLES
= ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}
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
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.
140 # ========================== start of cpp stuff =======================
141 /* From here on
, comments must be done in C syntax.
*/
143 #define THIS_IS_MAKEFILE
145 #include "../src/config.h"
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}
154 /* Some platforms that the GNUstep port runs on put
strip options in
155 INSTALL_PROGRAM which cause errors. But
, not being sure
all other
156 platforms are setting this
, we will only use the alternative
157 INSTALL_SCRIPT variable on GNUstep
/Cocoa builds.
*/
159 INSTALL_SCRIPT
= @INSTALL_PROGRAM@
161 INSTALL_SCRIPT
= @INSTALL_SCRIPT@
164 /* Some machines don
\'t find the standard C libraries in the usual place.
*/
165 #ifndef ORDINARY_LINK
166 #ifndef LIB_STANDARD_LIBSRC
167 #define LIB_STANDARD_LIBSRC -lc
170 #ifndef LIB_STANDARD_LIBSRC
171 #define LIB_STANDARD_LIBSRC
175 /* Some s
/SYSTEM.h files
define this to request special libraries.
*/
180 /* Some m
/MACHINE.h files
define this to request special libraries.
*/
185 #ifndef C_SWITCH_SYSTEM
186 #define C_SWITCH_SYSTEM
189 #ifndef C_SWITCH_MACHINE
190 #define C_SWITCH_MACHINE
193 #undef MOVEMAIL_NEEDS_BLESSING
194 #ifndef MAIL_USE_FLOCK
195 #ifndef MAIL_USE_LOCKF
196 #define MOVEMAIL_NEEDS_BLESSING
200 #ifdef MOVEMAIL_NEEDS_BLESSING
201 #define BLESSMAIL blessmail
217 # ifdef HAVE_LIBDES425
224 # ifdef HAVE_LIBK5CRYPTO
225 CRYPTOLIB
= -lk5crypto
227 # ifdef HAVE_LIBCRYPTO
231 # ifdef HAVE_LIBCOM_ERR
232 COM_ERRLIB
= -lcom_err
234 #endif /* KERBEROS */
236 /* If HESIOD is defined
, set this to
"-lhesiod".
*/
237 #ifdef HAVE_LIBHESIOD
238 # ifdef HAVE_LIBRESOLV
239 HESIODLIB
= -lhesiod
-lresolv
245 LIBS_MOVE
=$(KRB4LIB
) $(DESLIB
) $(KRB5LIB
) $(CRYPTOLIB
) $(COM_ERRLIB
) $(HESIODLIB
)
247 #ifdef HAVE_LIBLOCKFILE
255 LOADLIBES
=LIBS_SYSTEM LIBS_MACHINE LIB_STANDARD_LIBSRC
257 /* We need to
#define emacs to get the right versions of some files.
258 Some other files
- those shared with other GNU utilities
- need
259 HAVE_CONFIG_H
#defined before they know they can take advantage of
260 the information in ..
/src
/config.h.
*/
261 ALL_CFLAGS
= C_SWITCH_SYSTEM C_SWITCH_MACHINE
-DHAVE_CONFIG_H \
262 -I.
-I..
/src
-I
${srcdir} -I
${srcdir}/..
/src
${LDFLAGS} ${CPPFLAGS} ${CFLAGS}
263 LINK_CFLAGS
= C_SWITCH_SYSTEM C_SWITCH_MACHINE
-DHAVE_CONFIG_H \
264 -I.
-I..
/src
-I
${srcdir} -I
${srcdir}/..
/src
${LDFLAGS} ${CFLAGS}
265 CPP_CFLAGS
= C_SWITCH_SYSTEM C_SWITCH_MACHINE
-DHAVE_CONFIG_H \
266 -I.
-I..
/src
-I
${srcdir} -I
${srcdir}/..
/src
${CPPFLAGS} ${CFLAGS}
267 /* This was
all of CPP_CFLAGS except
-Demacs.
268 Now that
-Demacs has been deleted from CPP_CFLAGS
,
269 this is actually the same
as CPP_CFLAGS
, but let
\'s not delete it yet.
*/
270 BASE_CFLAGS
= C_SWITCH_SYSTEM C_SWITCH_MACHINE
-DHAVE_CONFIG_H \
271 -I.
-I..
/src
-I
${srcdir} -I
${srcdir}/..
/src
${CPPFLAGS} ${CFLAGS}
275 /* This is the default compilation command.
276 But we should never rely on it
, because some make version
277 failed to find it for getopt.o.
278 Using an explicit command made it work.
*/
280 ${CC} -c
${CPP_CFLAGS} $<
284 $(CC
) -c
$(CPPFLAGS
) $(ALL_CFLAGS
) -fgnu-runtime
-Wno-import
-fconstant-string-class
=NSConstantString
$<
286 $(CC
) -c
$(CPPFLAGS
) $(ALL_CFLAGS
) $<
290 all: ${DONT_INSTALL} ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}
292 /* These targets copy the scripts into the build directory
293 so that they can be run from there in an uninstalled Emacs.
294 The
"-" is prepended because some versions of cp barf when
295 srcdir is the current directory
, and thus the file will be
296 copied into itself.
*/
297 rcs2log
: $(srcdir)/rcs2log
298 -cp
-p
$(srcdir)/rcs2log rcs2log
300 rcs-checkin
: $(srcdir)/rcs-checkin
301 -cp
-p
$(srcdir)/rcs-checkin rcs-checkin
303 grep-changelog
: $(srcdir)/grep-changelog
304 -cp
-p
$(srcdir)/grep-changelog grep-changelog
306 vcdiff
: $(srcdir)/vcdiff
307 -cp
-p
$(srcdir)/vcdiff vcdiff
309 #ifdef MOVEMAIL_NEEDS_BLESSING
311 $(EMACS
) $(EMACSOPT
) -l
$(srcdir)/..
/lisp
/mail
/blessmail.el
315 maybe-blessmail
: BLESSMAIL
316 #ifdef MOVEMAIL_NEEDS_BLESSING
317 /* Don
\'t charge ahead and do it
! Let the installer decide.
318 .
/blessmail
$(DESTDIR
)${archlibdir}/movemail
${EXEEXT} */
319 @if
[ `wc -l <blessmail` != 2 ] ; then \
320 dir=`sed -n -e 's/echo mail directory = \(.*\)/\1/p' blessmail`; \
321 echo Assuming
$$dir is really the mail spool directory
, you should
; \
322 echo run lib-src
/blessmail
$(DESTDIR
)${archlibdir}/movemail
${EXEEXT}; \
323 echo
as root
, to give movemail
${EXEEXT} appropriate permissions.
; \
324 echo Do that after running make
install.
; \
328 /* Install the internal utilities. Until they are installed
, we can
329 just run them directly from lib-src.
*/
330 $(DESTDIR
)${archlibdir}: all
332 @echo
"Installing utilities run internally by Emacs."
333 $(top_srcdir
)/mkinstalldirs
$(DESTDIR
)${archlibdir}
334 if
[ `(cd $(DESTDIR)${archlibdir} && /bin/pwd)` != `/bin/pwd` ]; then \
335 for file in
${UTILITIES}; do \
336 $(INSTALL_PROGRAM
) $(INSTALL_STRIP
) $$file $(DESTDIR
)${archlibdir}/$$file ; \
339 $(top_srcdir
)/mkinstalldirs
$(DESTDIR
)${gamedir}
340 touch
$(DESTDIR
)${gamedir}/snake-scores
341 touch
$(DESTDIR
)${gamedir}/tetris-scores
342 /* If the following commands fail
, that is not a big deal.
343 update-game-score will detect at runtime that it is not setuid
,
344 and handle things accordingly.
*/
345 -if chown
${gameuser} $(DESTDIR
)${archlibdir}/update-game-score
&& chmod u
+s
$(DESTDIR
)${archlibdir}/update-game-score
; then \
346 chown
${gameuser} $(DESTDIR
)${gamedir}; \
347 chmod u
=rwx
,g
=rwx
,o
=rx
$(DESTDIR
)${gamedir}; \
349 if
[ `(cd $(DESTDIR)${archlibdir} && /bin/pwd)` \
350 != `(cd ${srcdir} && /bin/pwd)` ]; then \
351 for file in
${SCRIPTS}; do \
352 $(INSTALL_SCRIPT
) ${srcdir}/$$file $(DESTDIR
)${archlibdir}/$$file; \
356 install: $(DESTDIR
)${archlibdir}
358 @echo
"Installing utilities for users to run."
359 for file in
${INSTALLABLES} ; do \
360 $(INSTALL_PROGRAM
) $(INSTALL_STRIP
) $${file} $(DESTDIR
)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \
361 chmod a
+rx
$(DESTDIR
)${bindir}/`echo $${file} | sed '$(TRANSFORM)'`; \
363 for file in
${INSTALLABLE_SCRIPTS} ; do \
364 $(INSTALL_SCRIPT
) ${srcdir}/$${file} $(DESTDIR
)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \
365 chmod a
+rx
$(DESTDIR
)${bindir}/`echo $${file} | sed '$(TRANSFORM)'`; \
369 (cd
$(DESTDIR
)${bindir}; \
370 for file in
${INSTALLABLES} ${INSTALLABLE_SCRIPTS}; do \
371 rm -f
$(DESTDIR
)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \
373 (cd
$(DESTDIR
)${archlibdir}; \
374 rm -f
${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS})
377 -rm -f core
*.o getopt.h getopt.h-t
380 -rm -f
${INSTALLABLES} ${UTILITIES} ${DONT_INSTALL}
381 -rm -f fns
*.el
*.tab.c
*.tab.h
385 -rm -f Makefile Makefile.c blessmail
387 maintainer-clean
: distclean
390 extraclean
: maintainer-clean
393 /* Test the contents of the directory.
*/
395 @echo
"We don't have any tests for GNU Emacs yet."
401 /* This verifies that the non-ASCII characters in the file \
`testfile\'
402 have not been clobbered by whatever means were used to copy and
403 distribute Emacs. If they were clobbered, all the .elc files were
405 test-distrib${EXEEXT}: ${srcdir}/test-distrib.c
406 $(CC) ${ALL_CFLAGS} -o test-distrib ${srcdir}/test-distrib.c
407 ./test-distrib ${srcdir}/testfile
409 /* We need the following in order to create a <getopt.h> when the system
410 does not have one that works with the given compiler. */
411 GETOPT_H = @GETOPT_H@
413 cp $(srcdir)/getopt_.h $@-t
416 GETOPTOBJS = @GETOPTOBJS@
417 GETOPTDEPS = $(GETOPTOBJS) $(GETOPT_H)
418 getopt.o: ${srcdir}/getopt.c $(GETOPT_H) ${srcdir}/gettext.h
419 ${CC} -c ${CPP_CFLAGS} ${srcdir}/getopt.c
420 getopt1.o: ${srcdir}/getopt1.c $(GETOPT_H)
421 ${CC} -c ${CPP_CFLAGS} ${srcdir}/getopt1.c
424 REGEXPDEPS = $(REGEXPOBJ) $(srcdir)/../src/regex.h
426 regex.o: $(srcdir)/../src/regex.c $(srcdir)/../src/regex.h ../src/config.h
427 ${CC} -c ${BASE_CFLAGS} -DCONFIG_BROKETS -DINHIBIT_STRING_HEADER ${srcdir}/../src/regex.c
429 etags${EXEEXT}: ${srcdir}/etags.c $(GETOPTDEPS) $(REGEXPDEPS) ../src/config.h
430 $(CC) ${ALL_CFLAGS} -DEMACS_NAME="\"GNU Emacs\"" -DVERSION="\"${version}\"" ${srcdir}/etags.c $(GETOPTOBJS) $(REGEXPOBJ) $(LOADLIBES) -o etags
432 ebrowse${EXEEXT}: ${srcdir}/ebrowse.c $(GETOPTDEPS) ../src/config.h
433 $(CC) ${ALL_CFLAGS} -DVERSION="\"${version}\"" ${srcdir}/ebrowse.c $(GETOPTOBJS) $(LOADLIBES) -o ebrowse
435 /* We depend on etags to assure that parallel makes don\'t write two
436 etags.o files on top of each other. */
437 ctags${EXEEXT}: etags${EXEEXT}
438 $(CC) ${ALL_CFLAGS} -DCTAGS -DEMACS_NAME="\"GNU Emacs\"" -DVERSION="\"${version}\"" ${srcdir}/etags.c $(GETOPTOBJS) $(REGEXPOBJ) $(LOADLIBES) -o ctags
440 profile${EXEEXT}: ${srcdir}/profile.c ../src/config.h
441 $(CC) ${ALL_CFLAGS} ${srcdir}/profile.c $(LOADLIBES) -o profile
443 make-docfile${EXEEXT}: ${srcdir}/make-docfile.c ../src/config.h
444 $(CC) ${ALL_CFLAGS} ${srcdir}/make-docfile.c $(LOADLIBES) -o make-docfile
446 digest-doc${EXEEXT}: ${srcdir}/digest-doc.c
447 $(CC) ${ALL_CFLAGS} ${srcdir}/digest-doc.c $(LOADLIBES) -o digest-doc
449 sorted-doc${EXEEXT}: ${srcdir}/sorted-doc.c
450 $(CC) ${ALL_CFLAGS} ${srcdir}/sorted-doc.c $(LOADLIBES) -o sorted-doc
452 b2m${EXEEXT}: ${srcdir}/b2m.c ../src/config.h $(GETOPTDEPS)
453 $(CC) ${ALL_CFLAGS} ${srcdir}/b2m.c -DVERSION="\"${version}\"" \
454 $(GETOPTOBJS) $(LOADLIBES) -o b2m
456 movemail${EXEEXT}: movemail.o pop.o $(GETOPTDEPS)
457 $(CC) ${LINK_CFLAGS} ${MOVE_FLAGS} movemail.o pop.o $(GETOPTOBJS) $(LOADLIBES) $(LIBS_MAIL) $(LIBS_MOVE) -o movemail
459 movemail.o: ${srcdir}/movemail.c ../src/config.h $(GETOPT_H)
460 $(CC) -c ${CPP_CFLAGS} -Demacs ${MOVE_FLAGS} ${srcdir}/movemail.c
462 pop.o: ${srcdir}/pop.c ../src/config.h
463 $(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/pop.c
465 cvtmail${EXEEXT}: ${srcdir}/cvtmail.c
466 $(CC) ${ALL_CFLAGS} ${srcdir}/cvtmail.c $(LOADLIBES) -o cvtmail
468 fakemail${EXEEXT}: ${srcdir}/fakemail.c ../src/config.h
469 $(CC) ${ALL_CFLAGS} ${srcdir}/fakemail.c $(LOADLIBES) -o fakemail
471 emacsclient${EXEEXT}: ${srcdir}/emacsclient.c ../src/config.h $(GETOPTDEPS)
472 $(CC) ${ALL_CFLAGS} ${srcdir}/emacsclient.c $(GETOPTOBJS) \
473 -DVERSION="\"${version}\"" \
474 $(LOADLIBES) -o emacsclient
476 hexl${EXEEXT}: ${srcdir}/hexl.c ../src/config.h
477 $(CC) ${ALL_CFLAGS} ${srcdir}/hexl.c $(LOADLIBES) -o hexl
479 update-game-score${EXEEXT}: update-game-score.o $(GETOPTDEPS)
480 $(CC) ${LINK_CFLAGS} ${MOVE_FLAGS} update-game-score.o $(GETOPTOBJS) $(LOADLIBES) -o update-game-score
482 update-game-score.o: ${srcdir}/update-game-score.c ../src/config.h $(GETOPT_H)
483 $(CC) -c ${CPP_CFLAGS} ${srcdir}/update-game-score.c \
484 -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\""
487 mac-fix-env: ${srcdir}/mac-fix-env.m
488 $(CC) -o mac-fix-env ${srcdir}/mac-fix-env.m -prebind -framework Foundation