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

Paul Eggert's avatar
Paul Eggert committed
3
# Copyright (C) 1985, 1987-1988, 1993-1994, 2001-2020 Free Software
Paul Eggert's avatar
Paul Eggert committed
4
# 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
# along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
20

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

23
# Following ../lisp/Makefile.in.
24
EMACS = ../src/emacs${EXEEXT}
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

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

47 48 49 50 51 52 53 54 55 56 57 58 59
# '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 =

Paul Eggert's avatar
Paul Eggert committed
60 61 62 63 64
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo "  GEN     " $@;
am__v_GEN_1 =

65 66 67 68 69
AM_V_RC = $(am__v_RC_@AM_V@)
am__v_RC_ = $(am__v_RC_@AM_DEFAULT_V@)
am__v_RC_0 = @echo "  RC      " $@;
am__v_RC_1 =

Paul Eggert's avatar
Paul Eggert committed
70 71 72 73 74
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =

75
# ==================== Where To Install Things ====================
76

77
# Location to install Emacs.app under GNUstep / macOS.
78 79 80
# Later values may use this.
ns_appbindir=@ns_appbindir@

81 82 83 84
# 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
85
# '../configure'.
86
prefix=@prefix@
87

88 89
# Like 'prefix', but used for architecture-specific files.  This is
# set with the --exec-prefix option to '../configure'.
90
exec_prefix=@exec_prefix@
91

92 93
# Where to install Emacs and other binaries that people will want to
# run directly (like etags).  This is set with the --bindir option
94
# to '../configure'.
95
bindir=@bindir@
96

97 98 99
# 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
100
# --libexecdir option to '../configure'.
101
libexecdir=@libexecdir@
102

103 104 105
# Nonempty if Emacs can assume Mailutils is installed.
with_mailutils=@with_mailutils@

106 107 108
# Directory for local state files for all programs.
localstatedir=@localstatedir@

109
# Where to find the source code.  This is set by the configure
110
# script's '--srcdir' option.  However, the value of ${srcdir} in
111
# this makefile is not identical to what was specified with --srcdir,
112
# since the variable here has '/lib-src' added at the end.
Richard M. Stallman's avatar
Richard M. Stallman committed
113 114

# We use $(srcdir) explicitly in dependencies so as not to depend on VPATH.
115 116
srcdir=@srcdir@
VPATH=@srcdir@
117

David J. MacKenzie's avatar
David J. MacKenzie committed
118 119
# The top-level source directory, also set by configure.
top_srcdir=@top_srcdir@
120 121
# MinGW CPPFLAGS may use this.
abs_top_srcdir=@abs_top_srcdir@
David J. MacKenzie's avatar
David J. MacKenzie committed
122

123
# ==================== Emacs-specific directories ====================
124

125 126
# These variables hold the values Emacs will actually use.  They are
# based on the values of the standard Make variables above.
127

128 129 130 131
# 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
132
# to '../configure'.
133
archlibdir=@archlibdir@
Eric S. Raymond's avatar
Eric S. Raymond committed
134

135 136 137
# User or group of the auxiliary program update-game-score, which is
# installed on platforms with a game directory shared by multiple users.
# On other platforms Emacs can update the score files itself.
138
gameuser=@gameuser@
139
gamegroup=@gamegroup@
140 141 142 143
# Where to install game score files, if gameuser or gamegroup is nonempty.
gamedir=@gamedir@
# Nonempty if and only if a shared gamedir is used.
use_gamedir=$(gameuser)$(gamegroup)
144

145
# ==================== Utility Programs for the Build =================
146

147
# ../configure figures out the correct values for these.
148 149
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
150
INSTALL_SCRIPT = @INSTALL_SCRIPT@
151 152
# By default, we uphold the dignity of our programs.
INSTALL_STRIP =
153
MKDIR_P = @MKDIR_P@
154

155
# ========================== Lists of Files ===========================
Jim Blandy's avatar
Jim Blandy committed
156

157 158 159
# emacsclientw.exe for MinGW, empty otherwise
CLIENTW = @CLIENTW@

160
# Things that a user might actually run, which should be installed in bindir.
161
INSTALLABLES = etags${EXEEXT} ctags${EXEEXT} emacsclient${EXEEXT} $(CLIENTW) \
162
               ebrowse${EXEEXT}
163

