Finished with lib-src compilation, except emacsclientw and emacsclient.res.
[bpt/emacs.git] / lib-src / Makefile.in
CommitLineData
eb4252f7 1# Makefile for lib-src subdirectory in GNU Emacs.
ab422c4d
PE
2# Copyright (C) 1985, 1987-1988, 1993-1994, 2001-2013 Free Software
3# 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 39PROFILING_CFLAGS = @PROFILING_CFLAGS@
b8df54ff
PE
40WARN_CFLAGS = @WARN_CFLAGS@
41WERROR_CFLAGS = @WERROR_CFLAGS@
c71beb75 42
a4663fed
PJ
43# Program name transformation.
44TRANSFORM = @program_transform_name@
45
eb4252f7 46# ==================== Where To Install Things ====================
c71beb75 47
3a4155de
GM
48# Location to install Emacs.app under GNUstep / Mac OS X.
49# Later values may use this.
50ns_appbindir=@ns_appbindir@
51
eb4252f7
RS
52# The default location for installation. Everything is placed in
53# subdirectories of this directory. The default values for many of
54# the variables below are expressed in terms of this one, so you may
55# not need to change them. This is set with the --prefix option to
56# `../configure'.
b93f2493 57prefix=@prefix@
c71beb75 58
eb4252f7
RS
59# Like `prefix', but used for architecture-specific files. This is
60# set with the --exec-prefix option to `../configure'.
b93f2493 61exec_prefix=@exec_prefix@
c71beb75 62
eb4252f7
RS
63# Where to install Emacs and other binaries that people will want to
64# run directly (like etags). This is set with the --bindir option
65# to `../configure'.
b93f2493 66bindir=@bindir@
c71beb75 67
eb4252f7
RS
68# Where to install and expect executable files to be run by Emacs
69# rather than directly by users, and other architecture-dependent
70# data. ${archlibdir} is usually below this. This is set with the
424b6d2b
RS
71# --libexecdir option to `../configure'.
72libexecdir=@libexecdir@
c71beb75 73
712eaee0
AS
74# Directory for local state files for all programs.
75localstatedir=@localstatedir@
76
eb4252f7
RS
77# Where to find the source code. This is set by the configure
78# script's `--srcdir' option. However, the value of ${srcdir} in
79# this makefile is not identical to what was specified with --srcdir,
80# since the variable here has `/lib-src' added at the end.
5126d3b7
RS
81
82# We use $(srcdir) explicitly in dependencies so as not to depend on VPATH.
b93f2493
BF
83srcdir=@srcdir@
84VPATH=@srcdir@
c71beb75 85
2d521ee6
DM
86# The top-level source directory, also set by configure.
87top_srcdir=@top_srcdir@
88
eb4252f7 89# ==================== Emacs-specific directories ====================
c71beb75 90
eb4252f7
RS
91# These variables hold the values Emacs will actually use. They are
92# based on the values of the standard Make variables above.
c71beb75 93
eb4252f7
RS
94# Where to put executables to be run by Emacs rather than the user.
95# This path usually includes the Emacs version and configuration name,
96# so that multiple configurations for multiple versions of Emacs may
97# be installed at once. This can be set with the --archlibdir option
98# to `../configure'.
b93f2493 99archlibdir=@archlibdir@
41f86d5a 100
1ba1fb11
CW
101gamedir=@gamedir@
102gameuser=@gameuser@
103
eb4252f7 104# ==================== Utility Programs for the Build =================
c71beb75 105
eb4252f7 106# ../configure figures out the correct values for these.
b93f2493 107INSTALL = @INSTALL@
b93f2493 108INSTALL_PROGRAM = @INSTALL_PROGRAM@
01c7d383 109INSTALL_SCRIPT = @INSTALL_SCRIPT@
ae6ed0ac
RS
110# By default, we uphold the dignity of our programs.
111INSTALL_STRIP =
005ad204 112MKDIR_P = @MKDIR_P@
c71beb75 113
eb4252f7 114# ========================== Lists of Files ===========================
f7dbcf3c 115
2f8d5db9
GM
116# Things that a user might actually run, which should be installed in bindir.
117INSTALLABLES = etags${EXEEXT} ctags${EXEEXT} emacsclient${EXEEXT} \
3fb78d1f 118 ebrowse${EXEEXT}
2f8d5db9 119
418cd726 120INSTALLABLE_SCRIPTS = grep-changelog
f7dbcf3c 121
eb4252f7
RS
122# Things that Emacs runs internally, or during the build process,
123# which should not be installed in bindir.
c136e5cd
GM
124UTILITIES = profile${EXEEXT} movemail${EXEEXT} hexl${EXEEXT} \
125 update-game-score${EXEEXT}
f7dbcf3c 126
108c7c97 127DONT_INSTALL= test-distrib${EXEEXT} make-docfile${EXEEXT}
5aae6601 128
eb4252f7
RS
129# Like UTILITIES, but they're not system-dependent, and should not be
130# deleted by the distclean target.
276d5f5d 131SCRIPTS= rcs2log
b7cceaf1 132
9a514d4a
PE
133# All files that are created by the linker, i.e., whose names end in ${EXEEXT}.
134EXE_FILES = ${INSTALLABLES} ${UTILITIES} ${DONT_INSTALL}
135
aded53ff
GM
136# Specify additional -D flags for movemail. Options:
137# -DMAIL_USE_FLOCK or -DMAIL_USE_LOCKF (use flock or lockf for file locking).
138# See the comments about locking in movemail.c. Normally the values
d3b23034
GM
139# set by configure should be correct and you should not need to do anything.
140# If neither flag is set, you need to use blessmail.
81f94052
RS
141MOVE_FLAGS=
142
7490175b
GM
143## Empty if either MAIL_USE_FLOCK or MAIL_USE_LOCKF, else need-blessmail.
144BLESSMAIL_TARGET=@BLESSMAIL_TARGET@
f6c0ee20 145
5e58e3a4
GM
146## -lkrb if HAVE_LIBKRB or -lkrb4 if HAVE_LIBKRB4
147KRB4LIB=@KRB4LIB@
148## -ldes if HAVE_LIBDES or -ldes425 if HAVE_LIBDES425
149DESLIB=@DESLIB@
150## -lkrb5 if HAVE_LIBKRB5
151KRB5LIB=@KRB5LIB@
152## -lk5crypto if HAVE_LIBK5CRYPTO or -lcrypto if HAVE_LIBCRYPTO
153CRYPTOLIB=@CRYPTOLIB@
154## -lcom_err if HAVE_LIBCOM_ERR
155COM_ERRLIB=@COM_ERRLIB@
156## -lhesiod if HAVE_LIBHESIOD
157LIBHESIOD=@LIBHESIOD@
158## -lresolv if HAVE_LIBRESOLV
159LIBRESOLV=@LIBRESOLV@
160## -llockfile if HAVE_LIBLOCKFILE or -lmail if HAVE_LIBMAIL
161LIBS_MAIL=@LIBS_MAIL@
d35af63c
PE
162## empty or -lrt or -lposix4 if HAVE_CLOCK_GETTIME
163LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
47d7532e
PE
164## empty or -lrt or -lposix4 if HAVE_FDATASYNC
165LIB_FDATASYNC = @LIB_FDATASYNC@
7c4026b6
EZ
166## empty of -lwsock32 for MinGW
167LIB_WSOCK32 = @LIB_WSOCK32@
5e58e3a4
GM
168
169## Extra libraries to use when linking movemail.
2f8d5db9
GM
170LIBS_MOVE = $(LIBS_MAIL) $(KRB4LIB) $(DESLIB) $(KRB5LIB) $(CRYPTOLIB) \
171 $(COM_ERRLIB) $(LIBHESIOD) $(LIBRESOLV)
5e58e3a4 172
7c4026b6
EZ
173## Extra object files for linking emacsclient
174NTLIB_O = @NTLIB_O@
175
97efb629
GM
176## Some systems define this to request special libraries.
177LIBS_SYSTEM = @LIBS_SYSTEM@
178
b8df54ff
PE
179BASE_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) \
180 $(WARN_CFLAGS) $(WERROR_CFLAGS) \
cf38a720 181 -I. -I../src -I../lib \
9a514d4a 182 -I${srcdir} -I${srcdir}/../src -I${srcdir}/../lib
c88b05a9 183
e6cfa7c3 184ALL_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${LDFLAGS} ${CPPFLAGS} ${CFLAGS}
a4daeecf 185LINK_CFLAGS = ${BASE_CFLAGS} ${LDFLAGS} ${CFLAGS}
e6cfa7c3 186CPP_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${CPPFLAGS} ${CFLAGS}
5e58e3a4 187
de7de872
GM
188# Configuration files for .o files to depend on.
189config_h = ../src/config.h $(srcdir)/../src/conf_post.h
190
67163749 191all: ${EXE_FILES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}
5ef215d8 192
0aee6912
PE
193.PHONY: all need-blessmail maybe-blessmail
194
9a514d4a
PE
195LOADLIBES = ../lib/libgnu.a $(LIBS_SYSTEM)
196$(EXE_FILES): ../lib/libgnu.a
eb4252f7 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."
005ad204 226 umask 022; ${MKDIR_P} $(DESTDIR)${archlibdir}
b847032c 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
005ad204 232 umask 022; ${MKDIR_P} $(DESTDIR)${gamedir}; \
c5a139ca 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
b847032c
GM
239 if [ `cd $(DESTDIR)${archlibdir} && /bin/pwd` \
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
0aee6912
PE
246.PHONY: install uninstall mostlyclean clean distclean maintainer-clean
247.PHONY: extraclean check tags
248
81af9060 249install: $(DESTDIR)${archlibdir}
c71beb75
JB
250 @echo
251 @echo "Installing utilities for users to run."
ed4affe1 252 umask 022; ${MKDIR_P} $(DESTDIR)${bindir}
b70cff71 253 for file in ${INSTALLABLES} ; do \
eeced60b 254 $(INSTALL_PROGRAM) $(INSTALL_STRIP) $${file} $(DESTDIR)${bindir}/`echo $${file} | sed -e 's/${EXEEXT}$$//' -e '$(TRANSFORM)'`${EXEEXT} ; \
0268f19b 255 done
b70cff71 256 for file in ${INSTALLABLE_SCRIPTS} ; do \
01c7d383 257 $(INSTALL_SCRIPT) ${srcdir}/$${file} $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \
0268f19b 258 done
f7dbcf3c 259
39b649dd 260uninstall:
eeced60b
GM
261 for file in ${INSTALLABLES}; do \
262 rm -f $(DESTDIR)${bindir}/`echo $${file} | sed -e 's/${EXEEXT}$$//' -e '$(TRANSFORM)'`${EXEEXT} ; \
263 done
264 for file in ${INSTALLABLE_SCRIPTS}; do \
81af9060 265 rm -f $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \
eeced60b 266 done
f8388570 267 if [ -d $(DESTDIR)${archlibdir} ]; then \
b75897ba 268 (cd $(DESTDIR)${archlibdir} && rm -f ${UTILITIES} ${SCRIPTS}) \
f8388570 269 fi
39b649dd 270
a17d2c25 271mostlyclean:
84bbb1ad 272 -rm -f core *.o
a17d2c25
RS
273
274clean: mostlyclean
497c74cd 275 -rm -f ${EXE_FILES}
f7dbcf3c 276
39b649dd 277distclean: clean
5c579a75 278 -rm -f TAGS
81ac4f35 279 -rm -f Makefile blessmail
f7dbcf3c 280
26873b72 281maintainer-clean: distclean
39b649dd 282 true
c71beb75 283
a01c76d7 284extraclean: maintainer-clean
c71beb75 285 -rm -f *~ \#*
f7dbcf3c 286
d3b23034 287## Test the contents of the directory.
f7dbcf3c 288check:
c88b05a9 289 @echo "We don't have any tests for the lib-src/ directory yet."
f7dbcf3c 290
93548af1 291tags: TAGS
108c7c97 292TAGS: etags${EXEEXT}
f7dbcf3c
JB
293 etags *.[ch]
294
d3b23034
GM
295## This verifies that the non-ASCII characters in the file \`testfile\'
296## have not been clobbered by whatever means were used to copy and
297## distribute Emacs. If they were clobbered, all the .elc files were
298## clobbered too.
108c7c97 299test-distrib${EXEEXT}: ${srcdir}/test-distrib.c
7c4026b6 300 $(CC) ${ALL_CFLAGS} -o test-distrib${EXEEXT} ${srcdir}/test-distrib.c
0d73e8e3 301 ./test-distrib ${srcdir}/testfile
f7dbcf3c 302
de7de872 303../lib/libgnu.a: $(config_h)
9a514d4a
PE
304 cd ../lib && $(MAKE) libgnu.a
305
de7de872 306regex.o: $(srcdir)/../src/regex.c $(srcdir)/../src/regex.h $(config_h)
2f8d5db9
GM
307 ${CC} -c ${CPP_CFLAGS} -DCONFIG_BROKETS -DINHIBIT_STRING_HEADER \
308 ${srcdir}/../src/regex.c
66ab94d9 309
de7de872 310etags${EXEEXT}: ${srcdir}/etags.c regex.o $(config_h)
2f8d5db9 311 $(CC) ${ALL_CFLAGS} -DEMACS_NAME="\"GNU Emacs\"" \
84bbb1ad 312 -DVERSION="\"${version}\"" ${srcdir}/etags.c \
7c4026b6 313 regex.o $(LOADLIBES) -o etags${EXEEXT}
f7dbcf3c 314
de7de872 315ebrowse${EXEEXT}: ${srcdir}/ebrowse.c ${srcdir}/../lib/min-max.h $(config_h)
2f8d5db9 316 $(CC) ${ALL_CFLAGS} -DVERSION="\"${version}\"" \
7c4026b6 317 ${srcdir}/ebrowse.c $(LOADLIBES) -o ebrowse${EXEEXT}
adb0a8d3 318
d3b23034
GM
319## We depend on etags to assure that parallel makes do not write two
320## etags.o files on top of each other.
108c7c97 321ctags${EXEEXT}: etags${EXEEXT}
2f8d5db9 322 $(CC) ${ALL_CFLAGS} -DCTAGS -DEMACS_NAME="\"GNU Emacs\"" \
84bbb1ad 323 -DVERSION="\"${version}\"" ${srcdir}/etags.c \
7c4026b6 324 regex.o $(LOADLIBES) -o ctags${EXEEXT}
f7dbcf3c 325
de7de872 326profile${EXEEXT}: ${srcdir}/profile.c $(config_h)
d35af63c 327 $(CC) ${ALL_CFLAGS} ${srcdir}/profile.c \
7c4026b6 328 $(LOADLIBES) $(LIB_CLOCK_GETTIME) -o profile${EXEEXT}
379fb9c8 329
de7de872 330make-docfile${EXEEXT}: ${srcdir}/make-docfile.c $(config_h)
2f8d5db9 331 $(CC) ${ALL_CFLAGS} ${srcdir}/make-docfile.c $(LOADLIBES) \
7c4026b6 332 -o make-docfile${EXEEXT}
f7dbcf3c 333
7c4026b6 334movemail${EXEEXT}: ${srcdir}/movemail.c pop.o $(NTLIB_O) $(config_h)
d114d4f3 335 $(CC) ${ALL_CFLAGS} ${MOVE_FLAGS} ${srcdir}/movemail.c pop.o \
7c4026b6
EZ
336 $(NTLIB_O) $(LIB_WSOCK32) $(LOADLIBES) $(LIBS_MOVE) \
337 -o movemail${EXEEXT}
81f94052 338
de7de872 339pop.o: ${srcdir}/pop.c ${srcdir}/../lib/min-max.h $(config_h)
81f94052 340 $(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/pop.c
f7dbcf3c 341
7c4026b6 342emacsclient${EXEEXT}: ${srcdir}/emacsclient.c $(NTLIB_O) $(config_h)
84bbb1ad 343 $(CC) ${ALL_CFLAGS} ${srcdir}/emacsclient.c \
7c4026b6
EZ
344 -DVERSION="\"${version}\"" $(LIB_WSOCK32) \
345 $(LOADLIBES) $(LIB_FDATASYNC) -o emacsclient${EXEEXT}
346
347ntlib.o: ${srcdir}/ntlib.c ${srcdir}/ntlib.h
348 $(CC) -c ${CPP_CFLAGS} ${srcdir}/ntlib.c
f7dbcf3c 349
de7de872 350hexl${EXEEXT}: ${srcdir}/hexl.c $(config_h)
7c4026b6 351 $(CC) ${ALL_CFLAGS} ${srcdir}/hexl.c $(LOADLIBES) -o hexl${EXEEXT}
f7dbcf3c 352
7c4026b6 353update-game-score${EXEEXT}: ${srcdir}/update-game-score.c $(NTLIB_O) $(config_h)
1c728a9d 354 $(CC) ${ALL_CFLAGS} -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\"" \
7c4026b6
EZ
355 ${srcdir}/update-game-score.c $(NTLIB_O) $(LOADLIBES) \
356 -o update-game-score${EXEEXT}
d3b23034
GM
357
358## Makefile ends here.