Makefile.in 13.2 KB
Newer Older
1 2
### @configure_input@

Paul Eggert's avatar
Paul Eggert committed
3 4
# Copyright (C) 1985, 1987-1988, 1993-1994, 2001-2015 Free Software
# Foundation, Inc.
5

6
# This file is part of GNU Emacs.
7

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

13 14 15 16
# 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.
17

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

21
SHELL = @SHELL@
Jim Blandy's avatar
Jim Blandy committed
22

23 24
# Following ../lisp/Makefile.in.
EMACS = ../src/emacs
25
EMACSOPT = -batch --no-site-file --no-site-lisp
26

27
# ==================== Things `configure' will edit ====================
28

29 30
CC=@CC@
CFLAGS=@CFLAGS@
31 32 33
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@

34
version=@version@
35
## Used in $archlibdir.
36
configuration=@configuration@
37
EXEEXT=@EXEEXT@
38 39
C_SWITCH_SYSTEM=@C_SWITCH_SYSTEM@
C_SWITCH_MACHINE=@C_SWITCH_MACHINE@
40
PROFILING_CFLAGS = @PROFILING_CFLAGS@
41 42
WARN_CFLAGS = @WARN_CFLAGS@
WERROR_CFLAGS = @WERROR_CFLAGS@
43
UPDATE_MANIFEST = @UPDATE_MANIFEST@
44

45 46 47
# Program name transformation.
TRANSFORM = @program_transform_name@

48 49 50 51 52 53 54 55 56 57 58 59 60
# 'make' verbosity.
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@

AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo "  CC      " $@;
am__v_CC_1 =

AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo "  CCLD    " $@;
am__v_CCLD_1 =

61
# ==================== Where To Install Things ====================
62

63 64 65 66
# Location to install Emacs.app under GNUstep / Mac OS X.
# Later values may use this.
ns_appbindir=@ns_appbindir@

67 68 69 70 71
# 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'.
72
prefix=@prefix@
73

74 75
# Like `prefix', but used for architecture-specific files.  This is
# set with the --exec-prefix option to `../configure'.
76
exec_prefix=@exec_prefix@
77

78 79 80
# 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'.
81
bindir=@bindir@
82

83 84 85
# 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
86 87
# --libexecdir option to `../configure'.
libexecdir=@libexecdir@
88

89 90 91
# Directory for local state files for all programs.
localstatedir=@localstatedir@

92 93 94 95
# 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
96 97

# We use $(srcdir) explicitly in dependencies so as not to depend on VPATH.
98 99
srcdir=@srcdir@
VPATH=@srcdir@
100

David J. MacKenzie's avatar
David J. MacKenzie committed
101 102
# The top-level source directory, also set by configure.
top_srcdir=@top_srcdir@
103 104
# MinGW CPPFLAGS may use this.
abs_top_srcdir=@abs_top_srcdir@
David J. MacKenzie's avatar
David J. MacKenzie committed
105

106
# ==================== Emacs-specific directories ====================
107

108 109
# These variables hold the values Emacs will actually use.  They are
# based on the values of the standard Make variables above.
110

111 112 113 114 115
# 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'.
116
archlibdir=@archlibdir@
Eric S. Raymond's avatar
Eric S. Raymond committed
117

118 119 120
gamedir=@gamedir@
gameuser=@gameuser@

121
# ==================== Utility Programs for the Build =================
122

123
# ../configure figures out the correct values for these.
124 125
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
126
INSTALL_SCRIPT = @INSTALL_SCRIPT@
127 128
# By default, we uphold the dignity of our programs.
INSTALL_STRIP =
129
MKDIR_P = @MKDIR_P@
130

131
# ========================== Lists of Files ===========================
Jim Blandy's avatar
Jim Blandy committed
132

133 134 135
# emacsclientw.exe for MinGW, empty otherwise
CLIENTW = @CLIENTW@

136
# Things that a user might actually run, which should be installed in bindir.
137
INSTALLABLES = etags${EXEEXT} ctags${EXEEXT} emacsclient${EXEEXT} $(CLIENTW) \
138
               ebrowse${EXEEXT}