164 165
# Things that Emacs runs internally, or during the build process,
#  which should not be installed in bindir.
166
UTILITIES = hexl${EXEEXT} 			 	 \
167
	    $(if $(with_mailutils), , movemail${EXEEXT}) \
168
            $(and $(use_gamedir), update-game-score${EXEEXT})
Jim Blandy's avatar
Jim Blandy committed
169

Daniel Colascione's avatar
Daniel Colascione committed
170
DONT_INSTALL= make-docfile${EXEEXT} make-fingerprint${EXEEXT}
171

172 173
# Like UTILITIES, but they're not system-dependent, and should not be
#  deleted by the distclean target.
174
SCRIPTS= rcs2log
Jim Blandy's avatar
Jim Blandy committed
175

Paul Eggert's avatar
Paul Eggert committed
176 177 178
# 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
179 180 181
# 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
182 183
# set by configure should be correct and you should not need to do anything.
# If neither flag is set, you need to use blessmail.
184 185
MOVE_FLAGS=

186 187
## Empty if either MAIL_USE_FLOCK or MAIL_USE_LOCKF, else need-blessmail.
BLESSMAIL_TARGET=@BLESSMAIL_TARGET@
188

189
## -lkrb or -lkrb4 if needed
190
KRB4LIB=@KRB4LIB@
191
## -ldes or -ldes425 if needed
192
DESLIB=@DESLIB@
193
## -lkrb5 if needed
194
KRB5LIB=@KRB5LIB@
195
## -lk5crypto or -lcrypto if needed
196
CRYPTOLIB=@CRYPTOLIB@
197
## -lcom_err if needed
198
COM_ERRLIB=@COM_ERRLIB@
199
## -lhesiod if needed
200 201 202 203 204
LIBHESIOD=@LIBHESIOD@
## -lresolv if HAVE_LIBRESOLV
LIBRESOLV=@LIBRESOLV@
## -llockfile if HAVE_LIBLOCKFILE or -lmail if HAVE_LIBMAIL
LIBS_MAIL=@LIBS_MAIL@
205 206
## empty or -lrt or -lposix4 if HAVE_CLOCK_GETTIME
LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
207 208
## Whatever libraries are needed for euidaccess
LIB_EACCESS=@LIB_EACCESS@
209 210
## empty or -lwsock2 for MinGW
LIB_WSOCK32=@LIB_WSOCK32@
211 212

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

216 217 218 219 220
## Extra libraries when linking emacsclient
## (empty or -lcomctl32 for MinGW)
LIBS_ECLIENT = @LIBS_ECLIENT@

## Extra object files for linking for MinGW
221
NTLIB = @NTLIB@
222 223
CLIENTRES = @CLIENTRES@
WINDRES = @WINDRES@
224

225 226 227
## Some systems define this to request special libraries.
LIBS_SYSTEM = @LIBS_SYSTEM@

228 229
BASE_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) \
	      $(WARN_CFLAGS) $(WERROR_CFLAGS) \
230
	      -I. -I../src -I../lib \
Paul Eggert's avatar
Paul Eggert committed
231
	      -I${srcdir} -I${srcdir}/../src -I${srcdir}/../lib
232

233 234
ALL_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${LDFLAGS} ${CPPFLAGS} ${CFLAGS}
CPP_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${CPPFLAGS} ${CFLAGS}
235

236 237 238
# 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
239
all: ${EXE_FILES} ${SCRIPTS}
240

241 242
.PHONY: all need-blessmail maybe-blessmail

Paul Eggert's avatar
Paul Eggert committed
243 244
LOADLIBES = ../lib/libgnu.a $(LIBS_SYSTEM)
$(EXE_FILES): ../lib/libgnu.a
245

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

252 253
## This checks if we need to run blessmail.
## Do not charge ahead and do it!  Let the installer decide.
254
need-blessmail: blessmail
255 256
	@if [ `wc -l <blessmail` != 2 ] ; then \
	  dir=`sed -n -e 's/echo mail directory = \(.*\)/\1/p' blessmail`; \
257 258 259 260
	  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."; \
261
	fi
262

263
## This is the target invoked by the top-level Makefile.
264
maybe-blessmail: $(BLESSMAIL_TARGET)
265

266
## Install the internal utilities.  Until they are installed, we can
267 268 269
## just run them directly from lib-src.  When installing, do not give
## up if chown or chgrp fails, as the package responsible for
## installing Emacs can fix this problem later.
270
$(DESTDIR)${archlibdir}: all
271 272
	@echo
	@echo "Installing utilities run internally by Emacs."
