Fix typos.
[bpt/emacs.git] / lib-src / Makefile.in
CommitLineData
eb4252f7 1# Makefile for lib-src subdirectory in GNU Emacs.
73b0cd50 2# Copyright (C) 1985, 1987-1988, 1993-1994, 2001-2011
3fb78d1f 3# 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
e7a42417 27EMACSOPT = -batch --no-site-file --no-site-lisp
70e48c86 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@
e6cfa7c3
AS
39C_WARNINGS_SWITCH = @C_WARNINGS_SWITCH@
40PROFILING_CFLAGS = @PROFILING_CFLAGS@
c71beb75 41
a4663fed
PJ
42# Program name transformation.
43TRANSFORM = @program_transform_name@
44
eb4252f7 45# ==================== Where To Install Things ====================
c71beb75 46
eb4252f7
RS
47# The default location for installation. Everything is placed in
48# subdirectories of this directory. The default values for many of
49# the variables below are expressed in terms of this one, so you may
50# not need to change them. This is set with the --prefix option to
51# `../configure'.
b93f2493 52prefix=@prefix@
c71beb75 53
eb4252f7
RS
54# Like `prefix', but used for architecture-specific files. This is
55# set with the --exec-prefix option to `../configure'.
b93f2493 56exec_prefix=@exec_prefix@
c71beb75 57
eb4252f7
RS
58# Where to install Emacs and other binaries that people will want to
59# run directly (like etags). This is set with the --bindir option
60# to `../configure'.
b93f2493 61bindir=@bindir@
c71beb75 62
eb4252f7
RS
63# Where to install and expect executable files to be run by Emacs
64# rather than directly by users, and other architecture-dependent
65# data. ${archlibdir} is usually below this. This is set with the
424b6d2b
RS
66# --libexecdir option to `../configure'.
67libexecdir=@libexecdir@
c71beb75 68
712eaee0
AS
69# Directory for local state files for all programs.
70localstatedir=@localstatedir@
71
eb4252f7
RS
72# Where to find the source code. This is set by the configure
73# script's `--srcdir' option. However, the value of ${srcdir} in
74# this makefile is not identical to what was specified with --srcdir,
75# since the variable here has `/lib-src' added at the end.
5126d3b7
RS
76
77# We use $(srcdir) explicitly in dependencies so as not to depend on VPATH.
b93f2493
BF
78srcdir=@srcdir@
79VPATH=@srcdir@
c71beb75 80
2d521ee6
DM
81# The top-level source directory, also set by configure.
82top_srcdir=@top_srcdir@
83
eb4252f7 84# ==================== Emacs-specific directories ====================
c71beb75 85
eb4252f7
RS
86# These variables hold the values Emacs will actually use. They are
87# based on the values of the standard Make variables above.
c71beb75 88
eb4252f7
RS
89# Where to put executables to be run by Emacs rather than the user.
90# This path usually includes the Emacs version and configuration name,
91# so that multiple configurations for multiple versions of Emacs may
92# be installed at once. This can be set with the --archlibdir option
93# to `../configure'.
b93f2493 94archlibdir=@archlibdir@
41f86d5a 95
1ba1fb11
CW
96gamedir=@gamedir@
97gameuser=@gameuser@
98
eb4252f7 99# ==================== Utility Programs for the Build =================
c71beb75 100
eb4252f7 101# ../configure figures out the correct values for these.
b93f2493 102INSTALL = @INSTALL@
b93f2493
BF
103INSTALL_PROGRAM = @INSTALL_PROGRAM@
104INSTALL_DATA = @INSTALL_DATA@
01c7d383 105INSTALL_SCRIPT = @INSTALL_SCRIPT@
ae6ed0ac
RS
106# By default, we uphold the dignity of our programs.
107INSTALL_STRIP =
c71beb75 108
eb4252f7 109# ========================== Lists of Files ===========================
f7dbcf3c 110
2f8d5db9
GM
111# Things that a user might actually run, which should be installed in bindir.
112INSTALLABLES = etags${EXEEXT} ctags${EXEEXT} emacsclient${EXEEXT} \
3fb78d1f 113 ebrowse${EXEEXT}
2f8d5db9 114
e511d7f4 115INSTALLABLE_SCRIPTS = rcs-checkin grep-changelog
4e3028f8 116STAMP_INST_SCRIPTS = stamp-rcs-checkin stamp-grep-changelog
f7dbcf3c 117
eb4252f7
RS
118# Things that Emacs runs internally, or during the build process,
119# which should not be installed in bindir.
c136e5cd
GM
120UTILITIES = profile${EXEEXT} movemail${EXEEXT} hexl${EXEEXT} \
121 update-game-score${EXEEXT}
f7dbcf3c 122
108c7c97 123DONT_INSTALL= test-distrib${EXEEXT} make-docfile${EXEEXT}
5aae6601 124
eb4252f7
RS
125# Like UTILITIES, but they're not system-dependent, and should not be
126# deleted by the distclean target.
b7cceaf1 127SCRIPTS= rcs2log vcdiff
4e3028f8 128STAMP_SCRIPTS= stamp-rcs2log stamp-vcdiff
b7cceaf1 129
9a514d4a
PE
130# All files that are created by the linker, i.e., whose names end in ${EXEEXT}.
131EXE_FILES = ${INSTALLABLES} ${UTILITIES} ${DONT_INSTALL}
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 170BASE_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) ${C_WARNINGS_SWITCH} \
9a514d4a
PE
171 -DHAVE_CONFIG_H -I. -I../src -I../lib \
172 -I${srcdir} -I${srcdir}/../src -I${srcdir}/../lib
c88b05a9 173
e6cfa7c3 174ALL_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${LDFLAGS} ${CPPFLAGS} ${CFLAGS}
a4daeecf 175LINK_CFLAGS = ${BASE_CFLAGS} ${LDFLAGS} ${CFLAGS}
e6cfa7c3 176CPP_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${CPPFLAGS} ${CFLAGS}
5e58e3a4 177
9a514d4a
PE
178LOADLIBES = ../lib/libgnu.a $(LIBS_SYSTEM)
179$(EXE_FILES): ../lib/libgnu.a
eb4252f7 180
497c74cd 181all: ${EXE_FILES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS} ${STAMP_INST_SCRIPTS} ${STAMP_SCRIPTS}
ee978ec9 182
d3b23034
GM
183## These targets copy the scripts into the build directory so that
184## they can be run from there in an uninstalled Emacs.
e9490743
GM
185## Nothing to do if pwd = srcdir.
186insrcdir=[ "`/bin/pwd`" = "`(cd $(srcdir) && /bin/pwd)`" ]
187
4e3028f8 188stamp-rcs2log: $(srcdir)/rcs2log
e9490743 189 $(insrcdir) || cp -p $(srcdir)/rcs2log rcs2log
4e3028f8 190 touch $@
ee978ec9 191
4e3028f8 192stamp-rcs-checkin: $(srcdir)/rcs-checkin
e9490743 193 $(insrcdir) || cp -p $(srcdir)/rcs-checkin rcs-checkin
4e3028f8 194 touch $@
ee978ec9 195
4e3028f8 196stamp-grep-changelog: $(srcdir)/grep-changelog
e9490743 197 $(insrcdir) || cp -p $(srcdir)/grep-changelog grep-changelog
4e3028f8 198 touch $@
ee978ec9 199
4e3028f8 200stamp-vcdiff: $(srcdir)/vcdiff
e9490743 201 $(insrcdir) || cp -p $(srcdir)/vcdiff vcdiff
4e3028f8 202 touch $@
c71beb75 203
d3b23034
GM
204## Only used if we need blessmail, but no harm in always defining.
205## This makes the actual blessmail executable.
f675ecb5 206blessmail:
70e48c86 207 $(EMACS) $(EMACSOPT) -l $(srcdir)/../lisp/mail/blessmail.el
c6207d0d 208 chmod +x blessmail
c6207d0d 209
d3b23034
GM
210## This checks if we need to run blessmail.
211## Do not charge ahead and do it! Let the installer decide.
f6c0ee20 212need-blessmail: blessmail
d19f95fe
RS
213 @if [ `wc -l <blessmail` != 2 ] ; then \
214 dir=`sed -n -e 's/echo mail directory = \(.*\)/\1/p' blessmail`; \
215 echo Assuming $$dir is really the mail spool directory, you should; \
81af9060 216 echo run lib-src/blessmail $(DESTDIR)${archlibdir}/movemail${EXEEXT}; \
108c7c97 217 echo as root, to give movemail${EXEEXT} appropriate permissions.; \
eb4252f7 218 echo Do that after running make install.; \
d19f95fe 219 fi
f6c0ee20 220
d3b23034 221## This is the target invoked by the top-level Makefile.
f6c0ee20 222maybe-blessmail: $(BLESSMAIL_TARGET)
d19f95fe 223
d3b23034
GM
224## Install the internal utilities. Until they are installed, we can
225## just run them directly from lib-src.
226## If the chown/chmod commands fail, that is not a big deal.
227## update-game-score will detect at runtime that it is not setuid,
228## and handle things accordingly.
81af9060 229$(DESTDIR)${archlibdir}: all
c71beb75
JB
230 @echo
231 @echo "Installing utilities run internally by Emacs."
24e0f6b1 232 umask 022; $(top_srcdir)/build-aux/install-sh -d $(DESTDIR)${archlibdir}
81af9060 233 if [ `(cd $(DESTDIR)${archlibdir} && /bin/pwd)` != `/bin/pwd` ]; then \
544d556f 234 for file in ${UTILITIES}; do \
81af9060 235 $(INSTALL_PROGRAM) $(INSTALL_STRIP) $$file $(DESTDIR)${archlibdir}/$$file ; \
544d556f 236 done ; \
ad600343 237 fi
24e0f6b1 238 umask 022; $(top_srcdir)/build-aux/install-sh -d $(DESTDIR)${gamedir}; \
c5a139ca 239 touch $(DESTDIR)${gamedir}/snake-scores; \
81af9060 240 touch $(DESTDIR)${gamedir}/tetris-scores
81af9060
EZ
241 -if chown ${gameuser} $(DESTDIR)${archlibdir}/update-game-score && chmod u+s $(DESTDIR)${archlibdir}/update-game-score; then \
242 chown ${gameuser} $(DESTDIR)${gamedir}; \
243 chmod u=rwx,g=rwx,o=rx $(DESTDIR)${gamedir}; \
7451222f 244 fi
c971758d 245 if [ `(cd $(DESTDIR)${archlibdir} && /bin/pwd)` \
ad600343 246 != `(cd ${srcdir} && /bin/pwd)` ]; then \
544d556f 247 for file in ${SCRIPTS}; do \
01c7d383 248 $(INSTALL_SCRIPT) ${srcdir}/$$file $(DESTDIR)${archlibdir}/$$file; \
c71beb75 249 done ; \
0268f19b 250 fi
f7dbcf3c 251
81af9060 252install: $(DESTDIR)${archlibdir}
c71beb75
JB
253 @echo
254 @echo "Installing utilities for users to run."
b70cff71 255 for file in ${INSTALLABLES} ; do \
81af9060
EZ
256 $(INSTALL_PROGRAM) $(INSTALL_STRIP) $${file} $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \
257 chmod a+rx $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'`; \
0268f19b 258 done
b70cff71 259 for file in ${INSTALLABLE_SCRIPTS} ; do \
01c7d383 260 $(INSTALL_SCRIPT) ${srcdir}/$${file} $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \
81af9060 261 chmod a+rx $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'`; \
0268f19b 262 done
f7dbcf3c 263
39b649dd 264uninstall:
81af9060 265 (cd $(DESTDIR)${bindir}; \
a4663fed 266 for file in ${INSTALLABLES} ${INSTALLABLE_SCRIPTS}; do \
81af9060 267 rm -f $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \
a4663fed 268 done)
f8388570
TO
269 if [ -d $(DESTDIR)${archlibdir} ]; then \
270 (cd $(DESTDIR)${archlibdir} && \
271 rm -f ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}) \
272 fi
39b649dd 273
a17d2c25 274mostlyclean:
84bbb1ad 275 -rm -f core *.o
a17d2c25
RS
276
277clean: mostlyclean
497c74cd 278 -rm -f ${EXE_FILES}
e9490743 279 -rm -f ${STAMP_INST_SCRIPTS} ${STAMP_SCRIPTS}
f7dbcf3c 280
39b649dd 281distclean: clean
5c579a75 282 -rm -f TAGS
81ac4f35 283 -rm -f Makefile blessmail
f7dbcf3c 284
26873b72 285maintainer-clean: distclean
39b649dd 286 true
c71beb75 287
a01c76d7 288extraclean: maintainer-clean
c71beb75 289 -rm -f *~ \#*
f7dbcf3c 290
d3b23034 291## Test the contents of the directory.
f7dbcf3c 292check:
c88b05a9 293 @echo "We don't have any tests for the lib-src/ directory yet."
f7dbcf3c 294
93548af1 295tags: TAGS
108c7c97 296TAGS: etags${EXEEXT}
f7dbcf3c
JB
297 etags *.[ch]
298
d3b23034
GM
299## This verifies that the non-ASCII characters in the file \`testfile\'
300## have not been clobbered by whatever means were used to copy and
301## distribute Emacs. If they were clobbered, all the .elc files were
302## clobbered too.
108c7c97 303test-distrib${EXEEXT}: ${srcdir}/test-distrib.c
c88a7f88 304 $(CC) ${ALL_CFLAGS} -o test-distrib ${srcdir}/test-distrib.c
0d73e8e3 305 ./test-distrib ${srcdir}/testfile
f7dbcf3c 306
9a514d4a
PE
307../lib/libgnu.a: ../src/config.h
308 cd ../lib && $(MAKE) libgnu.a
309
5126d3b7 310regex.o: $(srcdir)/../src/regex.c $(srcdir)/../src/regex.h ../src/config.h
2f8d5db9
GM
311 ${CC} -c ${CPP_CFLAGS} -DCONFIG_BROKETS -DINHIBIT_STRING_HEADER \
312 ${srcdir}/../src/regex.c
66ab94d9 313
7bdede3f 314etags${EXEEXT}: ${srcdir}/etags.c regex.o ../src/config.h
2f8d5db9 315 $(CC) ${ALL_CFLAGS} -DEMACS_NAME="\"GNU Emacs\"" \
84bbb1ad 316 -DVERSION="\"${version}\"" ${srcdir}/etags.c \
7bdede3f 317 regex.o $(LOADLIBES) -o etags
f7dbcf3c 318
d47d6319 319ebrowse${EXEEXT}: ${srcdir}/ebrowse.c ${srcdir}/../lib/min-max.h ../src/config.h
2f8d5db9 320 $(CC) ${ALL_CFLAGS} -DVERSION="\"${version}\"" \
84bbb1ad 321 ${srcdir}/ebrowse.c $(LOADLIBES) -o ebrowse
adb0a8d3 322
d3b23034
GM
323## We depend on etags to assure that parallel makes do not write two
324## etags.o files on top of each other.
108c7c97 325ctags${EXEEXT}: etags${EXEEXT}
2f8d5db9 326 $(CC) ${ALL_CFLAGS} -DCTAGS -DEMACS_NAME="\"GNU Emacs\"" \
84bbb1ad 327 -DVERSION="\"${version}\"" ${srcdir}/etags.c \
7bdede3f 328 regex.o $(LOADLIBES) -o ctags
f7dbcf3c 329
108c7c97 330profile${EXEEXT}: ${srcdir}/profile.c ../src/config.h
379fb9c8
RS
331 $(CC) ${ALL_CFLAGS} ${srcdir}/profile.c $(LOADLIBES) -o profile
332
108c7c97 333make-docfile${EXEEXT}: ${srcdir}/make-docfile.c ../src/config.h
2f8d5db9
GM
334 $(CC) ${ALL_CFLAGS} ${srcdir}/make-docfile.c $(LOADLIBES) \
335 -o make-docfile
f7dbcf3c 336
d114d4f3
GM
337movemail${EXEEXT}: ${srcdir}/movemail.c pop.o ../src/config.h
338 $(CC) ${ALL_CFLAGS} ${MOVE_FLAGS} ${srcdir}/movemail.c pop.o \
84bbb1ad 339 $(LOADLIBES) $(LIBS_MOVE) -o movemail
81f94052 340
d47d6319 341pop.o: ${srcdir}/pop.c ${srcdir}/../lib/min-max.h ../src/config.h
81f94052 342 $(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/pop.c
f7dbcf3c 343
84bbb1ad
PE
344emacsclient${EXEEXT}: ${srcdir}/emacsclient.c ../src/config.h
345 $(CC) ${ALL_CFLAGS} ${srcdir}/emacsclient.c \
c2bcfb19 346 -DVERSION="\"${version}\"" \
deec6f99 347 $(LOADLIBES) -o emacsclient
f7dbcf3c 348
108c7c97 349hexl${EXEEXT}: ${srcdir}/hexl.c ../src/config.h
3e883207 350 $(CC) ${ALL_CFLAGS} ${srcdir}/hexl.c $(LOADLIBES) -o hexl
f7dbcf3c 351
1c728a9d
GM
352update-game-score${EXEEXT}: ${srcdir}/update-game-score.c ../src/config.h
353 $(CC) ${ALL_CFLAGS} -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\"" \
354 ${srcdir}/update-game-score.c $(LOADLIBES) -o update-game-score
d3b23034
GM
355
356## Makefile ends here.