139

140 141
# Things that Emacs runs internally, or during the build process,
#  which should not be installed in bindir.
Glenn Morris's avatar
Glenn Morris committed
142 143
UTILITIES = profile${EXEEXT} movemail${EXEEXT} hexl${EXEEXT} \
            update-game-score${EXEEXT}
Jim Blandy's avatar
Jim Blandy committed
144

145
DONT_INSTALL= make-docfile${EXEEXT}
146

147 148
# Like UTILITIES, but they're not system-dependent, and should not be
#  deleted by the distclean target.
149
SCRIPTS= rcs2log $(UPDATE_MANIFEST)
Jim Blandy's avatar
Jim Blandy committed
150

Paul Eggert's avatar
Paul Eggert committed
151 152 153
# All files that are created by the linker, i.e., whose names end in ${EXEEXT}.
EXE_FILES = ${INSTALLABLES} ${UTILITIES} ${DONT_INSTALL}

Glenn Morris's avatar
Glenn Morris committed
154 155 156
# 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
157 158
# set by configure should be correct and you should not need to do anything.
# If neither flag is set, you need to use blessmail.
159 160
MOVE_FLAGS=

161 162
## Empty if either MAIL_USE_FLOCK or MAIL_USE_LOCKF, else need-blessmail.
BLESSMAIL_TARGET=@BLESSMAIL_TARGET@
163

164
## -lkrb or -lkrb4 if needed
165
KRB4LIB=@KRB4LIB@
166
## -ldes or -ldes425 if needed
167
DESLIB=@DESLIB@
168
## -lkrb5 if needed
169
KRB5LIB=@KRB5LIB@
170
## -lk5crypto or -lcrypto if needed
171
CRYPTOLIB=@CRYPTOLIB@
172
## -lcom_err if needed
173
COM_ERRLIB=@COM_ERRLIB@
174
## -lhesiod if needed
175 176 177 178 179
LIBHESIOD=@LIBHESIOD@
## -lresolv if HAVE_LIBRESOLV
LIBRESOLV=@LIBRESOLV@
## -llockfile if HAVE_LIBLOCKFILE or -lmail if HAVE_LIBMAIL
LIBS_MAIL=@LIBS_MAIL@
180 181
## empty or -lrt or -lposix4 if HAVE_CLOCK_GETTIME
LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
Paul Eggert's avatar
Paul Eggert committed
182 183
## empty or -lrt or -lposix4 if HAVE_FDATASYNC
LIB_FDATASYNC = @LIB_FDATASYNC@
184 185
## empty or -lwsock2 for MinGW
LIB_WSOCK32=@LIB_WSOCK32@
186 187

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

191 192 193 194 195
## Extra libraries when linking emacsclient
## (empty or -lcomctl32 for MinGW)
LIBS_ECLIENT = @LIBS_ECLIENT@

## Extra object files for linking for MinGW
196
NTLIB = @NTLIB@
197 198
CLIENTRES = @CLIENTRES@
WINDRES = @WINDRES@
199

200 201 202
## Some systems define this to request special libraries.
LIBS_SYSTEM = @LIBS_SYSTEM@

203 204
BASE_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) \
	      $(WARN_CFLAGS) $(WERROR_CFLAGS) \
205
	      -I. -I../src -I../lib \
Paul Eggert's avatar
Paul Eggert committed
206
	      -I${srcdir} -I${srcdir}/../src -I${srcdir}/../lib
207

208
ALL_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${LDFLAGS} ${CPPFLAGS} ${CFLAGS}
Glenn Morris's avatar
Glenn Morris committed
209
## Unused.
Dan Nicolaescu's avatar
Dan Nicolaescu committed
210
LINK_CFLAGS = ${BASE_CFLAGS} ${LDFLAGS} ${CFLAGS}
211
CPP_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${CPPFLAGS} ${CFLAGS}
212

