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, 2009, 2010
4 # Free Software Foundation, Inc.
6 # This file is part of GNU Emacs.
8 # GNU Emacs is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation, either version 3 of the License, or
11 # (at your option) any later version.
13 # GNU Emacs is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
22 # Avoid trouble on systems where the `SHELL' variable might be
23 # inherited from the environment.
26 # Following ../lisp/Makefile.in.
28 EMACSOPT
= -batch
--no-site-file
--multibyte
30 # ==================== Things `configure' will edit ====================
35 configuration
=@configuration@
37 C_SWITCH_SYSTEM
=@c_switch_system@
38 C_SWITCH_MACHINE
=@c_switch_machine@
40 # Program name transformation.
41 TRANSFORM
= @program_transform_name@
43 # ==================== Where To Install Things ====================
45 # The default location for installation. Everything is placed in
46 # subdirectories of this directory. The default values for many of
47 # the variables below are expressed in terms of this one, so you may
48 # not need to change them. This is set with the --prefix option to
52 # Like `prefix', but used for architecture-specific files. This is
53 # set with the --exec-prefix option to `../configure'.
54 exec_prefix=@
exec_prefix@
56 # Where to install Emacs and other binaries that people will want to
57 # run directly (like etags). This is set with the --bindir option
61 # Where to install and expect executable files to be run by Emacs
62 # rather than directly by users, and other architecture-dependent
63 # data. ${archlibdir} is usually below this. This is set with the
64 # --libexecdir option to `../configure'.
65 libexecdir
=@libexecdir@
67 # Directory for local state files for all programs.
68 localstatedir
=@localstatedir@
70 # Where to find the source code. This is set by the configure
71 # script's `--srcdir' option. However, the value of ${srcdir} in
72 # this makefile is not identical to what was specified with --srcdir,
73 # since the variable here has `/lib-src' added at the end.
75 # We use $(srcdir) explicitly in dependencies so as not to depend on VPATH.
79 # The top-level source directory, also set by configure.
80 top_srcdir
=@top_srcdir@
82 # ==================== Emacs-specific directories ====================
84 # These variables hold the values Emacs will actually use. They are
85 # based on the values of the standard Make variables above.
87 # Where to put executables to be run by Emacs rather than the user.
88 # This path usually includes the Emacs version and configuration name,
89 # so that multiple configurations for multiple versions of Emacs may
90 # be installed at once. This can be set with the --archlibdir option
92 archlibdir
=@archlibdir@
97 # ==================== Utility Programs for the Build =================
99 # ../configure figures out the correct values for these.
101 INSTALL_PROGRAM
= @INSTALL_PROGRAM@
102 INSTALL_DATA
= @INSTALL_DATA@
103 INSTALL_SCRIPT
= @INSTALL_SCRIPT@
104 # By default, we uphold the dignity of our programs.
107 # ========================== Lists of Files ===========================
109 # Things that a user might actually run,
110 # which should be installed in bindir.
111 INSTALLABLES
= etags
${EXEEXT} ctags
${EXEEXT} emacsclient
${EXEEXT} b2m
${EXEEXT} ebrowse
${EXEEXT} @LIB_SRC_EXTRA_INSTALLABLES@
112 INSTALLABLE_SCRIPTS
= rcs-checkin grep-changelog
114 # Things that Emacs runs internally, or during the build process,
115 # which should not be installed in bindir.
116 UTILITIES
= profile
${EXEEXT} digest-doc
${EXEEXT} sorted-doc
${EXEEXT} \
117 movemail
${EXEEXT} fakemail
${EXEEXT} \
118 hexl
${EXEEXT} update-game-score
${EXEEXT}
120 DONT_INSTALL
= test-distrib
${EXEEXT} make-docfile
${EXEEXT}
122 # Like UTILITIES, but they're not system-dependent, and should not be
123 # deleted by the distclean target.
124 SCRIPTS
= rcs2log vcdiff
126 EXECUTABLES
= ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}
128 # Specify additional -D flags for movemail. Options:
129 # -DMAIL_USE_FLOCK or -DMAIL_USE_LOCKF (use flock or lockf for file locking).
130 # See the comments about locking in movemail.c. Normally the values
131 # in ../src/[ms]/*.h should be correct and you should not need to do anything.
132 # If neither flag is set, blessmail is used.
135 ## -lkrb if HAVE_LIBKRB or -lkrb4 if HAVE_LIBKRB4
137 ## -ldes if HAVE_LIBDES or -ldes425 if HAVE_LIBDES425
139 ## -lkrb5 if HAVE_LIBKRB5
141 ## -lk5crypto if HAVE_LIBK5CRYPTO or -lcrypto if HAVE_LIBCRYPTO
142 CRYPTOLIB
=@CRYPTOLIB@
143 ## -lcom_err if HAVE_LIBCOM_ERR
144 COM_ERRLIB
=@COM_ERRLIB@
145 ## -lhesiod if HAVE_LIBHESIOD
146 LIBHESIOD
=@LIBHESIOD@
147 ## -lresolv if HAVE_LIBRESOLV
148 LIBRESOLV
=@LIBRESOLV@
149 ## -llockfile if HAVE_LIBLOCKFILE or -lmail if HAVE_LIBMAIL
150 LIBS_MAIL
=@LIBS_MAIL@
152 ## Extra libraries to use when linking movemail.
153 LIBS_MOVE
= $(LIBS_MAIL
) $(KRB4LIB
) $(DESLIB
) $(KRB5LIB
) $(CRYPTOLIB
) $(COM_ERRLIB
) $(LIBHESIOD
) $(LIBRESOLV
)
155 # Those files shared with other GNU utilities need HAVE_CONFIG_H
156 # defined before they know they can take advantage of the information
157 # in ../src/config.h.
158 ALL_CFLAGS
= $(C_SWITCH_SYSTEM
) $(C_SWITCH_MACHINE
) -DHAVE_CONFIG_H
-I.
-I..
/src
-I
${srcdir} -I
${srcdir}/..
/src
${LDFLAGS} ${CPPFLAGS} ${CFLAGS}
159 LINK_CFLAGS
= $(C_SWITCH_SYSTEM
) $(C_SWITCH_MACHINE
) -DHAVE_CONFIG_H
-I.
-I..
/src
-I
${srcdir} -I
${srcdir}/..
/src
${LDFLAGS} ${CFLAGS}
160 CPP_CFLAGS
= $(C_SWITCH_SYSTEM
) $(C_SWITCH_MACHINE
) -DHAVE_CONFIG_H
-I.
-I..
/src
-I
${srcdir} -I
${srcdir}/..
/src
${CPPFLAGS} ${CFLAGS}
162 # ========================== start of cpp stuff =======================
163 /* From here on
, comments must be done in C syntax.
*/
165 #define THIS_IS_MAKEFILE
167 #include "../src/config.h"
169 /* Some s
/SYSTEM.h files
define this to request special libraries.
*/
174 #undef MOVEMAIL_NEEDS_BLESSING
175 #ifndef MAIL_USE_FLOCK
176 #ifndef MAIL_USE_LOCKF
177 #define MOVEMAIL_NEEDS_BLESSING
181 #ifdef MOVEMAIL_NEEDS_BLESSING
182 #define BLESSMAIL blessmail
187 LOADLIBES
=LIBS_SYSTEM
192 /* This is the default compilation command.
193 But we should never rely on it
, because some make version
194 failed to find it for getopt.o.
195 Using an explicit command made it work.
*/
197 ${CC} -c
${CPP_CFLAGS} $<
200 $(CC
) -c
$(CPPFLAGS
) $(ALL_CFLAGS
) $<
202 all: ${DONT_INSTALL} ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}
204 /* These targets copy the scripts into the build directory
205 so that they can be run from there in an uninstalled Emacs.
206 The
"-" is prepended because some versions of cp barf when
207 srcdir is the current directory
, and thus the file will be
208 copied into itself.
*/
209 rcs2log
: $(srcdir)/rcs2log
210 -cp
-p
$(srcdir)/rcs2log rcs2log
212 rcs-checkin
: $(srcdir)/rcs-checkin
213 -cp
-p
$(srcdir)/rcs-checkin rcs-checkin
215 grep-changelog
: $(srcdir)/grep-changelog
216 -cp
-p
$(srcdir)/grep-changelog grep-changelog
218 vcdiff
: $(srcdir)/vcdiff
219 -cp
-p
$(srcdir)/vcdiff vcdiff
221 #ifdef MOVEMAIL_NEEDS_BLESSING
223 $(EMACS
) $(EMACSOPT
) -l
$(srcdir)/..
/lisp
/mail
/blessmail.el
227 maybe-blessmail
: BLESSMAIL
228 #ifdef MOVEMAIL_NEEDS_BLESSING
229 /* Don
\'t charge ahead and do it
! Let the installer decide.
230 .
/blessmail
$(DESTDIR
)${archlibdir}/movemail
${EXEEXT} */
231 @if
[ `wc -l <blessmail` != 2 ] ; then \
232 dir=`sed -n -e 's/echo mail directory = \(.*\)/\1/p' blessmail`; \
233 echo Assuming
$$dir is really the mail spool directory
, you should
; \
234 echo run lib-src
/blessmail
$(DESTDIR
)${archlibdir}/movemail
${EXEEXT}; \
235 echo
as root
, to give movemail
${EXEEXT} appropriate permissions.
; \
236 echo Do that after running make
install.
; \
240 /* Install the internal utilities. Until they are installed
, we can
241 just run them directly from lib-src.
*/
242 $(DESTDIR
)${archlibdir}: all
244 @echo
"Installing utilities run internally by Emacs."
245 umask
022; $(top_srcdir
)/mkinstalldirs
$(DESTDIR
)${archlibdir}
246 if
[ `(cd $(DESTDIR)${archlibdir} && /bin/pwd)` != `/bin/pwd` ]; then \
247 for file in
${UTILITIES}; do \
248 $(INSTALL_PROGRAM
) $(INSTALL_STRIP
) $$file $(DESTDIR
)${archlibdir}/$$file ; \
251 umask
022; $(top_srcdir
)/mkinstalldirs
$(DESTDIR
)${gamedir}; \
252 touch
$(DESTDIR
)${gamedir}/snake-scores
; \
253 touch
$(DESTDIR
)${gamedir}/tetris-scores
254 /* If the following commands fail
, that is not a big deal.
255 update-game-score will detect at runtime that it is not setuid
,
256 and handle things accordingly.
*/
257 -if chown
${gameuser} $(DESTDIR
)${archlibdir}/update-game-score
&& chmod u
+s
$(DESTDIR
)${archlibdir}/update-game-score
; then \
258 chown
${gameuser} $(DESTDIR
)${gamedir}; \
259 chmod u
=rwx
,g
=rwx
,o
=rx
$(DESTDIR
)${gamedir}; \
261 if
[ `(cd $(DESTDIR)${archlibdir} && /bin/pwd)` \
262 != `(cd ${srcdir} && /bin/pwd)` ]; then \
263 for file in
${SCRIPTS}; do \
264 $(INSTALL_SCRIPT
) ${srcdir}/$$file $(DESTDIR
)${archlibdir}/$$file; \
268 install: $(DESTDIR
)${archlibdir}
270 @echo
"Installing utilities for users to run."
271 for file in
${INSTALLABLES} ; do \
272 $(INSTALL_PROGRAM
) $(INSTALL_STRIP
) $${file} $(DESTDIR
)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \
273 chmod a
+rx
$(DESTDIR
)${bindir}/`echo $${file} | sed '$(TRANSFORM)'`; \
275 for file in
${INSTALLABLE_SCRIPTS} ; do \
276 $(INSTALL_SCRIPT
) ${srcdir}/$${file} $(DESTDIR
)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \
277 chmod a
+rx
$(DESTDIR
)${bindir}/`echo $${file} | sed '$(TRANSFORM)'`; \
281 (cd
$(DESTDIR
)${bindir}; \
282 for file in
${INSTALLABLES} ${INSTALLABLE_SCRIPTS}; do \
283 rm -f
$(DESTDIR
)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \
285 if
[ -d
$(DESTDIR
)${archlibdir} ]; then \
286 (cd
$(DESTDIR
)${archlibdir} && \
287 rm -f
${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}) \
291 -rm -f core
*.o getopt.h getopt.h-t
294 -rm -f
${INSTALLABLES} ${UTILITIES} ${DONT_INSTALL}
295 -rm -f fns
*.el
*.tab.c
*.tab.h
299 -rm -f Makefile Makefile.c blessmail
301 maintainer-clean
: distclean
304 extraclean
: maintainer-clean
307 /* Test the contents of the directory.
*/
309 @echo
"We don't have any tests for GNU Emacs yet."
315 /* This verifies that the non-ASCII characters in the file \
`testfile\'
316 have not been clobbered by whatever means were used to copy and
317 distribute Emacs. If they were clobbered, all the .elc files were
319 test-distrib${EXEEXT}: ${srcdir}/test-distrib.c
320 $(CC) ${ALL_CFLAGS} -o test-distrib ${srcdir}/test-distrib.c
321 ./test-distrib ${srcdir}/testfile
323 /* We need the following in order to create a <getopt.h> when the system
324 does not have one that works with the given compiler. */
325 GETOPT_H = @GETOPT_H@
327 cp $(srcdir)/getopt_.h $@-t
330 GETOPTOBJS = @GETOPTOBJS@
331 GETOPTDEPS = $(GETOPTOBJS) $(GETOPT_H)
332 getopt.o: ${srcdir}/getopt.c $(GETOPT_H) ${srcdir}/gettext.h
333 ${CC} -c ${CPP_CFLAGS} ${srcdir}/getopt.c
334 getopt1.o: ${srcdir}/getopt1.c $(GETOPT_H)
335 ${CC} -c ${CPP_CFLAGS} ${srcdir}/getopt1.c
338 REGEXPDEPS = $(REGEXPOBJ) $(srcdir)/../src/regex.h
340 regex.o: $(srcdir)/../src/regex.c $(srcdir)/../src/regex.h ../src/config.h
341 ${CC} -c ${CPP_CFLAGS} -DCONFIG_BROKETS -DINHIBIT_STRING_HEADER ${srcdir}/../src/regex.c
343 etags${EXEEXT}: ${srcdir}/etags.c $(GETOPTDEPS) $(REGEXPDEPS) ../src/config.h
344 $(CC) ${ALL_CFLAGS} -DEMACS_NAME="\"GNU Emacs\"" -DVERSION="\"${version}\"" ${srcdir}/etags.c $(GETOPTOBJS) $(REGEXPOBJ) $(LOADLIBES) -o etags
346 ebrowse${EXEEXT}: ${srcdir}/ebrowse.c $(GETOPTDEPS) ../src/config.h
347 $(CC) ${ALL_CFLAGS} -DVERSION="\"${version}\"" ${srcdir}/ebrowse.c $(GETOPTOBJS) $(LOADLIBES) -o ebrowse
349 /* We depend on etags to assure that parallel makes don\'t write two
350 etags.o files on top of each other. */
351 ctags${EXEEXT}: etags${EXEEXT}
352 $(CC) ${ALL_CFLAGS} -DCTAGS -DEMACS_NAME="\"GNU Emacs\"" -DVERSION="\"${version}\"" ${srcdir}/etags.c $(GETOPTOBJS) $(REGEXPOBJ) $(LOADLIBES) -o ctags
354 profile${EXEEXT}: ${srcdir}/profile.c ../src/config.h
355 $(CC) ${ALL_CFLAGS} ${srcdir}/profile.c $(LOADLIBES) -o profile
357 make-docfile${EXEEXT}: ${srcdir}/make-docfile.c ../src/config.h
358 $(CC) ${ALL_CFLAGS} ${srcdir}/make-docfile.c $(LOADLIBES) -o make-docfile
360 digest-doc${EXEEXT}: ${srcdir}/digest-doc.c
361 $(CC) ${ALL_CFLAGS} ${srcdir}/digest-doc.c $(LOADLIBES) -o digest-doc
363 sorted-doc${EXEEXT}: ${srcdir}/sorted-doc.c
364 $(CC) ${ALL_CFLAGS} ${srcdir}/sorted-doc.c $(LOADLIBES) -o sorted-doc
366 b2m${EXEEXT}: ${srcdir}/b2m.c ../src/config.h $(GETOPTDEPS)
367 $(CC) ${ALL_CFLAGS} ${srcdir}/b2m.c -DVERSION="\"${version}\"" \
368 $(GETOPTOBJS) $(LOADLIBES) -o b2m
370 movemail${EXEEXT}: movemail.o pop.o $(GETOPTDEPS)
371 $(CC) ${LINK_CFLAGS} ${MOVE_FLAGS} movemail.o pop.o $(GETOPTOBJS) $(LOADLIBES) $(LIBS_MOVE) -o movemail
373 /* We need to define emacs to get the right version of something (what?). */
374 movemail.o: ${srcdir}/movemail.c ../src/config.h $(GETOPT_H)
375 $(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/movemail.c
377 pop.o: ${srcdir}/pop.c ../src/config.h
378 $(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/pop.c
380 fakemail${EXEEXT}: ${srcdir}/fakemail.c ../src/config.h
381 $(CC) ${ALL_CFLAGS} ${srcdir}/fakemail.c $(LOADLIBES) -o fakemail
383 emacsclient${EXEEXT}: ${srcdir}/emacsclient.c ../src/config.h $(GETOPTDEPS)
384 $(CC) ${ALL_CFLAGS} ${srcdir}/emacsclient.c $(GETOPTOBJS) \
385 -DVERSION="\"${version}\"" \
386 $(LOADLIBES) -o emacsclient
388 hexl${EXEEXT}: ${srcdir}/hexl.c ../src/config.h
389 $(CC) ${ALL_CFLAGS} ${srcdir}/hexl.c $(LOADLIBES) -o hexl
391 update-game-score${EXEEXT}: update-game-score.o $(GETOPTDEPS)
392 $(CC) ${LINK_CFLAGS} ${MOVE_FLAGS} update-game-score.o $(GETOPTOBJS) $(LOADLIBES) -o update-game-score
394 update-game-score.o: ${srcdir}/update-game-score.c ../src/config.h $(GETOPT_H)
395 $(CC) -c ${CPP_CFLAGS} ${srcdir}/update-game-score.c \
396 -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\""