Makefile.in 14.4 KB
Newer Older
1
# Makefile for lib-src subdirectory in GNU Emacs.
2
# Copyright (C) 1985, 1987, 1988, 1993, 1994, 2001, 2002, 2003, 2004,
3
#   2005, 2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
4

5
# This file is part of GNU Emacs.
6

7
# GNU Emacs is free software: you can redistribute it and/or modify
8
# it under the terms of the GNU General Public License as published by
9 10
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
11

12 13 14 15
# GNU Emacs is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
16

17
# You should have received a copy of the GNU General Public License
18 19
# along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.

20

21 22
# Avoid trouble on systems where the `SHELL' variable might be
# inherited from the environment.
Jim Blandy's avatar
Jim Blandy committed
23 24
SHELL = /bin/sh

25 26 27 28
# Following ../lisp/Makefile.in.
EMACS = ../src/emacs
EMACSOPT = -batch --no-site-file --multibyte

29
# ==================== Things `configure' will edit ====================
30

31 32 33
CC=@CC@
CFLAGS=@CFLAGS@
version=@version@
34
configuration=@configuration@
35
EXEEXT=@EXEEXT@
36 37
C_SWITCH_SYSTEM=@C_SWITCH_SYSTEM@
C_SWITCH_MACHINE=@C_SWITCH_MACHINE@
38

39 40 41
# Program name transformation.
TRANSFORM = @program_transform_name@

42
# ==================== Where To Install Things ====================
43

44 45 46 47 48
# The default location for installation.  Everything is placed in
# subdirectories of this directory.  The default values for many of
# the variables below are expressed in terms of this one, so you may
# not need to change them.  This is set with the --prefix option to
# `../configure'.
49
prefix=@prefix@
50

51 52
# Like `prefix', but used for architecture-specific files.  This is
# set with the --exec-prefix option to `../configure'.
53
exec_prefix=@exec_prefix@
54

55 56 57
# Where to install Emacs and other binaries that people will want to
# run directly (like etags).  This is set with the --bindir option
# to `../configure'.
58
bindir=@bindir@
59

60 61 62
# Where to install and expect executable files to be run by Emacs
# rather than directly by users, and other architecture-dependent
# data.  ${archlibdir} is usually below this.  This is set with the
63 64
# --libexecdir option to `../configure'.
libexecdir=@libexecdir@
65

66 67 68
# Directory for local state files for all programs.
localstatedir=@localstatedir@

69 70 71 72
# Where to find the source code.  This is set by the configure
# script's `--srcdir' option.  However, the value of ${srcdir} in
# this makefile is not identical to what was specified with --srcdir,
# since the variable here has `/lib-src' added at the end.
Richard M. Stallman's avatar
Richard M. Stallman committed
73 74

# We use $(srcdir) explicitly in dependencies so as not to depend on VPATH.
75 76
srcdir=@srcdir@
VPATH=@srcdir@
77

David J. MacKenzie's avatar
David J. MacKenzie committed
78 79 80
# The top-level source directory, also set by configure.
top_srcdir=@top_srcdir@

81
# ==================== Emacs-specific directories ====================
82

83 84
# These variables hold the values Emacs will actually use.  They are
# based on the values of the standard Make variables above.
85

86 87 88 89 90
# Where to put executables to be run by Emacs rather than the user.
# This path usually includes the Emacs version and configuration name,
# so that multiple configurations for multiple versions of Emacs may
# be installed at once.  This can be set with the --archlibdir option
# to `../configure'.
91
archlibdir=@archlibdir@
Eric S. Raymond's avatar
Eric S. Raymond committed
92

93 94 95
gamedir=@gamedir@
gameuser=@gameuser@

96
# ==================== Utility Programs for the Build =================
97

98
# ../configure figures out the correct values for these.
99 100 101
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
102
INSTALL_SCRIPT = @INSTALL_SCRIPT@
103 104
# By default, we uphold the dignity of our programs.
INSTALL_STRIP =
105

106
# ========================== Lists of Files ===========================
Jim Blandy's avatar
Jim Blandy committed
107

108 109
# Things that a user might actually run,
# which should be installed in bindir.
110
INSTALLABLES = etags${EXEEXT} ctags${EXEEXT} emacsclient${EXEEXT} b2m${EXEEXT} ebrowse${EXEEXT} @LIB_SRC_EXTRA_INSTALLABLES@
111
INSTALLABLE_SCRIPTS = rcs-checkin grep-changelog
Jim Blandy's avatar
Jim Blandy committed
112

