1### @configure_input@
2
3# Copyright (C) 1985, 1987-1988, 1993-1994, 2001-2021 Free Software
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# the Free Software Foundation, either version 3 of the License, or
11# (at your option) any later version.
12
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.
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
21SHELL = @SHELL@
22
23# Following ../lisp/Makefile.in.
24EMACS = ../src/emacs${EXEEXT}
25EMACSOPT = -batch --no-site-file --no-site-lisp
26
27# ==================== Things 'configure' will edit ====================
28
29CC=@CC@
30CFLAGS=@CFLAGS@
31CPPFLAGS = @CPPFLAGS@
32LDFLAGS = @LDFLAGS@
33
34version=@version@
35## Used in $archlibdir.
36configuration=@configuration@
37EXEEXT=@EXEEXT@
38C_SWITCH_SYSTEM=@C_SWITCH_SYSTEM@
39C_SWITCH_MACHINE=@C_SWITCH_MACHINE@
40PROFILING_CFLAGS = @PROFILING_CFLAGS@
41WARN_CFLAGS = @WARN_CFLAGS@
42WERROR_CFLAGS = @WERROR_CFLAGS@
43
44# Program name transformation.
45TRANSFORM = @program_transform_name@
46
47# 'make' verbosity.
48AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
49
50AM_V_CC = $(am__v_CC_@AM_V@)
51am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
52am__v_CC_0 = @echo "  CC      " $@;
53am__v_CC_1 =
54
55AM_V_CCLD = $(am__v_CCLD_@AM_V@)
56am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
57am__v_CCLD_0 = @echo "  CCLD    " $@;
58am__v_CCLD_1 =
59
60AM_V_GEN = $(am__v_GEN_@AM_V@)
61am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
62am__v_GEN_0 = @echo "  GEN     " $@;
63am__v_GEN_1 =
64
65AM_V_RC = $(am__v_RC_@AM_V@)
66am__v_RC_ = $(am__v_RC_@AM_DEFAULT_V@)
67am__v_RC_0 = @echo "  RC      " $@;
68am__v_RC_1 =
69
70AM_V_at = $(am__v_at_@AM_V@)
71am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
72am__v_at_0 = @
73am__v_at_1 =
74
75# ==================== Where To Install Things ====================
76
77# Location to install Emacs.app under GNUstep / macOS.
78# Later values may use this.
79ns_appbindir=@ns_appbindir@
80
81# The default location for installation.  Everything is placed in
82# subdirectories of this directory.  The default values for many of
83# the variables below are expressed in terms of this one, so you may
84# not need to change them.  This is set with the --prefix option to
85# '../configure'.
86prefix=@prefix@
87
88# Like 'prefix', but used for architecture-specific files.  This is
89# set with the --exec-prefix option to '../configure'.
90exec_prefix=@exec_prefix@
91
92# Where to install Emacs and other binaries that people will want to
93# run directly (like etags).  This is set with the --bindir option
94# to '../configure'.
95bindir=@bindir@
96
97# Where to install and expect executable files to be run by Emacs
98# rather than directly by users, and other architecture-dependent
99# data.  ${archlibdir} is usually below this.  This is set with the
100# --libexecdir option to '../configure'.
101libexecdir=@libexecdir@
102
103# Nonempty if Emacs can assume Mailutils is installed.
104with_mailutils=@with_mailutils@
105
106# Directory for local state files for all programs.
107localstatedir=@localstatedir@
108
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.
113
114# We use $(srcdir) explicitly in dependencies so as not to depend on VPATH.
115srcdir=@srcdir@
116VPATH=@srcdir@
117
118# The top-level source directory, also set by configure.
119top_srcdir=@top_srcdir@
120# MinGW CPPFLAGS may use this.
121abs_top_srcdir=@abs_top_srcdir@
122
123# ==================== Emacs-specific directories ====================
124
125# These variables hold the values Emacs will actually use.  They are
126# based on the values of the standard Make variables above.
127
128# Where to put executables to be run by Emacs rather than the user.
129# This path usually includes the Emacs version and configuration name,
130# so that multiple configurations for multiple versions of Emacs may
131# be installed at once.  This can be set with the --archlibdir option
132# to '../configure'.
133archlibdir=@archlibdir@
134
135# User or group of the auxiliary program update-game-score, which is
136# installed on platforms with a game directory shared by multiple users.
137# On other platforms Emacs can update the score files itself.
138gameuser=@gameuser@
139gamegroup=@gamegroup@
140# Where to install game score files, if gameuser or gamegroup is nonempty.
141gamedir=@gamedir@
142# Nonempty if and only if a shared gamedir is used.
143use_gamedir=$(gameuser)$(gamegroup)
144
145# ==================== Utility Programs for the Build =================
146
147# ../configure figures out the correct values for these.
148INSTALL = @INSTALL@
149INSTALL_PROGRAM = @INSTALL_PROGRAM@
150INSTALL_SCRIPT = @INSTALL_SCRIPT@
151# By default, we uphold the dignity of our programs.
152INSTALL_STRIP =
153MKDIR_P = @MKDIR_P@
154
155# ========================== Lists of Files ===========================
156
157# emacsclientw.exe for MinGW, empty otherwise
158CLIENTW = @CLIENTW@
159
160# Things that a user might actually run, which should be installed in bindir.
161INSTALLABLES = etags${EXEEXT} ctags${EXEEXT} emacsclient${EXEEXT} $(CLIENTW) \
162               ebrowse${EXEEXT}
163
164# Things that Emacs runs internally, or during the build process,
165#  which should not be installed in bindir.
166UTILITIES = hexl${EXEEXT} 			 	 \
167	    $(if $(with_mailutils), , movemail${EXEEXT}) \
168            $(and $(use_gamedir), update-game-score${EXEEXT})
169
170DONT_INSTALL= make-docfile${EXEEXT} make-fingerprint${EXEEXT}
171
172# Like UTILITIES, but they're not system-dependent, and should not be
173#  deleted by the distclean target.
174SCRIPTS= rcs2log
175
176# All files that are created by the linker, i.e., whose names end in ${EXEEXT}.
177EXE_FILES = ${INSTALLABLES} ${UTILITIES} ${DONT_INSTALL}
178
179# Specify additional -D flags for movemail. Options:
180# -DMAIL_USE_FLOCK or -DMAIL_USE_LOCKF (use flock or lockf for file locking).
181# See the comments about locking in movemail.c.  Normally the values
182# set by configure should be correct and you should not need to do anything.
183# If neither flag is set, you need to use blessmail.
184MOVE_FLAGS=
185
186## Empty if either MAIL_USE_FLOCK or MAIL_USE_LOCKF, else need-blessmail.
187BLESSMAIL_TARGET=@BLESSMAIL_TARGET@
188
189## -lkrb or -lkrb4 if needed
190KRB4LIB=@KRB4LIB@
191## -ldes or -ldes425 if needed
192DESLIB=@DESLIB@
193## -lkrb5 if needed
194KRB5LIB=@KRB5LIB@
195## -lk5crypto or -lcrypto if needed
196CRYPTOLIB=@CRYPTOLIB@
197## -lcom_err if needed
198COM_ERRLIB=@COM_ERRLIB@
199## -lhesiod if needed
200LIBHESIOD=@LIBHESIOD@
201## -lresolv if HAVE_LIBRESOLV
202LIBRESOLV=@LIBRESOLV@
203## -llockfile if HAVE_LIBLOCKFILE or -lmail if HAVE_LIBMAIL
204LIBS_MAIL=@LIBS_MAIL@
205## empty or -lrt or -lposix4 if HAVE_CLOCK_GETTIME
206LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
207## Whatever libraries are needed for euidaccess
208LIB_EACCESS=@LIB_EACCESS@
209## empty or -lwsock2 for MinGW
210LIB_WSOCK32=@LIB_WSOCK32@
211
212## Extra libraries to use when linking movemail.
213LIBS_MOVE = $(LIBS_MAIL) $(KRB4LIB) $(DESLIB) $(KRB5LIB) $(CRYPTOLIB) \
214            $(COM_ERRLIB) $(LIBHESIOD) $(LIBRESOLV) $(LIB_WSOCK32)
215
216## Extra libraries when linking emacsclient
217## (empty or -lcomctl32 for MinGW)
218LIBS_ECLIENT = @LIBS_ECLIENT@
219
220## Extra object files for linking for MinGW
221NTLIB = @NTLIB@
222CLIENTRES = @CLIENTRES@
223WINDRES = @WINDRES@
224
225## Some systems define this to request special libraries.
226LIBS_SYSTEM = @LIBS_SYSTEM@
227
228BASE_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) \
229	      $(WARN_CFLAGS) $(WERROR_CFLAGS) \
230	      -I. -I../src -I../lib \
231	      -I${srcdir} -I${srcdir}/../src -I${srcdir}/../lib
232
233ALL_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${LDFLAGS} ${CPPFLAGS} ${CFLAGS}
234## Unused.
235LINK_CFLAGS = ${BASE_CFLAGS} ${LDFLAGS} ${CFLAGS}
236CPP_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${CPPFLAGS} ${CFLAGS}
237
238# Configuration files for .o files to depend on.
239config_h = ../src/config.h $(srcdir)/../src/conf_post.h
240
241all: ${EXE_FILES} ${SCRIPTS}
242
243.PHONY: all need-blessmail maybe-blessmail
244
245LOADLIBES = ../lib/libgnu.a $(LIBS_SYSTEM)
246$(EXE_FILES): ../lib/libgnu.a
247
248## Only used if we need blessmail, but no harm in always defining.
249## This makes the actual blessmail executable.
250blessmail: $(srcdir)/../lisp/mail/blessmail.el
251	$(AM_V_GEN)$(EMACS) $(EMACSOPT) -l $<
252	$(AM_V_at)chmod +x $@
253
254## This checks if we need to run blessmail.
255## Do not charge ahead and do it!  Let the installer decide.
256need-blessmail: blessmail
257	@if [ `wc -l <blessmail` != 2 ] ; then \
258	  dir=`sed -n -e 's/echo mail directory = \(.*\)/\1/p' blessmail`; \
259	  echo "Assuming $$dir is really the mail spool directory, you should"; \
260	  echo "run  lib-src/blessmail $(DESTDIR)${archlibdir}/movemail${EXEEXT}"; \
261	  echo "as root, to give  movemail${EXEEXT}  appropriate permissions."; \
262	  echo "Do that after running  make install."; \
263	fi
264
265## This is the target invoked by the top-level Makefile.
266maybe-blessmail: $(BLESSMAIL_TARGET)
267
268## Install the internal utilities.  Until they are installed, we can
269## just run them directly from lib-src.  When installing, do not give
270## up if chown or chgrp fails, as the package responsible for
271## installing Emacs can fix this problem later.
272$(DESTDIR)${archlibdir}: all
273	@echo
274	@echo "Installing utilities run internally by Emacs."
275	umask 022 && ${MKDIR_P} "$(DESTDIR)${archlibdir}"
276	exp_archlibdir=`cd "$(DESTDIR)${archlibdir}" && /bin/pwd` && \
277	if [ "$$exp_archlibdir" != "`/bin/pwd`" ]; then \
278	  for file in ${UTILITIES}; do \
279	    $(INSTALL_PROGRAM) $(INSTALL_STRIP) $$file \
280	      "$(DESTDIR)${archlibdir}/$$file" || exit; \
281	  done ; \
282        fi
283  ifneq (,$(use_gamedir))
284	umask 022 && ${MKDIR_P} "$(DESTDIR)${gamedir}"
285	touch "$(DESTDIR)${gamedir}/snake-scores" \
286	      "$(DESTDIR)${gamedir}/tetris-scores"
287    ifneq (,$(gameuser))
288	-chown ${gameuser} \
289	   "$(DESTDIR)${archlibdir}/update-game-score${EXEEXT}" \
290	   "$(DESTDIR)${gamedir}" && \
291	 chmod u+s,go-r \
292	   "$(DESTDIR)${archlibdir}/update-game-score${EXEEXT}" && \
293	 chmod u=rwx,g=rx,o=rx "$(DESTDIR)${gamedir}"
294    else
295	-chgrp ${gamegroup} \
296	   "$(DESTDIR)${archlibdir}/update-game-score${EXEEXT}" \
297	   "$(DESTDIR)${gamedir}" && \
298	 chmod g+s,o-r \
299	   "$(DESTDIR)${archlibdir}/update-game-score${EXEEXT}" && \
300	 chmod u=rwx,g=rwx,o=rx "$(DESTDIR)${gamedir}"
301    endif
302  endif
303	exp_archlibdir=`cd "$(DESTDIR)${archlibdir}" && /bin/pwd` && \
304	if [ "$$exp_archlibdir" != "`cd ${srcdir} && /bin/pwd`" ]; then \
305	  for file in ${SCRIPTS}; do \
306	    $(INSTALL_SCRIPT) ${srcdir}/$$file \
307	      "$(DESTDIR)${archlibdir}/$$file" || exit; \
308	  done ; \
309	fi
310
311.PHONY: install uninstall mostlyclean clean distclean maintainer-clean
312.PHONY: bootstrap-clean extraclean check tags
313
314install: $(DESTDIR)${archlibdir}
315	@echo
316	@echo "Installing utilities for users to run."
317	umask 022 && ${MKDIR_P} "$(DESTDIR)${bindir}"
318	for file in ${INSTALLABLES} ; do \
319	  $(INSTALL_PROGRAM) $(INSTALL_STRIP) $${file} \
320	    "$(DESTDIR)${bindir}"/` \
321	      echo $${file} | sed -e 's/${EXEEXT}$$//' -e '$(TRANSFORM)' \
322	    `${EXEEXT} || exit; \
323	done
324
325uninstall:
326	for file in ${INSTALLABLES}; do \
327	  rm -f "$(DESTDIR)${bindir}"/` \
328	    echo $${file} | sed -e 's/${EXEEXT}$$//' -e '$(TRANSFORM)' \
329	  `${EXEEXT}; \
330	done
331	if [ -d "$(DESTDIR)${archlibdir}" ]; then \
332	  cd "$(DESTDIR)${archlibdir}" && \
333	  rm -f ${UTILITIES} ${SCRIPTS}; \
334	fi
335
336mostlyclean:
337	rm -f core ./*.o ./*.res
338
339clean: mostlyclean
340	rm -f ${EXE_FILES}
341
342distclean: clean
343	rm -f TAGS Makefile blessmail
344
345bootstrap-clean maintainer-clean: distclean
346
347extraclean: maintainer-clean
348	rm -f ./*~ \#*
349
350## Test the contents of the directory.
351check:
352	@echo "We don't have any tests for the lib-src/ directory yet."
353
354tagsfiles = $(wildcard ${srcdir}/*.[ch])
355
356.PHONY: tags
357tags: TAGS
358TAGS: etags${EXEEXT} ${tagsfiles}
359	./etags ${tagsfiles}
360
361../lib/libgnu.a: $(config_h)
362	$(MAKE) -C ../lib all
363
364etags_deps = ${srcdir}/etags.c $(NTLIB) $(config_h)
365etags_libs = $(NTLIB) $(LOADLIBES)
366
367etags${EXEEXT}: ${etags_deps}
368	$(AM_V_CCLD)$(CC) ${ALL_CFLAGS} -o $@ $< $(etags_libs)
369
370## ctags.c is distinct from etags.c so that parallel makes do not write two
371## etags.o files on top of each other.
372## FIXME?
373## Can't we use a wrapper that calls 'etags --ctags'?
374ctags${EXEEXT}: ${srcdir}/ctags.c ${etags_deps}
375	$(AM_V_CCLD)$(CC) ${ALL_CFLAGS} -o $@ $< $(etags_libs)
376
377ebrowse${EXEEXT}: ${srcdir}/ebrowse.c ${srcdir}/../lib/min-max.h $(NTLIB) \
378                   $(config_h)
379	$(AM_V_CCLD)$(CC) ${ALL_CFLAGS} -o $@ $< $(NTLIB) $(LOADLIBES)
380
381make-docfile${EXEEXT}: ${srcdir}/make-docfile.c $(NTLIB) $(config_h)
382	$(AM_V_CCLD)$(CC) ${ALL_CFLAGS} $< $(NTLIB) $(LOADLIBES) -o $@
383
384make-fingerprint${EXEEXT}: ${srcdir}/make-fingerprint.c $(NTLIB) $(config_h)
385	$(AM_V_CCLD)$(CC) ${ALL_CFLAGS} $< $(NTLIB) $(LOADLIBES) -o $@
386
387movemail${EXEEXT}: ${srcdir}/movemail.c pop.o $(NTLIB) $(config_h)
388	$(AM_V_CCLD)$(CC) ${ALL_CFLAGS} ${MOVE_FLAGS} $< pop.o \
389	  $(NTLIB) $(LOADLIBES) $(LIBS_MOVE) -o $@
390
391pop.o: ${srcdir}/pop.c ${srcdir}/pop.h ${srcdir}/../lib/min-max.h $(config_h)
392	$(AM_V_CC)$(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} $<
393
394emacsclient${EXEEXT}: ${srcdir}/emacsclient.c $(NTLIB) $(config_h)
395	$(AM_V_CCLD)$(CC) ${ALL_CFLAGS} $< \
396	   $(NTLIB) $(LOADLIBES) \
397	   $(LIB_WSOCK32) $(LIB_EACCESS) $(LIBS_ECLIENT) -o $@
398
399emacsclientw${EXEEXT}: ${srcdir}/emacsclient.c $(NTLIB) $(CLIENTRES) $(config_h)
400	$(AM_V_CCLD)$(CC) ${ALL_CFLAGS} $(CLIENTRES) -mwindows $< \
401	   $(LOADLIBES) \
402	   $(LIB_WSOCK32) $(LIB_EACCESS) $(LIBS_ECLIENT) -o $@
403
404NTINC = ${srcdir}/../nt/inc
405NTDEPS = $(NTINC)/ms-w32.h $(NTINC)/sys/stat.h $(NTINC)/inttypes.h \
406 $(NTINC)/stdint.h $(NTINC)/pwd.h $(NTINC)/sys/time.h $(NTINC)/stdbool.h \
407 $(NTINC)/sys/wait.h $(NTINC)/unistd.h $(NTINC)/sys/file.h $(NTINC)/netdb.h
408
409# The dependency on $(NTDEPS) is a trick intended to cause recompile of
410# programs on MinGW whenever some private header in nt/inc is modified.
411ntlib.o: ${srcdir}/ntlib.c ${srcdir}/ntlib.h $(NTDEPS)
412	$(AM_V_CC)$(CC) -c ${CPP_CFLAGS} $<
413
414hexl${EXEEXT}: ${srcdir}/hexl.c $(NTLIB) $(config_h)
415	$(AM_V_CCLD)$(CC) ${ALL_CFLAGS} $< $(LOADLIBES) -o $@
416
417update-game-score${EXEEXT}: ${srcdir}/update-game-score.c $(NTLIB) $(config_h)
418	$(AM_V_CCLD)$(CC) ${ALL_CFLAGS} \
419	  -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\"" \
420	  $< $(NTLIB) $(LOADLIBES) -o $@
421
422emacsclient.res: ../nt/emacsclient.rc $(NTINC)/../icons/emacs.ico
423	$(AM_V_RC)$(WINDRES) -O coff --include-dir=$(NTINC)/.. -o $@ $<
424
425## Makefile ends here.
426