273 274
	umask 022 && ${MKDIR_P} "$(DESTDIR)${archlibdir}"
	exp_archlibdir=`cd "$(DESTDIR)${archlibdir}" && /bin/pwd` && \
275
	if [ "$$exp_archlibdir" != "`/bin/pwd`" ]; then \
276
	  for file in ${UTILITIES}; do \
277 278
	    $(INSTALL_PROGRAM) $(INSTALL_STRIP) $$file \
	      "$(DESTDIR)${archlibdir}/$$file" || exit; \
279
	  done ; \
280
        fi
281 282
  ifneq (,$(use_gamedir))
	umask 022 && ${MKDIR_P} "$(DESTDIR)${gamedir}"
283 284
	touch "$(DESTDIR)${gamedir}/snake-scores" \
	      "$(DESTDIR)${gamedir}/tetris-scores"
285
    ifneq (,$(gameuser))
286 287 288 289 290 291
	-chown ${gameuser} \
	   "$(DESTDIR)${archlibdir}/update-game-score${EXEEXT}" \
	   "$(DESTDIR)${gamedir}" && \
	 chmod u+s,go-r \
	   "$(DESTDIR)${archlibdir}/update-game-score${EXEEXT}" && \
	 chmod u=rwx,g=rx,o=rx "$(DESTDIR)${gamedir}"
292
    else
293
	-chgrp ${gamegroup} \
294
	   "$(DESTDIR)${archlibdir}/update-game-score${EXEEXT}" \
295 296 297 298
	   "$(DESTDIR)${gamedir}" && \
	 chmod g+s,o-r \
	   "$(DESTDIR)${archlibdir}/update-game-score${EXEEXT}" && \
	 chmod u=rwx,g=rwx,o=rx "$(DESTDIR)${gamedir}"
299 300
    endif
  endif
301
	exp_archlibdir=`cd "$(DESTDIR)${archlibdir}" && /bin/pwd` && \
302
	if [ "$$exp_archlibdir" != "`cd ${srcdir} && /bin/pwd`" ]; then \
303
	  for file in ${SCRIPTS}; do \
304 305
	    $(INSTALL_SCRIPT) ${srcdir}/$$file \
	      "$(DESTDIR)${archlibdir}/$$file" || exit; \
306
	  done ; \
307
	fi
Jim Blandy's avatar
Jim Blandy committed
308

309
.PHONY: install uninstall mostlyclean clean distclean maintainer-clean
310
.PHONY: bootstrap-clean extraclean check tags
311

312
install: $(DESTDIR)${archlibdir}
313 314
	@echo
	@echo "Installing utilities for users to run."
315
	umask 022 && ${MKDIR_P} "$(DESTDIR)${bindir}"
316
	for file in ${INSTALLABLES} ; do \
317 318 319 320
	  $(INSTALL_PROGRAM) $(INSTALL_STRIP) $${file} \
	    "$(DESTDIR)${bindir}"/` \
	      echo $${file} | sed -e 's/${EXEEXT}$$//' -e '$(TRANSFORM)' \
	    `${EXEEXT} || exit; \
321
	done
Jim Blandy's avatar
Jim Blandy committed
322

323
uninstall:
324
	for file in ${INSTALLABLES}; do \
325 326 327
	  rm -f "$(DESTDIR)${bindir}"/` \
	    echo $${file} | sed -e 's/${EXEEXT}$$//' -e '$(TRANSFORM)' \
	  `${EXEEXT}; \
328
	done
329
	if [ -d "$(DESTDIR)${archlibdir}" ]; then \
330 331
	  cd "$(DESTDIR)${archlibdir}" && \
	  rm -f ${UTILITIES} ${SCRIPTS}; \
Tetsurou Okazaki's avatar
Tetsurou Okazaki committed
332
	fi
333