113 114
# Things that Emacs runs internally, or during the build process,
#  which should not be installed in bindir.
Glenn Morris's avatar
Glenn Morris committed
115 116
UTILITIES=  profile${EXEEXT} digest-doc${EXEEXT} sorted-doc${EXEEXT} \
            movemail${EXEEXT} fakemail${EXEEXT} \
117
            hexl${EXEEXT} update-game-score${EXEEXT}
Jim Blandy's avatar
Jim Blandy committed
118

119
DONT_INSTALL= test-distrib${EXEEXT} make-docfile${EXEEXT}
120

121 122
# Like UTILITIES, but they're not system-dependent, and should not be
#  deleted by the distclean target.
Jim Blandy's avatar
Jim Blandy committed
123 124
SCRIPTS= rcs2log vcdiff

125
EXECUTABLES= ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}
Jim Blandy's avatar
Jim Blandy committed
126

Glenn Morris's avatar
Glenn Morris committed
127 128 129 130 131
# Specify additional -D flags for movemail. Options:
# -DMAIL_USE_FLOCK or -DMAIL_USE_LOCKF (use flock or lockf for file locking).
# See the comments about locking in movemail.c.  Normally the values
# in ../src/[ms]/*.h should be correct and you should not need to do anything.
# If neither flag is set, blessmail is used.
132 133
MOVE_FLAGS=

134 135
## Empty if either MAIL_USE_FLOCK or MAIL_USE_LOCKF, else need-blessmail.
BLESSMAIL_TARGET=@BLESSMAIL_TARGET@
136

137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
## -lkrb if HAVE_LIBKRB or -lkrb4 if HAVE_LIBKRB4
KRB4LIB=@KRB4LIB@
## -ldes if HAVE_LIBDES or -ldes425 if HAVE_LIBDES425
DESLIB=@DESLIB@
## -lkrb5 if HAVE_LIBKRB5
KRB5LIB=@KRB5LIB@
## -lk5crypto if HAVE_LIBK5CRYPTO or -lcrypto if HAVE_LIBCRYPTO
CRYPTOLIB=@CRYPTOLIB@
## -lcom_err if HAVE_LIBCOM_ERR
COM_ERRLIB=@COM_ERRLIB@
## -lhesiod if HAVE_LIBHESIOD
LIBHESIOD=@LIBHESIOD@
## -lresolv if HAVE_LIBRESOLV
LIBRESOLV=@LIBRESOLV@
## -llockfile if HAVE_LIBLOCKFILE or -lmail if HAVE_LIBMAIL
LIBS_MAIL=@LIBS_MAIL@

## Extra libraries to use when linking movemail.
LIBS_MOVE = $(LIBS_MAIL) $(KRB4LIB) $(DESLIB) $(KRB5LIB) $(CRYPTOLIB) $(COM_ERRLIB) $(LIBHESIOD) $(LIBRESOLV)

157 158 159
## Some systems define this to request special libraries.
LIBS_SYSTEM = @LIBS_SYSTEM@

160 161 162 163 164 165
# Those files shared with other GNU utilities need HAVE_CONFIG_H
# defined before they know they can take advantage of the information
# in ../src/config.h.
ALL_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) -DHAVE_CONFIG_H -I. -I../src -I${srcdir} -I${srcdir}/../src ${LDFLAGS} ${CPPFLAGS} ${CFLAGS}
LINK_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) -DHAVE_CONFIG_H -I. -I../src -I${srcdir} -I${srcdir}/../src ${LDFLAGS} ${CFLAGS}
CPP_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) -DHAVE_CONFIG_H -I. -I../src -I${srcdir} -I${srcdir}/../src ${CPPFLAGS} ${CFLAGS}
166

167 168 169
# ========================== start of cpp stuff =======================
/* From here on, comments must be done in C syntax.  */

170
#ifdef MSDOS
171
#include "../src/config.h"
172
LIBS_SYSTEM = MSDOS_LIBS_SYSTEM
173
#endif
174 175

LOADLIBES=$(LIBS_SYSTEM)
176

177

178 179
.SUFFIXES: .m

180 181 182 183
/* This is the default compilation command.
   But we should never rely on it, because some make version
   failed to find it for getopt.o.
   Using an explicit command made it work.  */
184
.c.o:
185
	${CC} -c ${CPP_CFLAGS} $<
186

187 188
.m.o:
	$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $<
189

190 191
all: ${DONT_INSTALL} ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}

