Progress towards allowing installation in directories with whitespace
[bpt/emacs.git] / lib-src / Makefile.in
CommitLineData
bbece175
GM
1### @configure_input@
2
3# Copyright (C) 1985, 1987-1988, 1993-1994, 2001-2013
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
50b13cde 21SHELL = @SHELL@
f7dbcf3c 22
70e48c86
GM
23# Following ../lisp/Makefile.in.
24EMACS = ../src/emacs
e7a42417 25EMACSOPT = -batch --no-site-file --no-site-lisp
70e48c86 26
eb4252f7 27# ==================== Things `configure' will edit ====================
c71beb75 28
b93f2493
BF
29CC=@CC@
30CFLAGS=@CFLAGS@
b93f2493 31version=@version@
d3b23034 32## Used in $archlibdir.
cf770692 33configuration=@configuration@
108c7c97 34EXEEXT=@EXEEXT@
49628785
GM
35C_SWITCH_SYSTEM=@C_SWITCH_SYSTEM@
36C_SWITCH_MACHINE=@C_SWITCH_MACHINE@
e6cfa7c3 37PROFILING_CFLAGS = @PROFILING_CFLAGS@
b8df54ff
PE
38WARN_CFLAGS = @WARN_CFLAGS@
39WERROR_CFLAGS = @WERROR_CFLAGS@
d4166523 40UPDATE_MANIFEST = @UPDATE_MANIFEST@
c71beb75 41
a4663fed
PJ
42# Program name transformation.
43TRANSFORM = @program_transform_name@
44
eb4252f7 45# ==================== Where To Install Things ====================
c71beb75 46
3a4155de
GM
47# Location to install Emacs.app under GNUstep / Mac OS X.
48# Later values may use this.
49ns_appbindir=@ns_appbindir@
50
eb4252f7
RS
51# The default location for installation. Everything is placed in
52# subdirectories of this directory. The default values for many of
53# the variables below are expressed in terms of this one, so you may
54# not need to change them. This is set with the --prefix option to
55# `../configure'.
b93f2493 56prefix=@prefix@
c71beb75 57
eb4252f7
RS
58# Like `prefix', but used for architecture-specific files. This is
59# set with the --exec-prefix option to `../configure'.
b93f2493 60exec_prefix=@exec_prefix@
c71beb75 61
eb4252f7
RS
62# Where to install Emacs and other binaries that people will want to
63# run directly (like etags). This is set with the --bindir option
64# to `../configure'.
b93f2493 65bindir=@bindir@
c71beb75 66
eb4252f7
RS
67# Where to install and expect executable files to be run by Emacs
68# rather than directly by users, and other architecture-dependent
69# data. ${archlibdir} is usually below this. This is set with the
424b6d2b
RS
70# --libexecdir option to `../configure'.
71libexecdir=@libexecdir@
c71beb75 72
712eaee0
AS
73# Directory for local state files for all programs.
74localstatedir=@localstatedir@
75
eb4252f7
RS
76# Where to find the source code. This is set by the configure
77# script's `--srcdir' option. However, the value of ${srcdir} in
78# this makefile is not identical to what was specified with --srcdir,
79# since the variable here has `/lib-src' added at the end.
5126d3b7
RS
80
81# We use $(srcdir) explicitly in dependencies so as not to depend on VPATH.
b93f2493
BF
82srcdir=@srcdir@
83VPATH=@srcdir@
c71beb75 84
2d521ee6
DM
85# The top-level source directory, also set by configure.
86top_srcdir=@top_srcdir@
87
eb4252f7 88# ==================== Emacs-specific directories ====================
c71beb75 89
eb4252f7
RS
90# These variables hold the values Emacs will actually use. They are
91# based on the values of the standard Make variables above.
c71beb75 92
eb4252f7
RS
93# Where to put executables to be run by Emacs rather than the user.
94# This path usually includes the Emacs version and configuration name,
95# so that multiple configurations for multiple versions of Emacs may
96# be installed at once. This can be set with the --archlibdir option
97# to `../configure'.
b93f2493 98archlibdir=@archlibdir@
41f86d5a 99
1ba1fb11
CW
100gamedir=@gamedir@
101gameuser=@gameuser@
102
eb4252f7 103# ==================== Utility Programs for the Build =================
c71beb75 104
eb4252f7 105# ../configure figures out the correct values for these.
b93f2493 106INSTALL = @INSTALL@
b93f2493 107INSTALL_PROGRAM = @INSTALL_PROGRAM@
01c7d383 108INSTALL_SCRIPT = @INSTALL_SCRIPT@
ae6ed0ac
RS
109# By default, we uphold the dignity of our programs.
110INSTALL_STRIP =
005ad204 111MKDIR_P = @MKDIR_P@
c71beb75 112
eb4252f7 113# ========================== Lists of Files ===========================
f7dbcf3c 114
f540ee86
EZ
115# emacsclientw.exe for MinGW, empty otherwise
116CLIENTW = @CLIENTW@
117
2f8d5db9 118# Things that a user might actually run, which should be installed in bindir.
f540ee86 119INSTALLABLES = etags${EXEEXT} ctags${EXEEXT} emacsclient${EXEEXT} $(CLIENTW) \
3fb78d1f 120 ebrowse${EXEEXT}
2f8d5db9 121
418cd726 122INSTALLABLE_SCRIPTS = grep-changelog
f7dbcf3c 123
eb4252f7
RS
124# Things that Emacs runs internally, or during the build process,
125# which should not be installed in bindir.
c136e5cd
GM
126UTILITIES = profile${EXEEXT} movemail${EXEEXT} hexl${EXEEXT} \
127 update-game-score${EXEEXT}
f7dbcf3c 128
108c7c97 129DONT_INSTALL= test-distrib${EXEEXT} make-docfile${EXEEXT}
5aae6601 130
eb4252f7
RS
131# Like UTILITIES, but they're not system-dependent, and should not be
132# deleted by the distclean target.
d4166523 133SCRIPTS= rcs2log $(UPDATE_MANIFEST)
b7cceaf1 134
9a514d4a
PE
135# All files that are created by the linker, i.e., whose names end in ${EXEEXT}.
136EXE_FILES = ${INSTALLABLES} ${UTILITIES} ${DONT_INSTALL}
137
aded53ff
GM
138# Specify additional -D flags for movemail. Options:
139# -DMAIL_USE_FLOCK or -DMAIL_USE_LOCKF (use flock or lockf for file locking).
140# See the comments about locking in movemail.c. Normally the values
d3b23034
GM
141# set by configure should be correct and you should not need to do anything.
142# If neither flag is set, you need to use blessmail.
81f94052
RS
143MOVE_FLAGS=
144
7490175b
GM
145## Empty if either MAIL_USE_FLOCK or MAIL_USE_LOCKF, else need-blessmail.
146BLESSMAIL_TARGET=@BLESSMAIL_TARGET@
f6c0ee20 147
57f8c490 148## -lkrb or -lkrb4 if needed
5e58e3a4 149KRB4LIB=@KRB4LIB@
57f8c490 150## -ldes or -ldes425 if needed
5e58e3a4 151DESLIB=@DESLIB@
57f8c490 152## -lkrb5 if needed
5e58e3a4 153KRB5LIB=@KRB5LIB@
57f8c490 154## -lk5crypto or -lcrypto if needed
5e58e3a4 155CRYPTOLIB=@CRYPTOLIB@
57f8c490 156## -lcom_err if needed
5e58e3a4 157COM_ERRLIB=@COM_ERRLIB@
57f8c490 158## -lhesiod if needed
5e58e3a4
GM
159LIBHESIOD=@LIBHESIOD@
160## -lresolv if HAVE_LIBRESOLV
161LIBRESOLV=@LIBRESOLV@
162## -llockfile if HAVE_LIBLOCKFILE or -lmail if HAVE_LIBMAIL
163LIBS_MAIL=@LIBS_MAIL@
d35af63c
PE
164## empty or -lrt or -lposix4 if HAVE_CLOCK_GETTIME
165LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
47d7532e
PE
166## empty or -lrt or -lposix4 if HAVE_FDATASYNC
167LIB_FDATASYNC = @LIB_FDATASYNC@
d6db9fd6
EZ
168## empty or -lwsock2 for MinGW
169LIB_WSOCK32=@LIB_WSOCK32@
5e58e3a4
GM
170
171## Extra libraries to use when linking movemail.
2f8d5db9 172LIBS_MOVE = $(LIBS_MAIL) $(KRB4LIB) $(DESLIB) $(KRB5LIB) $(CRYPTOLIB) \
d6db9fd6 173 $(COM_ERRLIB) $(LIBHESIOD) $(LIBRESOLV) $(LIB_WSOCK32)
5e58e3a4 174
d6db9fd6
EZ
175## Extra libraries when linking emacsclient
176## (empty or -lcomctl32 for MinGW)
177LIBS_ECLIENT = @LIBS_ECLIENT@
178
179## Extra object files for linking for MinGW
a74b0e1b 180NTLIB = @NTLIB@
095bf253
EZ
181CLIENTRES = @CLIENTRES@
182WINDRES = @WINDRES@
7c4026b6 183
97efb629
GM
184## Some systems define this to request special libraries.
185LIBS_SYSTEM = @LIBS_SYSTEM@
186
b8df54ff
PE
187BASE_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) \
188 $(WARN_CFLAGS) $(WERROR_CFLAGS) \
cf38a720 189 -I. -I../src -I../lib \
9a514d4a 190 -I${srcdir} -I${srcdir}/../src -I${srcdir}/../lib
c88b05a9 191
e6cfa7c3 192ALL_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${LDFLAGS} ${CPPFLAGS} ${CFLAGS}
a4daeecf 193LINK_CFLAGS = ${BASE_CFLAGS} ${LDFLAGS} ${CFLAGS}
e6cfa7c3 194CPP_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${CPPFLAGS} ${CFLAGS}
5e58e3a4 195
de7de872
GM
196# Configuration files for .o files to depend on.
197config_h = ../src/config.h $(srcdir)/../src/conf_post.h
198
67163749 199all: ${EXE_FILES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}
5ef215d8 200
0aee6912
PE
201.PHONY: all need-blessmail maybe-blessmail
202
9a514d4a
PE
203LOADLIBES = ../lib/libgnu.a $(LIBS_SYSTEM)
204$(EXE_FILES): ../lib/libgnu.a
eb4252f7 205
d3b23034
GM
206## Only used if we need blessmail, but no harm in always defining.
207## This makes the actual blessmail executable.
f675ecb5 208blessmail:
70e48c86 209 $(EMACS) $(EMACSOPT) -l $(srcdir)/../lisp/mail/blessmail.el
c6207d0d 210 chmod +x blessmail
c6207d0d 211
d3b23034
GM
212## This checks if we need to run blessmail.
213## Do not charge ahead and do it! Let the installer decide.
f6c0ee20 214need-blessmail: blessmail
d19f95fe
RS
215 @if [ `wc -l <blessmail` != 2 ] ; then \
216 dir=`sed -n -e 's/echo mail directory = \(.*\)/\1/p' blessmail`; \
48f73cfb
GM
217 echo "Assuming $$dir is really the mail spool directory, you should"; \
218 echo "run lib-src/blessmail $(DESTDIR)${archlibdir}/movemail${EXEEXT}"; \
219 echo "as root, to give movemail${EXEEXT} appropriate permissions."; \
220 echo "Do that after running make install."; \
d19f95fe 221 fi
f6c0ee20 222
d3b23034 223## This is the target invoked by the top-level Makefile.
f6c0ee20 224maybe-blessmail: $(BLESSMAIL_TARGET)
d19f95fe 225
d3b23034
GM
226## Install the internal utilities. Until they are installed, we can
227## just run them directly from lib-src.
228## If the chown/chmod commands fail, that is not a big deal.
229## update-game-score will detect at runtime that it is not setuid,
230## and handle things accordingly.
81af9060 231$(DESTDIR)${archlibdir}: all
c71beb75
JB
232 @echo
233 @echo "Installing utilities run internally by Emacs."
48f73cfb
GM
234 umask 022; ${MKDIR_P} "$(DESTDIR)${archlibdir}"
235 if [ "`cd \"$(DESTDIR)${archlibdir}\" && /bin/pwd`" != "`/bin/pwd`" ]; then \
544d556f 236 for file in ${UTILITIES}; do \
48f73cfb 237 $(INSTALL_PROGRAM) $(INSTALL_STRIP) $$file "$(DESTDIR)${archlibdir}/$$file" ; \
544d556f 238 done ; \
ad600343 239 fi
48f73cfb
GM
240 umask 022; ${MKDIR_P} "$(DESTDIR)${gamedir}"; \
241 touch "$(DESTDIR)${gamedir}/snake-scores"; \
242 touch "$(DESTDIR)${gamedir}/tetris-scores"
243 -if chown ${gameuser} "$(DESTDIR)${archlibdir}/update-game-score${EXEEXT}" && chmod u+s "$(DESTDIR)${archlibdir}/update-game-score${EXEEXT}"; then \
244 chown ${gameuser} "$(DESTDIR)${gamedir}"; \
245 chmod u=rwx,g=rwx,o=rx "$(DESTDIR)${gamedir}"; \
7451222f 246 fi
48f73cfb 247 if [ "`cd \"$(DESTDIR)${archlibdir}\" && /bin/pwd`" \
b8e3b0a9 248 != "`cd ${srcdir} && /bin/pwd`" ]; then \
544d556f 249 for file in ${SCRIPTS}; do \
48f73cfb 250 $(INSTALL_SCRIPT) ${srcdir}/$$file "$(DESTDIR)${archlibdir}/$$file"; \
c71beb75 251 done ; \
0268f19b 252 fi
f7dbcf3c 253
0aee6912
PE
254.PHONY: install uninstall mostlyclean clean distclean maintainer-clean
255.PHONY: extraclean check tags
256
81af9060 257install: $(DESTDIR)${archlibdir}
c71beb75
JB
258 @echo
259 @echo "Installing utilities for users to run."
48f73cfb 260 umask 022; ${MKDIR_P} "$(DESTDIR)${bindir}"
b70cff71 261 for file in ${INSTALLABLES} ; do \
48f73cfb 262 $(INSTALL_PROGRAM) $(INSTALL_STRIP) $${file} "$(DESTDIR)${bindir}"/`echo $${file} | sed -e 's/${EXEEXT}$$//' -e '$(TRANSFORM)'`${EXEEXT} ; \
0268f19b 263 done
b70cff71 264 for file in ${INSTALLABLE_SCRIPTS} ; do \
48f73cfb 265 $(INSTALL_SCRIPT) ${srcdir}/$${file} "$(DESTDIR)${bindir}"/`echo $${file} | sed '$(TRANSFORM)'` ; \
0268f19b 266 done
f7dbcf3c 267
39b649dd 268uninstall:
eeced60b 269 for file in ${INSTALLABLES}; do \
48f73cfb 270 rm -f "$(DESTDIR)${bindir}"/`echo $${file} | sed -e 's/${EXEEXT}$$//' -e '$(TRANSFORM)'`${EXEEXT} ; \
eeced60b
GM
271 done
272 for file in ${INSTALLABLE_SCRIPTS}; do \
48f73cfb 273 rm -f "$(DESTDIR)${bindir}"/`echo $${file} | sed '$(TRANSFORM)'` ; \
eeced60b 274 done
48f73cfb
GM
275 if [ -d "$(DESTDIR)${archlibdir}" ]; then \
276 (cd "$(DESTDIR)${archlibdir}" && rm -f ${UTILITIES} ${SCRIPTS}) \
f8388570 277 fi
39b649dd 278
a17d2c25 279mostlyclean:
38b787fa 280 -rm -f core *.o *.res
a17d2c25
RS
281
282clean: mostlyclean
497c74cd 283 -rm -f ${EXE_FILES}
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
7c4026b6 308 $(CC) ${ALL_CFLAGS} -o test-distrib${EXEEXT} ${srcdir}/test-distrib.c
0d73e8e3 309 ./test-distrib ${srcdir}/testfile
f7dbcf3c 310
de7de872 311../lib/libgnu.a: $(config_h)
9a514d4a
PE
312 cd ../lib && $(MAKE) libgnu.a
313
de7de872 314regex.o: $(srcdir)/../src/regex.c $(srcdir)/../src/regex.h $(config_h)
2f8d5db9
GM
315 ${CC} -c ${CPP_CFLAGS} -DCONFIG_BROKETS -DINHIBIT_STRING_HEADER \
316 ${srcdir}/../src/regex.c
66ab94d9 317
d6db9fd6 318etags${EXEEXT}: ${srcdir}/etags.c regex.o $(NTLIB) $(config_h)
2f8d5db9 319 $(CC) ${ALL_CFLAGS} -DEMACS_NAME="\"GNU Emacs\"" \
84bbb1ad 320 -DVERSION="\"${version}\"" ${srcdir}/etags.c \
d6db9fd6 321 regex.o $(LOADLIBES) $(NTLIB) -o etags${EXEEXT}
f7dbcf3c 322
d6db9fd6
EZ
323ebrowse${EXEEXT}: ${srcdir}/ebrowse.c ${srcdir}/../lib/min-max.h $(NTLIB) \
324 $(config_h)
2f8d5db9 325 $(CC) ${ALL_CFLAGS} -DVERSION="\"${version}\"" \
d6db9fd6 326 ${srcdir}/ebrowse.c $(LOADLIBES) $(NTLIB) -o ebrowse${EXEEXT}
adb0a8d3 327
d3b23034
GM
328## We depend on etags to assure that parallel makes do not write two
329## etags.o files on top of each other.
108c7c97 330ctags${EXEEXT}: etags${EXEEXT}
2f8d5db9 331 $(CC) ${ALL_CFLAGS} -DCTAGS -DEMACS_NAME="\"GNU Emacs\"" \
84bbb1ad 332 -DVERSION="\"${version}\"" ${srcdir}/etags.c \
d6db9fd6 333 regex.o $(LOADLIBES) $(NTLIB) -o ctags${EXEEXT}
f7dbcf3c 334
d6db9fd6 335profile${EXEEXT}: ${srcdir}/profile.c $(NTLIB) $(config_h)
d35af63c 336 $(CC) ${ALL_CFLAGS} ${srcdir}/profile.c \
d6db9fd6 337 $(LOADLIBES) $(NTLIB) $(LIB_CLOCK_GETTIME) -o profile${EXEEXT}
379fb9c8 338
d6db9fd6
EZ
339make-docfile${EXEEXT}: ${srcdir}/make-docfile.c $(NTLIB) $(config_h)
340 $(CC) ${ALL_CFLAGS} ${srcdir}/make-docfile.c $(LOADLIBES) $(NTLIB) \
7c4026b6 341 -o make-docfile${EXEEXT}
f7dbcf3c 342
a74b0e1b 343movemail${EXEEXT}: ${srcdir}/movemail.c pop.o $(NTLIB) $(config_h)
d114d4f3 344 $(CC) ${ALL_CFLAGS} ${MOVE_FLAGS} ${srcdir}/movemail.c pop.o \
d6db9fd6 345 $(LOADLIBES) $(NTLIB) $(LIBS_MOVE) -o movemail${EXEEXT}
81f94052 346
d6db9fd6 347pop.o: ${srcdir}/pop.c ${srcdir}/pop.h ${srcdir}/../lib/min-max.h $(config_h)
81f94052 348 $(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/pop.c
f7dbcf3c 349
f540ee86 350emacsclient${EXEEXT}: ${srcdir}/emacsclient.c $(NTLIB) $(config_h)
84bbb1ad 351 $(CC) ${ALL_CFLAGS} ${srcdir}/emacsclient.c \
d6db9fd6
EZ
352 -DVERSION="\"${version}\"" $(NTLIB) $(LOADLIBES) $(LIB_FDATASYNC) \
353 $(LIB_WSOCK32) $(LIBS_ECLIENT) -o emacsclient${EXEEXT}
7c4026b6 354
f540ee86
EZ
355emacsclientw${EXEEXT}: ${srcdir}/emacsclient.c $(NTLIB) $(CLIENTRES) $(config_h)
356 $(CC) ${ALL_CFLAGS} $(CLIENTRES) -mwindows ${srcdir}/emacsclient.c \
d6db9fd6
EZ
357 -DVERSION="\"${version}\"" $(LOADLIBES) $(LIB_FDATASYNC) \
358 $(LIB_WSOCK32) $(LIBS_ECLIENT) -o emacsclientw${EXEEXT}
359
2b57bbc0 360NTINC = ${srcdir}/../nt/inc
d6db9fd6
EZ
361NTDEPS = $(NTINC)/ms-w32.h $(NTINC)/sys/stat.h $(NTINC)/inttypes.h \
362 $(NTINC)/stdint.h $(NTINC)/pwd.h $(NTINC)/sys/time.h $(NTINC)/stdbool.h \
363 $(NTINC)/sys/wait.h $(NTINC)/unistd.h $(NTINC)/sys/file.h $(NTINC)/netdb.h
f540ee86 364
d6db9fd6
EZ
365# The dependency on $(NTDEPS) is a trick intended to cause recompile of
366# programs on MinGW whenever some private header in nt/inc is modified.
367ntlib.o: ${srcdir}/ntlib.c ${srcdir}/ntlib.h $(NTDEPS)
7c4026b6 368 $(CC) -c ${CPP_CFLAGS} ${srcdir}/ntlib.c
f7dbcf3c 369
d6db9fd6 370hexl${EXEEXT}: ${srcdir}/hexl.c $(NTLIB) $(config_h)
7c4026b6 371 $(CC) ${ALL_CFLAGS} ${srcdir}/hexl.c $(LOADLIBES) -o hexl${EXEEXT}
f7dbcf3c 372
a74b0e1b 373update-game-score${EXEEXT}: ${srcdir}/update-game-score.c $(NTLIB) $(config_h)
1c728a9d 374 $(CC) ${ALL_CFLAGS} -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\"" \
d6db9fd6 375 ${srcdir}/update-game-score.c $(LOADLIBES) $(NTLIB) \
7c4026b6 376 -o update-game-score${EXEEXT}
d3b23034 377
2b57bbc0
EZ
378emacsclient.res: $(NTINC)/../emacsclient.rc
379 $(WINDRES) -O coff --include-dir=$(NTINC)/.. -o emacsclient.res \
380 $(NTINC)/../emacsclient.rc
095bf253 381
d3b23034 382## Makefile ends here.