334
mostlyclean:
335
	rm -f core ./*.o ./*.res
336 337

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

340
distclean: clean
341
	rm -f TAGS Makefile blessmail
Jim Blandy's avatar
Jim Blandy committed
342

343
bootstrap-clean maintainer-clean: distclean
344

345
extraclean: maintainer-clean
346
	rm -f ./*~ \#*
Jim Blandy's avatar
Jim Blandy committed
347

348
## Test the contents of the directory.
Jim Blandy's avatar
Jim Blandy committed
349
check:
350
	@echo "We don't have any tests for the lib-src/ directory yet."
Jim Blandy's avatar
Jim Blandy committed
351

352 353 354
tagsfiles = $(wildcard ${srcdir}/*.[ch])

.PHONY: tags
Karl Heuer's avatar
Karl Heuer committed
355
tags: TAGS
356 357
TAGS: etags${EXEEXT} ${tagsfiles}
	./etags ${tagsfiles}
Jim Blandy's avatar
Jim Blandy committed
358

359
../lib/libgnu.a: $(config_h)
360
	$(MAKE) -C ../lib all
Paul Eggert's avatar
Paul Eggert committed
361

Paul Eggert's avatar
Paul Eggert committed
362 363
etags_deps = ${srcdir}/etags.c $(NTLIB) $(config_h)
etags_libs = $(NTLIB) $(LOADLIBES)
364 365

etags${EXEEXT}: ${etags_deps}
366
	$(AM_V_CCLD)$(CC) ${ALL_CFLAGS} -o $@ $< $(etags_libs)
367

368 369
## ctags.c is distinct from etags.c so that parallel makes do not write two
## etags.o files on top of each other.
370
## FIXME?
371
## Can't we use a wrapper that calls 'etags --ctags'?
372
ctags${EXEEXT}: ${srcdir}/ctags.c ${etags_deps}
373
	$(AM_V_CCLD)$(CC) ${ALL_CFLAGS} -o $@ $< $(etags_libs)
Jim Blandy's avatar
Jim Blandy committed
374

375 376
ebrowse${EXEEXT}: ${srcdir}/ebrowse.c ${srcdir}/../lib/min-max.h $(NTLIB) \
                   $(config_h)
377
	$(AM_V_CCLD)$(CC) ${ALL_CFLAGS} -o $@ $< $(NTLIB) $(LOADLIBES)
Gerd Moellmann's avatar
Gerd Moellmann committed
378

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

Daniel Colascione's avatar
Daniel Colascione committed
382 383 384
make-fingerprint${EXEEXT}: ${srcdir}/make-fingerprint.c $(NTLIB) $(config_h)
	$(AM_V_CCLD)$(CC) ${ALL_CFLAGS} $< $(NTLIB) $(LOADLIBES) -o $@

385
movemail${EXEEXT}: ${srcdir}/movemail.c pop.o $(NTLIB) $(config_h)
386
	$(AM_V_CCLD)$(CC) ${ALL_CFLAGS} ${MOVE_FLAGS} $< pop.o \
387
	  $(NTLIB) $(LOADLIBES) $(LIBS_MOVE) -o $@
388

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

392
emacsclient${EXEEXT}: ${srcdir}/emacsclient.c $(NTLIB) $(config_h)
393
	$(AM_V_CCLD)$(CC) ${ALL_CFLAGS} $< \
394
	   $(NTLIB) $(LOADLIBES) \
395
	   $(LIB_WSOCK32) $(LIB_EACCESS) $(LIBS_ECLIENT) -o $@
396

397
emacsclientw${EXEEXT}: ${srcdir}/emacsclient.c $(NTLIB) $(CLIENTRES) $(config_h)
398
	$(AM_V_CCLD)$(CC) ${ALL_CFLAGS} $(CLIENTRES) -mwindows $< \
399
	   $(LOADLIBES) \
400
	   $(LIB_WSOCK32) $(LIB_EACCESS) $(LIBS_ECLIENT) -o $@
401

402
NTINC = ${srcdir}/../nt/inc
403 404 405
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
406

407 408 409
# 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)
410
	$(AM_V_CC)$(CC) -c ${CPP_CFLAGS} $<
Jim Blandy's avatar
Jim Blandy committed
411

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

415
update-game-score${EXEEXT}: ${srcdir}/update-game-score.c $(NTLIB) $(config_h)
416 417
	$(AM_V_CCLD)$(CC) ${ALL_CFLAGS} \
	  -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\"" \
418
	  $< $(NTLIB) $(LOADLIBES) -o $@
419

420
emacsclient.res: ../nt/emacsclient.rc $(NTINC)/../icons/emacs.ico
421
	$(AM_V_RC)$(WINDRES) -O coff --include-dir=$(NTINC)/.. -o $@ $<
422

423
## Makefile ends here.