192
/* These targets copy the scripts into the build directory
193 194 195 196
so that they can be run from there in an uninstalled Emacs.
The "-" is prepended because some versions of cp barf when
srcdir is the current directory, and thus the file will be
copied into itself.  */
197
rcs2log: $(srcdir)/rcs2log
198
	-cp -p $(srcdir)/rcs2log rcs2log
199 200

rcs-checkin: $(srcdir)/rcs-checkin
201
	-cp -p $(srcdir)/rcs-checkin rcs-checkin
202 203

grep-changelog: $(srcdir)/grep-changelog
204
	-cp -p $(srcdir)/grep-changelog grep-changelog
205 206

vcdiff: $(srcdir)/vcdiff
207
	-cp -p $(srcdir)/vcdiff vcdiff
208

209 210
/* Only used if we need blessmail, but no harm in always defining.
   This makes the actual blessmail executable.  */
211
blessmail:
212
	$(EMACS) $(EMACSOPT) -l $(srcdir)/../lisp/mail/blessmail.el
Karl Heuer's avatar
Karl Heuer committed
213 214
	chmod +x blessmail

215 216
/* This checks if we need to run blessmail.  */
need-blessmail: blessmail
217
/* Don\'t charge ahead and do it!  Let the installer decide.
218
	  ./blessmail $(DESTDIR)${archlibdir}/movemail${EXEEXT}  */
219 220 221
	@if [ `wc -l <blessmail` != 2 ] ; then \
	  dir=`sed -n -e 's/echo mail directory = \(.*\)/\1/p' blessmail`; \
	  echo Assuming $$dir is really the mail spool directory, you should; \
222
	  echo run  lib-src/blessmail $(DESTDIR)${archlibdir}/movemail${EXEEXT}; \
223
	  echo as root, to give  movemail${EXEEXT}  appropriate permissions.; \
224
	  echo Do that after running  make install.; \
225
	fi
226 227 228

/* This is the target invoked by the top-level Makefile.  */
maybe-blessmail: $(BLESSMAIL_TARGET)
229

230 231
/* Install the internal utilities.  Until they are installed, we can
   just run them directly from lib-src.  */
232
$(DESTDIR)${archlibdir}: all
233 234
	@echo
	@echo "Installing utilities run internally by Emacs."
235
	umask 022; $(top_srcdir)/mkinstalldirs $(DESTDIR)${archlibdir}
236
	if [ `(cd $(DESTDIR)${archlibdir} && /bin/pwd)` != `/bin/pwd` ]; then \
237
	  for file in ${UTILITIES}; do \
238
	    $(INSTALL_PROGRAM) $(INSTALL_STRIP) $$file $(DESTDIR)${archlibdir}/$$file ; \
239
	  done ; \
240
        fi
241 242
	umask 022; $(top_srcdir)/mkinstalldirs $(DESTDIR)${gamedir}; \
	touch $(DESTDIR)${gamedir}/snake-scores; \
243
	touch $(DESTDIR)${gamedir}/tetris-scores
244 245 246
/* If the following commands fail, that is not a big deal.
   update-game-score will detect at runtime that it is not setuid,
   and handle things accordingly. */
247 248 249
	-if chown ${gameuser} $(DESTDIR)${archlibdir}/update-game-score && chmod u+s $(DESTDIR)${archlibdir}/update-game-score; then \
	  chown ${gameuser} $(DESTDIR)${gamedir}; \
	  chmod u=rwx,g=rwx,o=rx $(DESTDIR)${gamedir}; \
250
	fi
251
        if [ `(cd $(DESTDIR)${archlibdir} && /bin/pwd)` \
252
             != `(cd ${srcdir} && /bin/pwd)` ]; then \
253
	  for file in ${SCRIPTS}; do \
254
	    $(INSTALL_SCRIPT) ${srcdir}/$$file $(DESTDIR)${archlibdir}/$$file; \
255
	  done ; \
256
	fi
Jim Blandy's avatar
Jim Blandy committed
257

258
install: $(DESTDIR)${archlibdir}
259 260
	@echo
	@echo "Installing utilities for users to run."
261
	for file in ${INSTALLABLES} ; do \
262 263
	  $(INSTALL_PROGRAM) $(INSTALL_STRIP) $${file} $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \
	  chmod a+rx $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'`; \
264
	done
265
	for file in ${INSTALLABLE_SCRIPTS} ; do \
266
	  $(INSTALL_SCRIPT) ${srcdir}/$${file} $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'`  ; \
267
	  chmod a+rx $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'`; \
268
	done