213 214 215
# Configuration files for .o files to depend on.
config_h = ../src/config.h $(srcdir)/../src/conf_post.h

Glenn Morris's avatar
Glenn Morris committed
216
all: ${EXE_FILES} ${SCRIPTS}
217

218 219
.PHONY: all need-blessmail maybe-blessmail

Paul Eggert's avatar
Paul Eggert committed
220 221
LOADLIBES = ../lib/libgnu.a $(LIBS_SYSTEM)
$(EXE_FILES): ../lib/libgnu.a
222

223 224
## Only used if we need blessmail, but no harm in always defining.
## This makes the actual blessmail executable.
225
blessmail: $(srcdir)/../lisp/mail/blessmail.el
Paul Eggert's avatar
Paul Eggert committed
226 227
	$(AM_V_GEN)$(EMACS) $(EMACSOPT) -l $<
	$(AM_V_at)chmod +x $@
Karl Heuer's avatar
Karl Heuer committed
228

229 230
## This checks if we need to run blessmail.
## Do not charge ahead and do it!  Let the installer decide.
231
need-blessmail: blessmail
232 233
	@if [ `wc -l <blessmail` != 2 ] ; then \
	  dir=`sed -n -e 's/echo mail directory = \(.*\)/\1/p' blessmail`; \
234 235 236 237
	  echo "Assuming $$dir is really the mail spool directory, you should"; \
	  echo "run  lib-src/blessmail $(DESTDIR)${archlibdir}/movemail${EXEEXT}"; \
	  echo "as root, to give  movemail${EXEEXT}  appropriate permissions."; \
	  echo "Do that after running  make install."; \
238
	fi
239

240
## This is the target invoked by the top-level Makefile.
241
maybe-blessmail: $(BLESSMAIL_TARGET)
242

243 244 245 246 247
## Install the internal utilities.  Until they are installed, we can
## just run them directly from lib-src.
## If the chown/chmod commands fail, that is not a big deal.
## update-game-score will detect at runtime that it is not setuid,
## and handle things accordingly.
248
$(DESTDIR)${archlibdir}: all
249 250
	@echo
	@echo "Installing utilities run internally by Emacs."
251
	umask 022; ${MKDIR_P} "$(DESTDIR)${archlibdir}"
252 253
	exp_archlibdir=`cd "$(DESTDIR)${archlibdir}" && /bin/pwd`; \
	if [ "$$exp_archlibdir" != "`/bin/pwd`" ]; then \
254
	  for file in ${UTILITIES}; do \
255
	    $(INSTALL_PROGRAM) $(INSTALL_STRIP) $$file "$(DESTDIR)${archlibdir}/$$file" ; \
256
	  done ; \
257
        fi
258 259 260 261 262 263
	umask 022; ${MKDIR_P} "$(DESTDIR)${gamedir}"; \
	touch "$(DESTDIR)${gamedir}/snake-scores"; \
	touch "$(DESTDIR)${gamedir}/tetris-scores"
	-if chown ${gameuser} "$(DESTDIR)${archlibdir}/update-game-score${EXEEXT}" && chmod u+s "$(DESTDIR)${archlibdir}/update-game-score${EXEEXT}"; then \
	  chown ${gameuser} "$(DESTDIR)${gamedir}"; \
	  chmod u=rwx,g=rwx,o=rx "$(DESTDIR)${gamedir}"; \
264
	fi
265 266
	exp_archlibdir=`cd "$(DESTDIR)${archlibdir}" && /bin/pwd`; \
	if [ "$$exp_archlibdir" != "`cd ${srcdir} && /bin/pwd`" ]; then \
267
	  for file in ${SCRIPTS}; do \
268
	    $(INSTALL_SCRIPT) ${srcdir}/$$file "$(DESTDIR)${archlibdir}/$$file"; \
269
	  done ; \
270
	fi
Jim Blandy's avatar
Jim Blandy committed
271

272
.PHONY: install uninstall mostlyclean clean distclean maintainer-clean
273
.PHONY: bootstrap-clean extraclean check tags
274

