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