Jim Blandy's avatar
Jim Blandy committed
269

270
uninstall:
271
	(cd $(DESTDIR)${bindir}; \
272
	for file in ${INSTALLABLES} ${INSTALLABLE_SCRIPTS}; do \
273
	  rm -f $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \
274
	done)
Tetsurou Okazaki's avatar
Tetsurou Okazaki committed
275 276 277 278
	if [ -d $(DESTDIR)${archlibdir} ]; then \
	  (cd $(DESTDIR)${archlibdir} && \
	   rm -f ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}) \
	fi
279

280
mostlyclean:
281
	-rm -f core *.o getopt.h getopt.h-t
282 283

clean: mostlyclean
284
	-rm -f ${INSTALLABLES} ${UTILITIES} ${DONT_INSTALL}
285
	-rm -f fns*.el *.tab.c *.tab.h
Jim Blandy's avatar
Jim Blandy committed
286

287
distclean: clean
288
	-rm -f TAGS
289
	-rm -f Makefile Makefile.c blessmail
Jim Blandy's avatar
Jim Blandy committed
290

291
maintainer-clean: distclean
292
	true
293

294
extraclean: maintainer-clean
295
	-rm -f *~ \#*
Jim Blandy's avatar
Jim Blandy committed
296

297
/* Test the contents of the directory.  */
Jim Blandy's avatar
Jim Blandy committed
298 299 300
check:
	@echo "We don't have any tests for GNU Emacs yet."

Karl Heuer's avatar
Karl Heuer committed
301
tags: TAGS
302
TAGS: etags${EXEEXT}
Jim Blandy's avatar
Jim Blandy committed
303 304
	etags *.[ch]

305
/* This verifies that the non-ASCII characters in the file \`testfile\'
306 307 308
   have not been clobbered by whatever means were used to copy and
   distribute Emacs.  If they were clobbered, all the .elc files were
   clobbered too.  */
309
test-distrib${EXEEXT}: ${srcdir}/test-distrib.c
310
	$(CC) ${ALL_CFLAGS} -o test-distrib ${srcdir}/test-distrib.c
311
	./test-distrib ${srcdir}/testfile
Jim Blandy's avatar
Jim Blandy committed
312

313
/* We need the following in order to create a <getopt.h> when the system
314
   does not have one that works with the given compiler.  */
315 316 317 318 319 320 321 322
GETOPT_H = @GETOPT_H@
getopt.h: getopt_.h
	cp $(srcdir)/getopt_.h $@-t
	mv $@-t $@

GETOPTOBJS = @GETOPTOBJS@
GETOPTDEPS = $(GETOPTOBJS) $(GETOPT_H)
getopt.o: ${srcdir}/getopt.c $(GETOPT_H) ${srcdir}/gettext.h
323
	${CC} -c ${CPP_CFLAGS} ${srcdir}/getopt.c
324
getopt1.o: ${srcdir}/getopt1.c $(GETOPT_H)
325
	${CC} -c ${CPP_CFLAGS} ${srcdir}/getopt1.c
Jim Blandy's avatar
Jim Blandy committed
326

327
REGEXPOBJ = regex.o
Richard M. Stallman's avatar
Richard M. Stallman committed
328
REGEXPDEPS = $(REGEXPOBJ) $(srcdir)/../src/regex.h
329

Richard M. Stallman's avatar
Richard M. Stallman committed
330
regex.o: $(srcdir)/../src/regex.c $(srcdir)/../src/regex.h ../src/config.h
Glenn Morris's avatar
Glenn Morris committed
331
	${CC} -c ${CPP_CFLAGS} -DCONFIG_BROKETS -DINHIBIT_STRING_HEADER ${srcdir}/../src/regex.c
332

333
etags${EXEEXT}: ${srcdir}/etags.c $(GETOPTDEPS) $(REGEXPDEPS) ../src/config.h
334
	$(CC) ${ALL_CFLAGS} -DEMACS_NAME="\"GNU Emacs\"" -DVERSION="\"${version}\"" ${srcdir}/etags.c $(GETOPTOBJS) $(REGEXPOBJ) $(LOADLIBES) -o etags
Jim Blandy's avatar
Jim Blandy committed
335

336
ebrowse${EXEEXT}: ${srcdir}/ebrowse.c $(GETOPTDEPS) ../src/config.h
Gerd Moellmann's avatar
Gerd Moellmann committed
337 338
	$(CC) ${ALL_CFLAGS} -DVERSION="\"${version}\"" ${srcdir}/ebrowse.c $(GETOPTOBJS) $(LOADLIBES) -o ebrowse

