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