Get rid of compiler warnings on Cygwin.
[bpt/emacs.git] / lib-src / Makefile.in
CommitLineData
eb4252f7 1# Makefile for lib-src subdirectory in GNU Emacs.
acaf905b 2# Copyright (C) 1985, 1987-1988, 1993-1994, 2001-2012
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 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
BF
108INSTALL_PROGRAM = @INSTALL_PROGRAM@
109INSTALL_DATA = @INSTALL_DATA@
01c7d383 110INSTALL_SCRIPT = @INSTALL_SCRIPT@
ae6ed0ac
RS
111# By default, we uphold the dignity of our programs.
112INSTALL_STRIP =
005ad204 113MKDIR_P = @MKDIR_P@
c71beb75 114
eb4252f7 115# ========================== Lists of Files ===========================
f7dbcf3c 116
2f8d5db9
GM
117# Things that a user might actually run, which should be installed in bindir.
118INSTALLABLES = etags${EXEEXT} ctags${EXEEXT} emacsclient${EXEEXT} \
3fb78d1f 119 ebrowse${EXEEXT}
2f8d5db9 120
e511d7f4 121INSTALLABLE_SCRIPTS = rcs-checkin grep-changelog
4e3028f8 122STAMP_INST_SCRIPTS = stamp-rcs-checkin stamp-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.
b7cceaf1 133SCRIPTS= rcs2log vcdiff
4e3028f8 134STAMP_SCRIPTS= stamp-rcs2log stamp-vcdiff
b7cceaf1 135
9a514d4a
PE
136# All files that are created by the linker, i.e., whose names end in ${EXEEXT}.
137EXE_FILES = ${INSTALLABLES} ${UTILITIES} ${DONT_INSTALL}
138
aded53ff
GM
139# Specify additional -D flags for movemail. Options:
140# -DMAIL_USE_FLOCK or -DMAIL_USE_LOCKF (use flock or lockf for file locking).
141# See the comments about locking in movemail.c. Normally the values
d3b23034
GM
142# set by configure should be correct and you should not need to do anything.
143# If neither flag is set, you need to use blessmail.
81f94052
RS
144MOVE_FLAGS=
145
7490175b
GM
146## Empty if either MAIL_USE_FLOCK or MAIL_USE_LOCKF, else need-blessmail.
147BLESSMAIL_TARGET=@BLESSMAIL_TARGET@
f6c0ee20 148
5e58e3a4
GM
149## -lkrb if HAVE_LIBKRB or -lkrb4 if HAVE_LIBKRB4
150KRB4LIB=@KRB4LIB@
151## -ldes if HAVE_LIBDES or -ldes425 if HAVE_LIBDES425
152DESLIB=@DESLIB@
153## -lkrb5 if HAVE_LIBKRB5
154KRB5LIB=@KRB5LIB@
155## -lk5crypto if HAVE_LIBK5CRYPTO or -lcrypto if HAVE_LIBCRYPTO
156CRYPTOLIB=@CRYPTOLIB@
157## -lcom_err if HAVE_LIBCOM_ERR
158COM_ERRLIB=@COM_ERRLIB@
159## -lhesiod if HAVE_LIBHESIOD
160LIBHESIOD=@LIBHESIOD@
161## -lresolv if HAVE_LIBRESOLV
162LIBRESOLV=@LIBRESOLV@
163## -llockfile if HAVE_LIBLOCKFILE or -lmail if HAVE_LIBMAIL
164LIBS_MAIL=@LIBS_MAIL@
165
166## Extra libraries to use when linking movemail.
2f8d5db9
GM
167LIBS_MOVE = $(LIBS_MAIL) $(KRB4LIB) $(DESLIB) $(KRB5LIB) $(CRYPTOLIB) \
168 $(COM_ERRLIB) $(LIBHESIOD) $(LIBRESOLV)
5e58e3a4 169
97efb629
GM
170## Some systems define this to request special libraries.
171LIBS_SYSTEM = @LIBS_SYSTEM@
172
4794a582
DN
173# Those files shared with other GNU utilities need HAVE_CONFIG_H
174# defined before they know they can take advantage of the information
175# in ../src/config.h.
b8df54ff
PE
176BASE_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) \
177 $(WARN_CFLAGS) $(WERROR_CFLAGS) \
9a514d4a
PE
178 -DHAVE_CONFIG_H -I. -I../src -I../lib \
179 -I${srcdir} -I${srcdir}/../src -I${srcdir}/../lib
c88b05a9 180
e6cfa7c3 181ALL_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${LDFLAGS} ${CPPFLAGS} ${CFLAGS}
a4daeecf 182LINK_CFLAGS = ${BASE_CFLAGS} ${LDFLAGS} ${CFLAGS}
e6cfa7c3 183CPP_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${CPPFLAGS} ${CFLAGS}
5e58e3a4 184
5ef215d8
DN
185all: ${EXE_FILES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS} ${STAMP_INST_SCRIPTS} ${STAMP_SCRIPTS}
186
9a514d4a
PE
187LOADLIBES = ../lib/libgnu.a $(LIBS_SYSTEM)
188$(EXE_FILES): ../lib/libgnu.a
eb4252f7 189
d3b23034
GM
190## These targets copy the scripts into the build directory so that
191## they can be run from there in an uninstalled Emacs.
e9490743
GM
192## Nothing to do if pwd = srcdir.
193insrcdir=[ "`/bin/pwd`" = "`(cd $(srcdir) && /bin/pwd)`" ]
194
4e3028f8 195stamp-rcs2log: $(srcdir)/rcs2log
e9490743 196 $(insrcdir) || cp -p $(srcdir)/rcs2log rcs2log
4e3028f8 197 touch $@
ee978ec9 198
4e3028f8 199stamp-rcs-checkin: $(srcdir)/rcs-checkin
e9490743 200 $(insrcdir) || cp -p $(srcdir)/rcs-checkin rcs-checkin
4e3028f8 201 touch $@
ee978ec9 202
4e3028f8 203stamp-grep-changelog: $(srcdir)/grep-changelog
e9490743 204 $(insrcdir) || cp -p $(srcdir)/grep-changelog grep-changelog
4e3028f8 205 touch $@
ee978ec9 206
4e3028f8 207stamp-vcdiff: $(srcdir)/vcdiff
e9490743 208 $(insrcdir) || cp -p $(srcdir)/vcdiff vcdiff
4e3028f8 209 touch $@
c71beb75 210
d3b23034
GM
211## Only used if we need blessmail, but no harm in always defining.
212## This makes the actual blessmail executable.
f675ecb5 213blessmail:
70e48c86 214 $(EMACS) $(EMACSOPT) -l $(srcdir)/../lisp/mail/blessmail.el
c6207d0d 215 chmod +x blessmail
c6207d0d 216
d3b23034
GM
217## This checks if we need to run blessmail.
218## Do not charge ahead and do it! Let the installer decide.
f6c0ee20 219need-blessmail: blessmail
d19f95fe
RS
220 @if [ `wc -l <blessmail` != 2 ] ; then \
221 dir=`sed -n -e 's/echo mail directory = \(.*\)/\1/p' blessmail`; \
222 echo Assuming $$dir is really the mail spool directory, you should; \
81af9060 223 echo run lib-src/blessmail $(DESTDIR)${archlibdir}/movemail${EXEEXT}; \
108c7c97 224 echo as root, to give movemail${EXEEXT} appropriate permissions.; \
eb4252f7 225 echo Do that after running make install.; \
d19f95fe 226 fi
f6c0ee20 227
d3b23034 228## This is the target invoked by the top-level Makefile.
f6c0ee20 229maybe-blessmail: $(BLESSMAIL_TARGET)
d19f95fe 230
d3b23034
GM
231## Install the internal utilities. Until they are installed, we can
232## just run them directly from lib-src.
233## If the chown/chmod commands fail, that is not a big deal.
234## update-game-score will detect at runtime that it is not setuid,
235## and handle things accordingly.
81af9060 236$(DESTDIR)${archlibdir}: all
c71beb75
JB
237 @echo
238 @echo "Installing utilities run internally by Emacs."
005ad204 239 umask 022; ${MKDIR_P} $(DESTDIR)${archlibdir}
81af9060 240 if [ `(cd $(DESTDIR)${archlibdir} && /bin/pwd)` != `/bin/pwd` ]; then \
544d556f 241 for file in ${UTILITIES}; do \
81af9060 242 $(INSTALL_PROGRAM) $(INSTALL_STRIP) $$file $(DESTDIR)${archlibdir}/$$file ; \
544d556f 243 done ; \
ad600343 244 fi
005ad204 245 umask 022; ${MKDIR_P} $(DESTDIR)${gamedir}; \
c5a139ca 246 touch $(DESTDIR)${gamedir}/snake-scores; \
81af9060 247 touch $(DESTDIR)${gamedir}/tetris-scores
81af9060
EZ
248 -if chown ${gameuser} $(DESTDIR)${archlibdir}/update-game-score && chmod u+s $(DESTDIR)${archlibdir}/update-game-score; then \
249 chown ${gameuser} $(DESTDIR)${gamedir}; \
250 chmod u=rwx,g=rwx,o=rx $(DESTDIR)${gamedir}; \
7451222f 251 fi
c971758d 252 if [ `(cd $(DESTDIR)${archlibdir} && /bin/pwd)` \
ad600343 253 != `(cd ${srcdir} && /bin/pwd)` ]; then \
544d556f 254 for file in ${SCRIPTS}; do \
01c7d383 255 $(INSTALL_SCRIPT) ${srcdir}/$$file $(DESTDIR)${archlibdir}/$$file; \
c71beb75 256 done ; \
0268f19b 257 fi
f7dbcf3c 258
81af9060 259install: $(DESTDIR)${archlibdir}
c71beb75
JB
260 @echo
261 @echo "Installing utilities for users to run."
ed4affe1 262 umask 022; ${MKDIR_P} $(DESTDIR)${bindir}
b70cff71 263 for file in ${INSTALLABLES} ; do \
81af9060
EZ
264 $(INSTALL_PROGRAM) $(INSTALL_STRIP) $${file} $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \
265 chmod a+rx $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'`; \
0268f19b 266 done
b70cff71 267 for file in ${INSTALLABLE_SCRIPTS} ; do \
01c7d383 268 $(INSTALL_SCRIPT) ${srcdir}/$${file} $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \
81af9060 269 chmod a+rx $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'`; \
0268f19b 270 done
f7dbcf3c 271
39b649dd 272uninstall:
81af9060 273 (cd $(DESTDIR)${bindir}; \
a4663fed 274 for file in ${INSTALLABLES} ${INSTALLABLE_SCRIPTS}; do \
81af9060 275 rm -f $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \
a4663fed 276 done)
f8388570
TO
277 if [ -d $(DESTDIR)${archlibdir} ]; then \
278 (cd $(DESTDIR)${archlibdir} && \
279 rm -f ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}) \
280 fi
39b649dd 281
a17d2c25 282mostlyclean:
84bbb1ad 283 -rm -f core *.o
a17d2c25
RS
284
285clean: mostlyclean
497c74cd 286 -rm -f ${EXE_FILES}
e9490743 287 -rm -f ${STAMP_INST_SCRIPTS} ${STAMP_SCRIPTS}
f7dbcf3c 288
39b649dd 289distclean: clean
5c579a75 290 -rm -f TAGS
81ac4f35 291 -rm -f Makefile blessmail
f7dbcf3c 292
26873b72 293maintainer-clean: distclean
39b649dd 294 true
c71beb75 295
a01c76d7 296extraclean: maintainer-clean
c71beb75 297 -rm -f *~ \#*
f7dbcf3c 298
d3b23034 299## Test the contents of the directory.
f7dbcf3c 300check:
c88b05a9 301 @echo "We don't have any tests for the lib-src/ directory yet."
f7dbcf3c 302
93548af1 303tags: TAGS
108c7c97 304TAGS: etags${EXEEXT}
f7dbcf3c
JB
305 etags *.[ch]
306
d3b23034
GM
307## This verifies that the non-ASCII characters in the file \`testfile\'
308## have not been clobbered by whatever means were used to copy and
309## distribute Emacs. If they were clobbered, all the .elc files were
310## clobbered too.
108c7c97 311test-distrib${EXEEXT}: ${srcdir}/test-distrib.c
c88a7f88 312 $(CC) ${ALL_CFLAGS} -o test-distrib ${srcdir}/test-distrib.c
0d73e8e3 313 ./test-distrib ${srcdir}/testfile
f7dbcf3c 314
9a514d4a
PE
315../lib/libgnu.a: ../src/config.h
316 cd ../lib && $(MAKE) libgnu.a
317
5126d3b7 318regex.o: $(srcdir)/../src/regex.c $(srcdir)/../src/regex.h ../src/config.h
2f8d5db9
GM
319 ${CC} -c ${CPP_CFLAGS} -DCONFIG_BROKETS -DINHIBIT_STRING_HEADER \
320 ${srcdir}/../src/regex.c
66ab94d9 321
7bdede3f 322etags${EXEEXT}: ${srcdir}/etags.c regex.o ../src/config.h
2f8d5db9 323 $(CC) ${ALL_CFLAGS} -DEMACS_NAME="\"GNU Emacs\"" \
84bbb1ad 324 -DVERSION="\"${version}\"" ${srcdir}/etags.c \
7bdede3f 325 regex.o $(LOADLIBES) -o etags
f7dbcf3c 326
d47d6319 327ebrowse${EXEEXT}: ${srcdir}/ebrowse.c ${srcdir}/../lib/min-max.h ../src/config.h
2f8d5db9 328 $(CC) ${ALL_CFLAGS} -DVERSION="\"${version}\"" \
84bbb1ad 329 ${srcdir}/ebrowse.c $(LOADLIBES) -o ebrowse
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 \
7bdede3f 336 regex.o $(LOADLIBES) -o ctags
f7dbcf3c 337
108c7c97 338profile${EXEEXT}: ${srcdir}/profile.c ../src/config.h
379fb9c8
RS
339 $(CC) ${ALL_CFLAGS} ${srcdir}/profile.c $(LOADLIBES) -o profile
340
108c7c97 341make-docfile${EXEEXT}: ${srcdir}/make-docfile.c ../src/config.h
2f8d5db9
GM
342 $(CC) ${ALL_CFLAGS} ${srcdir}/make-docfile.c $(LOADLIBES) \
343 -o make-docfile
f7dbcf3c 344
d114d4f3
GM
345movemail${EXEEXT}: ${srcdir}/movemail.c pop.o ../src/config.h
346 $(CC) ${ALL_CFLAGS} ${MOVE_FLAGS} ${srcdir}/movemail.c pop.o \
84bbb1ad 347 $(LOADLIBES) $(LIBS_MOVE) -o movemail
81f94052 348
d47d6319 349pop.o: ${srcdir}/pop.c ${srcdir}/../lib/min-max.h ../src/config.h
81f94052 350 $(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/pop.c
f7dbcf3c 351
84bbb1ad
PE
352emacsclient${EXEEXT}: ${srcdir}/emacsclient.c ../src/config.h
353 $(CC) ${ALL_CFLAGS} ${srcdir}/emacsclient.c \
c2bcfb19 354 -DVERSION="\"${version}\"" \
deec6f99 355 $(LOADLIBES) -o emacsclient
f7dbcf3c 356
108c7c97 357hexl${EXEEXT}: ${srcdir}/hexl.c ../src/config.h
3e883207 358 $(CC) ${ALL_CFLAGS} ${srcdir}/hexl.c $(LOADLIBES) -o hexl
f7dbcf3c 359
1c728a9d
GM
360update-game-score${EXEEXT}: ${srcdir}/update-game-score.c ../src/config.h
361 $(CC) ${ALL_CFLAGS} -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\"" \
362 ${srcdir}/update-game-score.c $(LOADLIBES) -o update-game-score
d3b23034
GM
363
364## Makefile ends here.