339
/* We depend on etags to assure that parallel makes don\'t write two
340
   etags.o files on top of each other.  */
341
ctags${EXEEXT}: etags${EXEEXT}
342
	$(CC) ${ALL_CFLAGS} -DCTAGS -DEMACS_NAME="\"GNU Emacs\"" -DVERSION="\"${version}\"" ${srcdir}/etags.c $(GETOPTOBJS) $(REGEXPOBJ) $(LOADLIBES) -o ctags
Jim Blandy's avatar
Jim Blandy committed
343

344
profile${EXEEXT}: ${srcdir}/profile.c ../src/config.h
Richard M. Stallman's avatar
Richard M. Stallman committed
345 346
	$(CC) ${ALL_CFLAGS} ${srcdir}/profile.c $(LOADLIBES) -o profile

347
make-docfile${EXEEXT}: ${srcdir}/make-docfile.c ../src/config.h
348
	$(CC) ${ALL_CFLAGS} ${srcdir}/make-docfile.c $(LOADLIBES) -o make-docfile
Jim Blandy's avatar
Jim Blandy committed
349

350
digest-doc${EXEEXT}: ${srcdir}/digest-doc.c
Juanma Barranquero's avatar
Juanma Barranquero committed
351
	$(CC) ${ALL_CFLAGS} ${srcdir}/digest-doc.c $(LOADLIBES) -o digest-doc
Jim Blandy's avatar
Jim Blandy committed
352

353 354
sorted-doc${EXEEXT}: ${srcdir}/sorted-doc.c
	$(CC) ${ALL_CFLAGS} ${srcdir}/sorted-doc.c $(LOADLIBES) -o sorted-doc
Jim Blandy's avatar
Jim Blandy committed
355

356
b2m${EXEEXT}: ${srcdir}/b2m.c ../src/config.h $(GETOPTDEPS)
357
	$(CC) ${ALL_CFLAGS} ${srcdir}/b2m.c  -DVERSION="\"${version}\"" \
Juanma Barranquero's avatar
Juanma Barranquero committed
358
	   $(GETOPTOBJS) $(LOADLIBES) -o b2m
Jim Blandy's avatar
Jim Blandy committed
359

360
movemail${EXEEXT}: movemail.o pop.o $(GETOPTDEPS)
361
	$(CC) ${LINK_CFLAGS} ${MOVE_FLAGS} movemail.o pop.o $(GETOPTOBJS) $(LOADLIBES) $(LIBS_MOVE) -o movemail
362

Glenn Morris's avatar
Glenn Morris committed
363
/*  We need to define emacs to get the right version of something (what?).  */
364
movemail.o: ${srcdir}/movemail.c ../src/config.h $(GETOPT_H)
365
	$(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/movemail.c
366

Dave Love's avatar
Dave Love committed
367
pop.o: ${srcdir}/pop.c  ../src/config.h
368
	$(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/pop.c
Jim Blandy's avatar
Jim Blandy committed
369

370
fakemail${EXEEXT}: ${srcdir}/fakemail.c ../src/config.h
371
	$(CC) ${ALL_CFLAGS} ${srcdir}/fakemail.c $(LOADLIBES) -o fakemail
Jim Blandy's avatar
Jim Blandy committed
372

373
emacsclient${EXEEXT}: ${srcdir}/emacsclient.c ../src/config.h $(GETOPTDEPS)
374
	$(CC) ${ALL_CFLAGS} ${srcdir}/emacsclient.c $(GETOPTOBJS)  \
375
	   -DVERSION="\"${version}\"" \
376
	   $(LOADLIBES) -o emacsclient
Jim Blandy's avatar
Jim Blandy committed
377

378
hexl${EXEEXT}: ${srcdir}/hexl.c ../src/config.h
379
	$(CC) ${ALL_CFLAGS} ${srcdir}/hexl.c $(LOADLIBES) -o hexl
Jim Blandy's avatar
Jim Blandy committed
380

381 382 383 384 385
update-game-score${EXEEXT}: update-game-score.o $(GETOPTDEPS)
	$(CC) ${LINK_CFLAGS} ${MOVE_FLAGS} update-game-score.o $(GETOPTOBJS) $(LOADLIBES) -o update-game-score

update-game-score.o: ${srcdir}/update-game-score.c ../src/config.h $(GETOPT_H)
	$(CC) -c ${CPP_CFLAGS} ${srcdir}/update-game-score.c \
386
	  -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\""