3 # Copyright (C) 1985, 1987-1988, 1993-1994, 2001-2024 Free Software
6 # This file is part of GNU Emacs.
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.
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.
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/>.
23 # Prevent any settings in the user environment causing problems.
24 unexport EMACSDATA EMACSDOC EMACSLOADPATH EMACSPATH
26 # Following ../lisp/Makefile.in.
27 EMACS
= ..
/src
/emacs
${EXEEXT}
28 EMACSOPT
= -batch
--no-site-file
--no-site-lisp
30 # ==================== Things 'configure' will edit ====================
40 ## Used in $archlibdir.
41 configuration
=@configuration@
43 C_SWITCH_SYSTEM
=@C_SWITCH_SYSTEM@
44 C_SWITCH_MACHINE
=@C_SWITCH_MACHINE@
45 PROFILING_CFLAGS
= @PROFILING_CFLAGS@
46 WARN_CFLAGS
= @WARN_CFLAGS@
47 WERROR_CFLAGS
= @WERROR_CFLAGS@
49 # Program name transformation.
50 TRANSFORM
= @program_transform_name@
52 top_builddir
= @top_builddir@
53 -include ${top_builddir}/src
/verbose.mk
55 # ==================== Where To Install Things ====================
57 # Location to install Emacs.app under GNUstep / macOS.
58 # Later values may use this.
59 ns_appbindir
=@ns_appbindir@
60 ns_applibexecdir
=@ns_applibexecdir@
62 # The default location for installation. Everything is placed in
63 # subdirectories of this directory. The default values for many of
64 # the variables below are expressed in terms of this one, so you may
65 # not need to change them. This is set with the --prefix option to
69 # Like 'prefix', but used for architecture-specific files. This is
70 # set with the --exec-prefix option to '../configure'.
71 exec_prefix=@
exec_prefix@
73 # Where to install Emacs and other binaries that people will want to
74 # run directly (like etags). This is set with the --bindir option
78 # Where to install and expect executable files to be run by Emacs
79 # rather than directly by users, and other architecture-dependent
80 # data. ${archlibdir} is usually below this. This is set with the
81 # --libexecdir option to '../configure'.
82 libexecdir
=@libexecdir@
84 # Nonempty if Emacs can assume Mailutils is installed.
85 with_mailutils
=@with_mailutils@
87 # Directory for local state files for all programs.
88 localstatedir
=@localstatedir@
90 # Where to find the source code. This is set by the configure
91 # script's '--srcdir' option. However, the value of ${srcdir} in
92 # this makefile is not identical to what was specified with --srcdir,
93 # since the variable here has '/lib-src' added at the end.
95 # We use $(srcdir) explicitly in dependencies so as not to depend on VPATH.
99 # Cross-compilation setup
101 XCONFIGURE
=@XCONFIGURE@
103 ifneq ($(XCONFIGURE
),)
107 # The top-level source directory, also set by configure.
108 top_srcdir
=@top_srcdir@
109 # MinGW CPPFLAGS may use this.
110 abs_top_srcdir
=@abs_top_srcdir@
112 # ==================== Emacs-specific directories ====================
114 # These variables hold the values Emacs will actually use. They are
115 # based on the values of the standard Make variables above.
117 # Where to put executables to be run by Emacs rather than the user.
118 # This path usually includes the Emacs version and configuration name,
119 # so that multiple configurations for multiple versions of Emacs may
120 # be installed at once. This can be set with the --archlibdir option
122 archlibdir
=@archlibdir@
124 # User or group of the auxiliary program update-game-score, which is
125 # installed on platforms with a game directory shared by multiple users.
126 # On other platforms Emacs can update the score files itself.
128 gamegroup
=@gamegroup@
129 # Where to install game score files, if gameuser or gamegroup is nonempty.
131 # Nonempty if and only if a shared gamedir is used.
132 use_gamedir
=$(gameuser
)$(gamegroup
)
134 # ==================== Utility Programs for the Build =================
136 # ../configure figures out the correct values for these.
138 INSTALL_PROGRAM
= @INSTALL_PROGRAM@
139 INSTALL_SCRIPT
= @INSTALL_SCRIPT@
140 # By default, we uphold the dignity of our programs.
144 # ========================== Lists of Files ===========================
146 ## Haiku build-time support
147 HAVE_BE_APP
=@HAVE_BE_APP@
148 HAIKU_LIBS
=@HAIKU_LIBS@
149 HAIKU_CFLAGS
=@HAIKU_CFLAGS@
151 ## Android build-time support
154 # emacsclientw.exe for MinGW, empty otherwise
157 # Things that a user might actually run, which should be installed in bindir.
158 INSTALLABLES
= etags
${EXEEXT} ctags
${EXEEXT} emacsclient
${EXEEXT} $(CLIENTW
) \
161 # Things that Emacs runs internally, or during the build process,
162 # which should not be installed in bindir.
163 UTILITIES
= hexl
${EXEEXT} \
164 $(if
$(with_mailutils
), , movemail
${EXEEXT}) \
165 $(and
$(use_gamedir
), update-game-score
${EXEEXT})
167 ifeq ($(HAVE_BE_APP
),yes
)
168 DONT_INSTALL
= make-docfile
${EXEEXT} make-fingerprint
${EXEEXT} be-resources
170 ifeq ($(XCONFIGURE
)$(HAVE_ANDROID
),yes
)
171 DONT_INSTALL
= make-docfile
${EXEEXT} make-fingerprint
${EXEEXT} \
172 asset-directory-tool
${EXEEXT}
174 DONT_INSTALL
= make-docfile
${EXEEXT} make-fingerprint
${EXEEXT}
178 # Like UTILITIES, but they're not system-dependent, and should not be
179 # deleted by the distclean target.
182 # All files that are created by the linker, i.e., whose names end in ${EXEEXT}.
183 EXE_FILES
= ${INSTALLABLES} ${UTILITIES} ${DONT_INSTALL}
185 # Specify additional -D flags for movemail. Options:
186 # -DMAIL_USE_FLOCK or -DMAIL_USE_LOCKF (use flock or lockf for file locking).
187 # See the comments about locking in movemail.c. Normally the values
188 # set by configure should be correct and you should not need to do anything.
189 # If neither flag is set, you need to use blessmail.
192 ## Empty if either MAIL_USE_FLOCK or MAIL_USE_LOCKF, else need-blessmail.
193 BLESSMAIL_TARGET
=@BLESSMAIL_TARGET@
195 ## -lkrb or -lkrb4 if needed
197 ## -ldes or -ldes425 if needed
201 ## -lk5crypto or -lcrypto if needed
202 CRYPTOLIB
=@CRYPTOLIB@
203 ## -lcom_err if needed
204 COM_ERRLIB
=@COM_ERRLIB@
205 ## -lhesiod if needed
206 LIBHESIOD
=@LIBHESIOD@
207 ## -lresolv if HAVE_LIBRESOLV
208 LIBRESOLV
=@LIBRESOLV@
209 ## -llockfile if HAVE_LIBLOCKFILE or -lmail if HAVE_LIBMAIL
210 LIBS_MAIL
=@LIBS_MAIL@
211 ## empty or -lrt or -lposix4 if HAVE_CLOCK_GETTIME
212 CLOCK_TIME_LIB
= @CLOCK_TIME_LIB@
213 ## empty or -lbcrypt or -ladvapi32
214 GETRANDOM_LIB
= @GETRANDOM_LIB@
215 ## Whatever libraries are needed for euidaccess
216 EUIDACCESS_LIBGEN
=@EUIDACCESS_LIBGEN@
217 ## Libraries needed for file_has_acl
218 FILE_HAS_ACL_LIB
=@FILE_HAS_ACL_LIB@
219 ## empty or -lwsock2 for MinGW
220 LIB_WSOCK32
=@LIB_WSOCK32@
222 ## Extra libraries for etags
223 LIBS_ETAGS
= $(CLOCK_TIME_LIB
) $(GETRANDOM_LIB
)
225 HAVE_SECCOMP
=@HAVE_SECCOMP@
226 HAVE_LIBSECCOMP
=@HAVE_LIBSECCOMP@
227 LIBSECCOMP_LIBS
=@LIBSECCOMP_LIBS@
228 LIBSECCOMP_CFLAGS
=@LIBSECCOMP_CFLAGS@
229 SIZEOF_LONG
=@SIZEOF_LONG@
231 # Currently, we can only generate seccomp filter files for x86-64.
232 ifeq ($(HAVE_SECCOMP
),yes
)
233 ifeq ($(HAVE_LIBSECCOMP
),yes
)
234 ifeq ($(shell uname
-m
),x86_64
)
235 ifeq ($(SIZEOF_LONG
),8)
236 # We require SECCOMP_RET_KILL_PROCESS, which is only available in
237 # Linux 4.14 and later.
238 ifeq ($(shell { echo
4.14; uname
-r | cut
-d .
-f
1-2; } | \
239 sort -C
-t .
-n
-k
1,1 -k
2,2 && \
248 ifeq ($(SECCOMP_FILTER
),1)
249 DONT_INSTALL
+= seccomp-filter
$(EXEEXT
)
252 ## Extra libraries to use when linking movemail.
253 LIBS_MOVE
= $(LIBS_MAIL
) $(KRB4LIB
) $(DESLIB
) $(KRB5LIB
) $(CRYPTOLIB
) \
254 $(COM_ERRLIB
) $(LIBHESIOD
) $(LIBRESOLV
) $(LIB_WSOCK32
) $(LIBS_ETAGS
)
256 ## Extra libraries when linking emacsclient
257 ## (empty or -lcomctl32 for MinGW)
258 LIBS_ECLIENT
= @LIBS_ECLIENT@
260 ## Extra object files for linking for MinGW
262 CLIENTRES
= @CLIENTRES@
265 ## Some systems define this to request special libraries.
266 LIBS_SYSTEM
= @LIBS_SYSTEM@
268 # Flags that could be in WARN_CFLAGS, but are invalid for C++.
269 NON_CXX_CFLAGS
= -Wmissing-prototypes
-Wnested-externs
-Wold-style-definition \
270 -Wstrict-prototypes
-Wno-override-init
272 BASE_CFLAGS
= $(C_SWITCH_SYSTEM
) $(C_SWITCH_MACHINE
) \
273 $(WARN_CFLAGS
) $(WERROR_CFLAGS
) \
274 -I.
-I..
/src
-I..
/lib \
275 -I
${srcdir} -I
${srcdir}/..
/src
-I
${srcdir}/..
/lib
277 ALL_CFLAGS
= ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${LDFLAGS} ${CPPFLAGS} ${CFLAGS}
278 CPP_CFLAGS
= ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${CPPFLAGS} ${CFLAGS}
280 ALL_CXXFLAGS
= $(filter-out ${NON_CXX_CFLAGS},${BASE_CFLAGS}) \
281 ${PROFILING_CFLAGS} ${LDFLAGS} ${CPPFLAGS} ${CFLAGS} ${CXXFLAGS} ${HAIKU_CFLAGS}
283 # Configuration files for .o files to depend on.
284 config_h
= ..
/src
/config.h
$(srcdir)/..
/src
/conf_post.h
286 all: ${EXE_FILES} ${SCRIPTS}
288 ifeq ($(SECCOMP_FILTER
),1)
289 all: seccomp-filter.bpf seccomp-filter-exec.bpf
292 .PHONY
: all need-blessmail maybe-blessmail
294 LOADLIBES
= ..
/lib
/libgnu.a
$(LIBS_SYSTEM
)
295 $(EXE_FILES
): ..
/lib
/libgnu.a
297 ## Only used if we need blessmail, but no harm in always defining.
298 ## This makes the actual blessmail executable.
299 blessmail
: $(srcdir)/..
/lisp
/mail
/blessmail.el
300 $(AM_V_GEN
)$(EMACS
) $(EMACSOPT
) -l
$<
301 $(AM_V_at
)chmod
+x
$@
303 ## This checks if we need to run blessmail.
304 ## Do not charge ahead and do it! Let the installer decide.
305 need-blessmail
: blessmail
306 @if
[ `wc -l <blessmail` != 2 ] ; then \
307 dir=`sed -n -e 's/echo mail directory = \(.*\)/\1/p' blessmail`; \
308 echo
"Assuming $$dir is really the mail spool directory, you should"; \
309 echo
"run lib-src/blessmail $(DESTDIR)${archlibdir}/movemail${EXEEXT}"; \
310 echo
"as root, to give movemail${EXEEXT} appropriate permissions."; \
311 echo
"Do that after running make install."; \
314 ## This is the target invoked by the top-level Makefile.
315 maybe-blessmail
: $(BLESSMAIL_TARGET
)
317 ## Install the internal utilities. Until they are installed, we can
318 ## just run them directly from lib-src. When installing, do not give
319 ## up if chown or chgrp fails, as the package responsible for
320 ## installing Emacs can fix this problem later.
321 $(DESTDIR
)${archlibdir}: all
323 $(info Installing utilities run internally by Emacs.
)
324 umask
022 && ${MKDIR_P} "$(DESTDIR)${archlibdir}"
325 exp_archlibdir
=`cd "$(DESTDIR)${archlibdir}" && pwd -P` && \
326 if
[ "$$exp_archlibdir" != "`pwd -P`" ]; then \
327 for file in
${UTILITIES}; do \
328 $(INSTALL_PROGRAM
) $(INSTALL_STRIP
) $$file \
329 "$(DESTDIR)${archlibdir}/$$file" || exit
; \
332 ifneq (,$(use_gamedir
))
333 umask
022 && ${MKDIR_P} "$(DESTDIR)${gamedir}"
334 touch
"$(DESTDIR)${gamedir}/snake-scores" \
335 "$(DESTDIR)${gamedir}/tetris-scores"
338 "$(DESTDIR)${archlibdir}/update-game-score${EXEEXT}" \
339 "$(DESTDIR)${gamedir}" && \
341 "$(DESTDIR)${archlibdir}/update-game-score${EXEEXT}" && \
342 chmod u
=rwx
,g
=rx
,o
=rx
"$(DESTDIR)${gamedir}"
344 -chgrp
${gamegroup} \
345 "$(DESTDIR)${archlibdir}/update-game-score${EXEEXT}" \
346 "$(DESTDIR)${gamedir}" && \
348 "$(DESTDIR)${archlibdir}/update-game-score${EXEEXT}" && \
349 chmod u
=rwx
,g
=rwx
,o
=rx
"$(DESTDIR)${gamedir}"
352 exp_archlibdir
=`cd "$(DESTDIR)${archlibdir}" && pwd -P` && \
353 if
[ "$$exp_archlibdir" != "`cd ${srcdir} && pwd -P`" ]; then \
354 for file in
${SCRIPTS}; do \
355 $(INSTALL_SCRIPT
) ${srcdir}/$$file \
356 "$(DESTDIR)${archlibdir}/$$file" || exit
; \
360 .PHONY
: install uninstall mostlyclean clean distclean maintainer-clean
361 .PHONY
: bootstrap-clean
check tags
363 install: $(DESTDIR
)${archlibdir}
365 $(info Installing utilities for users to run.
)
366 umask
022 && ${MKDIR_P} "$(DESTDIR)${bindir}"
367 for file in
${INSTALLABLES} ; do \
368 $(INSTALL_PROGRAM
) $(INSTALL_STRIP
) $${file} \
369 "$(DESTDIR)${bindir}"/` \
370 echo $${file} | sed -e 's/${EXEEXT}$$//' -e '$(TRANSFORM)' \
371 `${EXEEXT} || exit
; \
375 for file in
${INSTALLABLES}; do \
376 rm -f
"$(DESTDIR)${bindir}"/` \
377 echo $${file} | sed -e 's/${EXEEXT}$$//' -e '$(TRANSFORM)' \
380 if
[ -d
"$(DESTDIR)${archlibdir}" ]; then \
381 cd
"$(DESTDIR)${archlibdir}" && \
382 rm -f
${UTILITIES} ${SCRIPTS}; \
386 rm -f core .
/*.o .
/*.res
389 -rm -f seccomp-filter.bpf seccomp-filter.pfc seccomp-filter-exec.bpf seccomp-filter-exec.pfc
393 rm -f TAGS Makefile blessmail Makefile.android
395 bootstrap-clean maintainer-clean
: distclean
398 ## Test the contents of the directory.
400 $(info We don
't have any tests for the lib-src/ directory yet.)
402 tagsfiles = $(wildcard ${srcdir}/*.[ch])
406 TAGS: etags${EXEEXT} ${tagsfiles}
409 ../lib/libgnu.a: $(config_h)
410 $(MAKE) -C ../lib all
412 etags_deps = ${srcdir}/etags.c $(NTLIB) $(config_h)
413 etags_libs = $(NTLIB) $(LOADLIBES) $(LIBS_ETAGS)
415 etags${EXEEXT}: ${etags_deps}
416 $(AM_V_CCLD)$(CC) ${ALL_CFLAGS} -o $@ $< $(etags_libs)
418 ## ctags.c is distinct from etags.c so that parallel makes do not write two
419 ## etags.o files on top of each other.
421 ## Can't we use a wrapper that calls
'etags --ctags'?
422 ctags
${EXEEXT}: ${srcdir}/ctags.c
${etags_deps}
423 $(AM_V_CCLD
)$(CC
) ${ALL_CFLAGS} -o
$@
$< $(etags_libs
)
425 asset-directory-tool
${EXEEXT}: ${srcdir}/asset-directory-tool.c
$(config_h
)
426 $(AM_V_CCLD
)$(CC
) ${ALL_CFLAGS} $< $(LOADLIBES
) -o
$@
428 ebrowse
${EXEEXT}: ${srcdir}/ebrowse.c
${srcdir}/..
/lib
/min-max.h
$(NTLIB
) \
430 $(AM_V_CCLD
)$(CC
) ${ALL_CFLAGS} -o
$@
$< $(NTLIB
) $(LOADLIBES
)
432 make-docfile
${EXEEXT}: ${srcdir}/make-docfile.c
$(NTLIB
) $(config_h
)
433 $(AM_V_CCLD
)$(CC
) ${ALL_CFLAGS} $< $(NTLIB
) $(LOADLIBES
) -o
$@
435 make-fingerprint
${EXEEXT}: ${srcdir}/make-fingerprint.c
$(NTLIB
) $(config_h
)
436 $(AM_V_CCLD
)$(CC
) ${ALL_CFLAGS} $< $(NTLIB
) $(LOADLIBES
) -o
$@
438 movemail
${EXEEXT}: ${srcdir}/movemail.c pop.o
$(NTLIB
) $(config_h
)
439 $(AM_V_CCLD
)$(CC
) ${ALL_CFLAGS} ${MOVE_FLAGS} $< pop.o \
440 $(NTLIB
) $(LOADLIBES
) $(LIBS_MOVE
) -o
$@
442 pop.o
: ${srcdir}/pop.c
${srcdir}/pop.h
${srcdir}/..
/lib
/min-max.h
$(config_h
)
443 $(AM_V_CC
)$(CC
) -c
${CPP_CFLAGS} ${MOVE_FLAGS} $<
445 emacsclient
${EXEEXT}: ${srcdir}/emacsclient.c
$(NTLIB
) $(config_h
)
446 $(AM_V_CCLD
)$(CC
) ${ALL_CFLAGS} $< \
447 $(NTLIB
) $(LOADLIBES
) \
448 $(LIB_WSOCK32
) $(EUIDACCESS_LIBGEN
) \
449 $(FILE_HAS_ACL_LIB
) $(LIBS_ECLIENT
) \
452 emacsclientw
${EXEEXT}: ${srcdir}/emacsclient.c
$(NTLIB
) $(CLIENTRES
) $(config_h
)
453 $(AM_V_CCLD
)$(CC
) ${ALL_CFLAGS} $(CLIENTRES
) -mwindows
$< \
455 $(LIB_WSOCK32
) $(EUIDACCESS_LIBGEN
) $(LIBS_ECLIENT
) -o
$@
457 be-resources
: ${srcdir}/be_resources.
cc ${config_h}
458 $(AM_V_CXXLD
)$(CXX
) ${ALL_CXXFLAGS} ${HAIKU_LIBS} $< -o
$@
460 NTINC
= ${srcdir}/..
/nt
/inc
461 NTDEPS
= $(NTINC
)/ms-w32.h
$(NTINC
)/sys
/stat.h
$(NTINC
)/inttypes.h \
462 $(NTINC
)/stdint.h
$(NTINC
)/pwd.h
$(NTINC
)/sys
/time.h
$(NTINC
)/stdbool.h \
463 $(NTINC
)/sys
/wait.h
$(NTINC
)/unistd.h
$(NTINC
)/sys
/file.h
$(NTINC
)/netdb.h
465 # The dependency on $(NTDEPS) is a trick intended to cause recompile of
466 # programs on MinGW whenever some private header in nt/inc is modified.
467 ntlib.o
: ${srcdir}/ntlib.c
${srcdir}/ntlib.h
$(NTDEPS
)
468 $(AM_V_CC
)$(CC
) -c
${CPP_CFLAGS} $<
470 hexl
${EXEEXT}: ${srcdir}/hexl.c
$(NTLIB
) $(config_h
)
471 $(AM_V_CCLD
)$(CC
) ${ALL_CFLAGS} $< $(LOADLIBES
) -o
$@
473 update-game-score
${EXEEXT}: ${srcdir}/update-game-score.c
$(NTLIB
) $(config_h
)
474 $(AM_V_CCLD
)$(CC
) ${ALL_CFLAGS} \
475 -DHAVE_SHARED_GAME_DIR
="\"$(gamedir)\"" \
476 $< $(NTLIB
) $(LOADLIBES
) -o
$@
478 emacsclient.res
: ..
/nt
/emacsclient.rc
$(NTINC
)/..
/icons
/emacs.ico
479 $(AM_V_RC
)$(WINDRES
) -O coff
--include-dir
=$(NTINC
)/..
-o
$@
$<
481 ifeq ($(SECCOMP_FILTER
),1)
482 seccomp-filter
$(EXEEXT
): $(srcdir)/seccomp-filter.c
$(config_h
)
483 $(AM_V_CCLD
)$(CC
) $(ALL_CFLAGS
) $(LIBSECCOMP_CFLAGS
) $< \
484 $(LIBSECCOMP_LIBS
) $(LOADLIBES
) -o
$@
486 seccomp-filter.bpf seccomp-filter.pfc seccomp-filter-exec.bpf seccomp-filter-exec.pfc
: seccomp-filter
$(EXEEXT
)
487 $(AM_V_GEN
).
/seccomp-filter
$(EXEEXT
) \
488 seccomp-filter.bpf seccomp-filter.pfc \
489 seccomp-filter-exec.bpf seccomp-filter-exec.pfc
492 ## Makefile ends here.