If HAVE_X11, also HAVE_X_WINDOWS and HAVE_MENUS.
[bpt/emacs.git] / lib-src / Makefile.in
CommitLineData
eb4252f7 1# Makefile for lib-src subdirectory in GNU Emacs.
b3d90e46 2# Copyright (C) 1985, 1987, 1988, 1993, 1994, 2001, 2002, 2003, 2004,
f6c0ee20 3# 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
29ed0542 4
eb4252f7 5# This file is part of GNU Emacs.
29ed0542 6
294981c7 7# GNU Emacs is free software: you can redistribute it and/or modify
eb4252f7 8# it under the terms of the GNU General Public License as published by
294981c7
GM
9# the Free Software Foundation, either version 3 of the License, or
10# (at your option) any later version.
29ed0542 11
eb4252f7
RS
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.
29ed0542 16
eb4252f7 17# You should have received a copy of the GNU General Public License
294981c7
GM
18# along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
19
29ed0542 20
eb4252f7
RS
21# Avoid trouble on systems where the `SHELL' variable might be
22# inherited from the environment.
f7dbcf3c
JB
23SHELL = /bin/sh
24
70e48c86
GM
25# Following ../lisp/Makefile.in.
26EMACS = ../src/emacs
27EMACSOPT = -batch --no-site-file --multibyte
28
eb4252f7 29# ==================== Things `configure' will edit ====================
c71beb75 30
b93f2493
BF
31CC=@CC@
32CFLAGS=@CFLAGS@
b93f2493 33version=@version@
d3b23034 34## Used in $archlibdir.
cf770692 35configuration=@configuration@
108c7c97 36EXEEXT=@EXEEXT@
49628785
GM
37C_SWITCH_SYSTEM=@C_SWITCH_SYSTEM@
38C_SWITCH_MACHINE=@C_SWITCH_MACHINE@
c71beb75 39
a4663fed
PJ
40# Program name transformation.
41TRANSFORM = @program_transform_name@
42
eb4252f7 43# ==================== Where To Install Things ====================
c71beb75 44
eb4252f7
RS
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
49# `../configure'.
b93f2493 50prefix=@prefix@
c71beb75 51
eb4252f7
RS
52# Like `prefix', but used for architecture-specific files. This is
53# set with the --exec-prefix option to `../configure'.
b93f2493 54exec_prefix=@exec_prefix@
c71beb75 55
eb4252f7
RS
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
58# to `../configure'.
b93f2493 59bindir=@bindir@
c71beb75 60
eb4252f7
RS
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
424b6d2b
RS
64# --libexecdir option to `../configure'.
65libexecdir=@libexecdir@
c71beb75 66
712eaee0
AS
67# Directory for local state files for all programs.
68localstatedir=@localstatedir@
69
eb4252f7
RS
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.
5126d3b7
RS
74
75# We use $(srcdir) explicitly in dependencies so as not to depend on VPATH.
b93f2493
BF
76srcdir=@srcdir@
77VPATH=@srcdir@
c71beb75 78
2d521ee6
DM
79# The top-level source directory, also set by configure.
80top_srcdir=@top_srcdir@
81
eb4252f7 82# ==================== Emacs-specific directories ====================
c71beb75 83
eb4252f7
RS
84# These variables hold the values Emacs will actually use. They are
85# based on the values of the standard Make variables above.
c71beb75 86
eb4252f7
RS
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
91# to `../configure'.
b93f2493 92archlibdir=@archlibdir@
41f86d5a 93
1ba1fb11
CW
94gamedir=@gamedir@
95gameuser=@gameuser@
96
eb4252f7 97# ==================== Utility Programs for the Build =================
c71beb75 98
eb4252f7 99# ../configure figures out the correct values for these.
b93f2493 100INSTALL = @INSTALL@
b93f2493
BF
101INSTALL_PROGRAM = @INSTALL_PROGRAM@
102INSTALL_DATA = @INSTALL_DATA@
01c7d383 103INSTALL_SCRIPT = @INSTALL_SCRIPT@
ae6ed0ac
RS
104# By default, we uphold the dignity of our programs.
105INSTALL_STRIP =
c71beb75 106
eb4252f7 107# ========================== Lists of Files ===========================
f7dbcf3c 108
eb4252f7
RS
109# Things that a user might actually run,
110# which should be installed in bindir.
44b031a6 111INSTALLABLES = etags${EXEEXT} ctags${EXEEXT} emacsclient${EXEEXT} b2m${EXEEXT} ebrowse${EXEEXT}
e511d7f4 112INSTALLABLE_SCRIPTS = rcs-checkin grep-changelog
f7dbcf3c 113
eb4252f7
RS
114# Things that Emacs runs internally, or during the build process,
115# which should not be installed in bindir.
a8a8ec61
GM
116UTILITIES= profile${EXEEXT} digest-doc${EXEEXT} sorted-doc${EXEEXT} \
117 movemail${EXEEXT} fakemail${EXEEXT} \
8c09ed82 118 hexl${EXEEXT} update-game-score${EXEEXT}
f7dbcf3c 119
108c7c97 120DONT_INSTALL= test-distrib${EXEEXT} make-docfile${EXEEXT}
5aae6601 121
eb4252f7
RS
122# Like UTILITIES, but they're not system-dependent, and should not be
123# deleted by the distclean target.
b7cceaf1
JB
124SCRIPTS= rcs2log vcdiff
125
0d73e8e3 126EXECUTABLES= ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}
f7dbcf3c 127
aded53ff
GM
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
d3b23034
GM
131# set by configure should be correct and you should not need to do anything.
132# If neither flag is set, you need to use blessmail.
81f94052
RS
133MOVE_FLAGS=
134
7490175b
GM
135## Empty if either MAIL_USE_FLOCK or MAIL_USE_LOCKF, else need-blessmail.
136BLESSMAIL_TARGET=@BLESSMAIL_TARGET@
f6c0ee20 137
5e58e3a4
GM
138## -lkrb if HAVE_LIBKRB or -lkrb4 if HAVE_LIBKRB4
139KRB4LIB=@KRB4LIB@
140## -ldes if HAVE_LIBDES or -ldes425 if HAVE_LIBDES425
141DESLIB=@DESLIB@
142## -lkrb5 if HAVE_LIBKRB5
143KRB5LIB=@KRB5LIB@
144## -lk5crypto if HAVE_LIBK5CRYPTO or -lcrypto if HAVE_LIBCRYPTO
145CRYPTOLIB=@CRYPTOLIB@
146## -lcom_err if HAVE_LIBCOM_ERR
147COM_ERRLIB=@COM_ERRLIB@
148## -lhesiod if HAVE_LIBHESIOD
149LIBHESIOD=@LIBHESIOD@
150## -lresolv if HAVE_LIBRESOLV
151LIBRESOLV=@LIBRESOLV@
152## -llockfile if HAVE_LIBLOCKFILE or -lmail if HAVE_LIBMAIL
153LIBS_MAIL=@LIBS_MAIL@
154
155## Extra libraries to use when linking movemail.
156LIBS_MOVE = $(LIBS_MAIL) $(KRB4LIB) $(DESLIB) $(KRB5LIB) $(CRYPTOLIB) $(COM_ERRLIB) $(LIBHESIOD) $(LIBRESOLV)
157
97efb629
GM
158## Some systems define this to request special libraries.
159LIBS_SYSTEM = @LIBS_SYSTEM@
160
4794a582
DN
161# Those files shared with other GNU utilities need HAVE_CONFIG_H
162# defined before they know they can take advantage of the information
163# in ../src/config.h.
c88b05a9
GM
164BASE_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) -DHAVE_CONFIG_H -I. -I../src -I${srcdir} -I${srcdir}/../src
165
166ALL_CFLAGS = ${BASE_CFLAGS} ${LDFLAGS} ${CPPFLAGS} ${CFLAGS}
167LINK_CFLAGS = ${BASE_CFLAGS} ${LDFLAGS} ${CFLAGS}
168CPP_CFLAGS = ${BASE_CFLAGS} ${CPPFLAGS} ${CFLAGS}
5e58e3a4 169
97efb629 170LOADLIBES=$(LIBS_SYSTEM)
eb4252f7 171
29ed0542 172\f
d3b23034
GM
173## This is the default compilation command.
174## But we should never rely on it, because some make version failed to
175## find it for getopt.o.
176## Using an explicit command made it work.
c38a040d 177.c.o:
5293b432 178 ${CC} -c ${CPP_CFLAGS} $<
122e9f8f 179
ee978ec9
RS
180all: ${DONT_INSTALL} ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}
181
d3b23034
GM
182## These targets copy the scripts into the build directory so that
183## they can be run from there in an uninstalled Emacs.
184## The "-" is prepended because some versions of cp barf when srcdir
185## is the current directory, and thus the file will be copied into itself.
ee978ec9 186rcs2log: $(srcdir)/rcs2log
ca4ea90f 187 -cp -p $(srcdir)/rcs2log rcs2log
ee978ec9
RS
188
189rcs-checkin: $(srcdir)/rcs-checkin
ca4ea90f 190 -cp -p $(srcdir)/rcs-checkin rcs-checkin
ee978ec9
RS
191
192grep-changelog: $(srcdir)/grep-changelog
ca4ea90f 193 -cp -p $(srcdir)/grep-changelog grep-changelog
ee978ec9
RS
194
195vcdiff: $(srcdir)/vcdiff
ca4ea90f 196 -cp -p $(srcdir)/vcdiff vcdiff
c71beb75 197
d3b23034
GM
198## Only used if we need blessmail, but no harm in always defining.
199## This makes the actual blessmail executable.
f675ecb5 200blessmail:
70e48c86 201 $(EMACS) $(EMACSOPT) -l $(srcdir)/../lisp/mail/blessmail.el
c6207d0d 202 chmod +x blessmail
c6207d0d 203
d3b23034
GM
204## This checks if we need to run blessmail.
205## Do not charge ahead and do it! Let the installer decide.
f6c0ee20 206need-blessmail: blessmail
d19f95fe
RS
207 @if [ `wc -l <blessmail` != 2 ] ; then \
208 dir=`sed -n -e 's/echo mail directory = \(.*\)/\1/p' blessmail`; \
209 echo Assuming $$dir is really the mail spool directory, you should; \
81af9060 210 echo run lib-src/blessmail $(DESTDIR)${archlibdir}/movemail${EXEEXT}; \
108c7c97 211 echo as root, to give movemail${EXEEXT} appropriate permissions.; \
eb4252f7 212 echo Do that after running make install.; \
d19f95fe 213 fi
f6c0ee20 214
d3b23034 215## This is the target invoked by the top-level Makefile.
f6c0ee20 216maybe-blessmail: $(BLESSMAIL_TARGET)
d19f95fe 217
d3b23034
GM
218## Install the internal utilities. Until they are installed, we can
219## just run them directly from lib-src.
220## If the chown/chmod commands fail, that is not a big deal.
221## update-game-score will detect at runtime that it is not setuid,
222## and handle things accordingly.
81af9060 223$(DESTDIR)${archlibdir}: all
c71beb75
JB
224 @echo
225 @echo "Installing utilities run internally by Emacs."
c5a139ca 226 umask 022; $(top_srcdir)/mkinstalldirs $(DESTDIR)${archlibdir}
81af9060 227 if [ `(cd $(DESTDIR)${archlibdir} && /bin/pwd)` != `/bin/pwd` ]; then \
544d556f 228 for file in ${UTILITIES}; do \
81af9060 229 $(INSTALL_PROGRAM) $(INSTALL_STRIP) $$file $(DESTDIR)${archlibdir}/$$file ; \
544d556f 230 done ; \
ad600343 231 fi
c5a139ca
GM
232 umask 022; $(top_srcdir)/mkinstalldirs $(DESTDIR)${gamedir}; \
233 touch $(DESTDIR)${gamedir}/snake-scores; \
81af9060 234 touch $(DESTDIR)${gamedir}/tetris-scores
81af9060
EZ
235 -if chown ${gameuser} $(DESTDIR)${archlibdir}/update-game-score && chmod u+s $(DESTDIR)${archlibdir}/update-game-score; then \
236 chown ${gameuser} $(DESTDIR)${gamedir}; \
237 chmod u=rwx,g=rwx,o=rx $(DESTDIR)${gamedir}; \
7451222f 238 fi
81af9060 239 if [ `(cd $(DESTDIR)${archlibdir} && /bin/pwd)` \
ad600343 240 != `(cd ${srcdir} && /bin/pwd)` ]; then \
544d556f 241 for file in ${SCRIPTS}; do \
01c7d383 242 $(INSTALL_SCRIPT) ${srcdir}/$$file $(DESTDIR)${archlibdir}/$$file; \
c71beb75 243 done ; \
0268f19b 244 fi
f7dbcf3c 245
81af9060 246install: $(DESTDIR)${archlibdir}
c71beb75
JB
247 @echo
248 @echo "Installing utilities for users to run."
b70cff71 249 for file in ${INSTALLABLES} ; do \
81af9060
EZ
250 $(INSTALL_PROGRAM) $(INSTALL_STRIP) $${file} $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \
251 chmod a+rx $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'`; \
0268f19b 252 done
b70cff71 253 for file in ${INSTALLABLE_SCRIPTS} ; do \
01c7d383 254 $(INSTALL_SCRIPT) ${srcdir}/$${file} $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \
81af9060 255 chmod a+rx $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'`; \
0268f19b 256 done
f7dbcf3c 257
39b649dd 258uninstall:
81af9060 259 (cd $(DESTDIR)${bindir}; \
a4663fed 260 for file in ${INSTALLABLES} ${INSTALLABLE_SCRIPTS}; do \
81af9060 261 rm -f $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \
a4663fed 262 done)
f8388570
TO
263 if [ -d $(DESTDIR)${archlibdir} ]; then \
264 (cd $(DESTDIR)${archlibdir} && \
265 rm -f ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}) \
266 fi
39b649dd 267
a17d2c25 268mostlyclean:
9eff9fe3 269 -rm -f core *.o getopt.h getopt.h-t
a17d2c25
RS
270
271clean: mostlyclean
5aae6601 272 -rm -f ${INSTALLABLES} ${UTILITIES} ${DONT_INSTALL}
1405e9d0 273 -rm -f fns*.el *.tab.c *.tab.h
f7dbcf3c 274
39b649dd 275distclean: clean
5c579a75 276 -rm -f TAGS
b2959c9d 277 -rm -f Makefile Makefile.c blessmail
f7dbcf3c 278
26873b72 279maintainer-clean: distclean
39b649dd 280 true
c71beb75 281
a01c76d7 282extraclean: maintainer-clean
c71beb75 283 -rm -f *~ \#*
f7dbcf3c 284
d3b23034 285## Test the contents of the directory.
f7dbcf3c 286check:
c88b05a9 287 @echo "We don't have any tests for the lib-src/ directory yet."
f7dbcf3c 288
93548af1 289tags: TAGS
108c7c97 290TAGS: etags${EXEEXT}
f7dbcf3c
JB
291 etags *.[ch]
292
d3b23034
GM
293## This verifies that the non-ASCII characters in the file \`testfile\'
294## have not been clobbered by whatever means were used to copy and
295## distribute Emacs. If they were clobbered, all the .elc files were
296## clobbered too.
108c7c97 297test-distrib${EXEEXT}: ${srcdir}/test-distrib.c
c88a7f88 298 $(CC) ${ALL_CFLAGS} -o test-distrib ${srcdir}/test-distrib.c
0d73e8e3 299 ./test-distrib ${srcdir}/testfile
f7dbcf3c 300
d3b23034
GM
301## We need the following in order to create a <getopt.h> when the system
302## does not have one that works with the given compiler.
9eff9fe3
PE
303GETOPT_H = @GETOPT_H@
304getopt.h: getopt_.h
305 cp $(srcdir)/getopt_.h $@-t
306 mv $@-t $@
307
308GETOPTOBJS = @GETOPTOBJS@
309GETOPTDEPS = $(GETOPTOBJS) $(GETOPT_H)
310getopt.o: ${srcdir}/getopt.c $(GETOPT_H) ${srcdir}/gettext.h
0268f19b 311 ${CC} -c ${CPP_CFLAGS} ${srcdir}/getopt.c
9eff9fe3 312getopt1.o: ${srcdir}/getopt1.c $(GETOPT_H)
0268f19b 313 ${CC} -c ${CPP_CFLAGS} ${srcdir}/getopt1.c
f7dbcf3c 314
66ab94d9 315REGEXPOBJ = regex.o
5126d3b7 316REGEXPDEPS = $(REGEXPOBJ) $(srcdir)/../src/regex.h
e63ceebf 317
5126d3b7 318regex.o: $(srcdir)/../src/regex.c $(srcdir)/../src/regex.h ../src/config.h
aded53ff 319 ${CC} -c ${CPP_CFLAGS} -DCONFIG_BROKETS -DINHIBIT_STRING_HEADER ${srcdir}/../src/regex.c
66ab94d9 320
108c7c97 321etags${EXEEXT}: ${srcdir}/etags.c $(GETOPTDEPS) $(REGEXPDEPS) ../src/config.h
63b9b605 322 $(CC) ${ALL_CFLAGS} -DEMACS_NAME="\"GNU Emacs\"" -DVERSION="\"${version}\"" ${srcdir}/etags.c $(GETOPTOBJS) $(REGEXPOBJ) $(LOADLIBES) -o etags
f7dbcf3c 323
108c7c97 324ebrowse${EXEEXT}: ${srcdir}/ebrowse.c $(GETOPTDEPS) ../src/config.h
adb0a8d3
GM
325 $(CC) ${ALL_CFLAGS} -DVERSION="\"${version}\"" ${srcdir}/ebrowse.c $(GETOPTOBJS) $(LOADLIBES) -o ebrowse
326
d3b23034
GM
327## We depend on etags to assure that parallel makes do not write two
328## etags.o files on top of each other.
108c7c97 329ctags${EXEEXT}: etags${EXEEXT}
63b9b605 330 $(CC) ${ALL_CFLAGS} -DCTAGS -DEMACS_NAME="\"GNU Emacs\"" -DVERSION="\"${version}\"" ${srcdir}/etags.c $(GETOPTOBJS) $(REGEXPOBJ) $(LOADLIBES) -o ctags
f7dbcf3c 331
108c7c97 332profile${EXEEXT}: ${srcdir}/profile.c ../src/config.h
379fb9c8
RS
333 $(CC) ${ALL_CFLAGS} ${srcdir}/profile.c $(LOADLIBES) -o profile
334
108c7c97 335make-docfile${EXEEXT}: ${srcdir}/make-docfile.c ../src/config.h
3e883207 336 $(CC) ${ALL_CFLAGS} ${srcdir}/make-docfile.c $(LOADLIBES) -o make-docfile
f7dbcf3c 337
108c7c97 338digest-doc${EXEEXT}: ${srcdir}/digest-doc.c
c60ee5e7 339 $(CC) ${ALL_CFLAGS} ${srcdir}/digest-doc.c $(LOADLIBES) -o digest-doc
f7dbcf3c 340
ac06b30b
DL
341sorted-doc${EXEEXT}: ${srcdir}/sorted-doc.c
342 $(CC) ${ALL_CFLAGS} ${srcdir}/sorted-doc.c $(LOADLIBES) -o sorted-doc
f7dbcf3c 343
108c7c97 344b2m${EXEEXT}: ${srcdir}/b2m.c ../src/config.h $(GETOPTDEPS)
1817145f 345 $(CC) ${ALL_CFLAGS} ${srcdir}/b2m.c -DVERSION="\"${version}\"" \
c60ee5e7 346 $(GETOPTOBJS) $(LOADLIBES) -o b2m
f7dbcf3c 347
108c7c97 348movemail${EXEEXT}: movemail.o pop.o $(GETOPTDEPS)
5e58e3a4 349 $(CC) ${LINK_CFLAGS} ${MOVE_FLAGS} movemail.o pop.o $(GETOPTOBJS) $(LOADLIBES) $(LIBS_MOVE) -o movemail
81f94052 350
d3b23034 351## We need to define emacs to get the right version of something (what?).
9eff9fe3 352movemail.o: ${srcdir}/movemail.c ../src/config.h $(GETOPT_H)
f5f20f6c 353 $(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/movemail.c
81f94052 354
93c8d183 355pop.o: ${srcdir}/pop.c ../src/config.h
81f94052 356 $(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/pop.c
f7dbcf3c 357
108c7c97 358fakemail${EXEEXT}: ${srcdir}/fakemail.c ../src/config.h
3e883207 359 $(CC) ${ALL_CFLAGS} ${srcdir}/fakemail.c $(LOADLIBES) -o fakemail
f7dbcf3c 360
108c7c97 361emacsclient${EXEEXT}: ${srcdir}/emacsclient.c ../src/config.h $(GETOPTDEPS)
deec6f99 362 $(CC) ${ALL_CFLAGS} ${srcdir}/emacsclient.c $(GETOPTOBJS) \
c2bcfb19 363 -DVERSION="\"${version}\"" \
deec6f99 364 $(LOADLIBES) -o emacsclient
f7dbcf3c 365
108c7c97 366hexl${EXEEXT}: ${srcdir}/hexl.c ../src/config.h
3e883207 367 $(CC) ${ALL_CFLAGS} ${srcdir}/hexl.c $(LOADLIBES) -o hexl
f7dbcf3c 368
f85d3f3f 369update-game-score${EXEEXT}: update-game-score.o $(GETOPTDEPS)
c88b05a9 370 $(CC) ${LINK_CFLAGS} update-game-score.o $(GETOPTOBJS) $(LOADLIBES) -o update-game-score
f85d3f3f
RS
371
372update-game-score.o: ${srcdir}/update-game-score.c ../src/config.h $(GETOPT_H)
373 $(CC) -c ${CPP_CFLAGS} ${srcdir}/update-game-score.c \
30cfcf7f 374 -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\""
d3b23034
GM
375
376## Makefile ends here.