275
install: $(DESTDIR)${archlibdir}
276 277
	@echo
	@echo "Installing utilities for users to run."
278
	umask 022; ${MKDIR_P} "$(DESTDIR)${bindir}"
279
	for file in ${INSTALLABLES} ; do \
280
	  $(INSTALL_PROGRAM) $(INSTALL_STRIP) $${file} "$(DESTDIR)${bindir}"/`echo $${file} | sed -e 's/${EXEEXT}$$//' -e '$(TRANSFORM)'`${EXEEXT} ; \
281
	done
Jim Blandy's avatar
Jim Blandy committed
282

283
uninstall:
284
	for file in ${INSTALLABLES}; do \
285
	  rm -f "$(DESTDIR)${bindir}"/`echo $${file} | sed -e 's/${EXEEXT}$$//' -e '$(TRANSFORM)'`${EXEEXT} ; \
286
	done
287 288
	if [ -d "$(DESTDIR)${archlibdir}" ]; then \
	  (cd "$(DESTDIR)${archlibdir}" && rm -f ${UTILITIES} ${SCRIPTS}) \
Tetsurou Okazaki's avatar
Tetsurou Okazaki committed
289
	fi
290

291
mostlyclean:
292
	-rm -f core *.o *.res
293 294

clean: mostlyclean
295
	-rm -f ${EXE_FILES}
Jim Blandy's avatar
Jim Blandy committed
296

297
distclean: clean
298
	-rm -f TAGS
299
	-rm -f Makefile blessmail
Jim Blandy's avatar
Jim Blandy committed
300

301
bootstrap-clean maintainer-clean: distclean
302
	true
303

304
extraclean: maintainer-clean
305
	-rm -f *~ \#*
Jim Blandy's avatar
Jim Blandy committed
306

307
## Test the contents of the directory.
Jim Blandy's avatar
Jim Blandy committed
308
check:
309
	@echo "We don't have any tests for the lib-src/ directory yet."
Jim Blandy's avatar
Jim Blandy committed
310

Karl Heuer's avatar
Karl Heuer committed
311
tags: TAGS
312
TAGS: etags${EXEEXT}
Jim Blandy's avatar
Jim Blandy committed
313 314
	etags *.[ch]

315
../lib/libgnu.a: $(config_h)
316
	$(MAKE) -C ../lib libgnu.a
Paul Eggert's avatar
Paul Eggert committed
317

318
regex.o: $(srcdir)/../src/regex.c $(srcdir)/../src/regex.h $(config_h)
319
	$(AM_V_CC)$(CC) -c $(CPP_CFLAGS) $<
320

321 322

etags_deps = ${srcdir}/etags.c regex.o $(NTLIB) $(config_h)
323
etags_cflags = -DEMACS_NAME="\"GNU Emacs\"" -DVERSION="\"${version}\"" -o $@
324
etags_libs = regex.o $(NTLIB) $(LOADLIBES)
325 326

etags${EXEEXT}: ${etags_deps}
327
	$(AM_V_CCLD)$(CC) ${ALL_CFLAGS} $(etags_cflags) $< $(etags_libs)
328

329 330
## ctags.c is distinct from etags.c so that parallel makes do not write two
## etags.o files on top of each other.
331
## FIXME?
332
## Can't we use a wrapper that calls 'etags --ctags'?
333
ctags${EXEEXT}: ${srcdir}/ctags.c ${etags_deps}
334
	$(AM_V_CCLD)$(CC) ${ALL_CFLAGS} $(etags_cflags) $< $(etags_libs)
Jim Blandy's avatar
Jim Blandy committed
335

336 337
ebrowse${EXEEXT}: ${srcdir}/ebrowse.c ${srcdir}/../lib/min-max.h $(NTLIB) \
                   $(config_h)
338
	$(AM_V_CCLD)$(CC) ${ALL_CFLAGS} -DVERSION="\"${version}\"" \
339
	  $< $(NTLIB) $(LOADLIBES) -o $@
Gerd Moellmann's avatar
Gerd Moellmann committed
340

341
profile${EXEEXT}: ${srcdir}/profile.c $(NTLIB) $(config_h)
342
	$(AM_V_CCLD)$(CC) ${ALL_CFLAGS} $< \
343
	  $(NTLIB) $(LOADLIBES) $(LIB_CLOCK_GETTIME) -o $@
Richard M. Stallman's avatar
Richard M. Stallman committed
344

345
make-docfile${EXEEXT}: ${srcdir}/make-docfile.c $(NTLIB) $(config_h)
346
	$(AM_V_CCLD)$(CC) ${ALL_CFLAGS} $< $(NTLIB) $(LOADLIBES) -o $@
Jim Blandy's avatar
Jim Blandy committed
347

348
movemail${EXEEXT}: ${srcdir}/movemail.c pop.o $(NTLIB) $(config_h)
349
	$(AM_V_CCLD)$(CC) ${ALL_CFLAGS} ${MOVE_FLAGS} $< pop.o \
350
	  $(NTLIB) $(LOADLIBES) $(LIBS_MOVE) -o $@
351

352
pop.o: ${srcdir}/pop.c ${srcdir}/pop.h ${srcdir}/../lib/min-max.h $(config_h)
353
	$(AM_V_CC)$(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} $<
Jim Blandy's avatar
Jim Blandy committed
354

355
emacsclient${EXEEXT}: ${srcdir}/emacsclient.c $(NTLIB) $(config_h)
356
	$(AM_V_CCLD)$(CC) ${ALL_CFLAGS} $< \
357
	   -DVERSION="\"${version}\"" $(NTLIB) $(LOADLIBES) $(LIB_FDATASYNC) \
358
	   $(LIB_WSOCK32) $(LIBS_ECLIENT) -o $@
359

360
emacsclientw${EXEEXT}: ${srcdir}/emacsclient.c $(NTLIB) $(CLIENTRES) $(config_h)
361
	$(AM_V_CCLD)$(CC) ${ALL_CFLAGS} $(CLIENTRES) -mwindows $< \
362
	   -DVERSION="\"${version}\"" $(LOADLIBES) $(LIB_FDATASYNC) \
363
	   $(LIB_WSOCK32) $(LIBS_ECLIENT) -o $@
364

365
NTINC = ${srcdir}/../nt/inc
366 367 368
NTDEPS = $(NTINC)/ms-w32.h $(NTINC)/sys/stat.h $(NTINC)/inttypes.h \
 $(NTINC)/stdint.h $(NTINC)/pwd.h $(NTINC)/sys/time.h $(NTINC)/stdbool.h \
 $(NTINC)/sys/wait.h $(NTINC)/unistd.h $(NTINC)/sys/file.h $(NTINC)/netdb.h
369

370 371 372
# The dependency on $(NTDEPS) is a trick intended to cause recompile of
# programs on MinGW whenever some private header in nt/inc is modified.
ntlib.o: ${srcdir}/ntlib.c ${srcdir}/ntlib.h $(NTDEPS)
373
	$(AM_V_CC)$(CC) -c ${CPP_CFLAGS} $<
Jim Blandy's avatar
Jim Blandy committed
374

375
hexl${EXEEXT}: ${srcdir}/hexl.c $(NTLIB) $(config_h)
376
	$(AM_V_CCLD)$(CC) ${ALL_CFLAGS} $< $(LOADLIBES) -o $@
Jim Blandy's avatar
Jim Blandy committed
377

378
update-game-score${EXEEXT}: ${srcdir}/update-game-score.c $(NTLIB) $(config_h)
379 380
	$(AM_V_CCLD)$(CC) ${ALL_CFLAGS} \
	  -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\"" \
381
	  $< $(NTLIB) $(LOADLIBES) -o $@
382

383
emacsclient.res: ../nt/emacsclient.rc $(NTINC)/../icons/emacs.ico
384
	$(WINDRES) -O coff --include-dir=$(NTINC)/.. -o $@ $<
385

386
## Makefile ends here.