Fix Bug#27502
[emacs.git] / lib-src / Makefile.in
blobfa8de0bcc94a6de69960769895722d25e17fe987
1 ### @configure_input@
3 # Copyright (C) 1985, 1987-1988, 1993-1994, 2001-2017 Free Software
4 # Foundation, Inc.
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 <http://www.gnu.org/licenses/>.
21 SHELL = @SHELL@
23 # Following ../lisp/Makefile.in.
24 EMACS = ../src/emacs${EXEEXT}
25 EMACSOPT = -batch --no-site-file --no-site-lisp
27 # ==================== Things 'configure' will edit ====================
29 CC=@CC@
30 CFLAGS=@CFLAGS@
31 CPPFLAGS = @CPPFLAGS@
32 LDFLAGS = @LDFLAGS@
34 version=@version@
35 ## Used in $archlibdir.
36 configuration=@configuration@
37 EXEEXT=@EXEEXT@
38 C_SWITCH_SYSTEM=@C_SWITCH_SYSTEM@
39 C_SWITCH_MACHINE=@C_SWITCH_MACHINE@
40 PROFILING_CFLAGS = @PROFILING_CFLAGS@
41 WARN_CFLAGS = @WARN_CFLAGS@
42 WERROR_CFLAGS = @WERROR_CFLAGS@
44 # Program name transformation.
45 TRANSFORM = @program_transform_name@
47 # 'make' verbosity.
48 AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
50 AM_V_CC = $(am__v_CC_@AM_V@)
51 am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
52 am__v_CC_0 = @echo " CC " $@;
53 am__v_CC_1 =
55 AM_V_CCLD = $(am__v_CCLD_@AM_V@)
56 am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
57 am__v_CCLD_0 = @echo " CCLD " $@;
58 am__v_CCLD_1 =
60 AM_V_GEN = $(am__v_GEN_@AM_V@)
61 am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
62 am__v_GEN_0 = @echo " GEN " $@;
63 am__v_GEN_1 =
65 AM_V_RC = $(am__v_RC_@AM_V@)
66 am__v_RC_ = $(am__v_RC_@AM_DEFAULT_V@)
67 am__v_RC_0 = @echo " RC " $@;
68 am__v_RC_1 =
70 AM_V_at = $(am__v_at_@AM_V@)
71 am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
72 am__v_at_0 = @
73 am__v_at_1 =
75 # ==================== Where To Install Things ====================
77 # Location to install Emacs.app under GNUstep / macOS.
78 # Later values may use this.
79 ns_appbindir=@ns_appbindir@
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'.
86 prefix=@prefix@
88 # Like 'prefix', but used for architecture-specific files. This is
89 # set with the --exec-prefix option to '../configure'.
90 exec_prefix=@exec_prefix@
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'.
95 bindir=@bindir@
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'.
101 libexecdir=@libexecdir@
103 # Nonempty if Emacs can assume Mailutils is installed.
104 with_mailutils=@with_mailutils@
106 # Directory for local state files for all programs.
107 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.
114 # We use $(srcdir) explicitly in dependencies so as not to depend on VPATH.
115 srcdir=@srcdir@
116 VPATH=@srcdir@
118 # The top-level source directory, also set by configure.
119 top_srcdir=@top_srcdir@
120 # MinGW CPPFLAGS may use this.
121 abs_top_srcdir=@abs_top_srcdir@
123 # ==================== Emacs-specific directories ====================
125 # These variables hold the values Emacs will actually use. They are
126 # based on the values of the standard Make variables above.
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'.
133 archlibdir=@archlibdir@
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.
138 gameuser=@gameuser@
139 gamegroup=@gamegroup@
140 # Where to install game score files, if gameuser or gamegroup is nonempty.
141 gamedir=@gamedir@
142 # Nonempty if and only if a shared gamedir is used.
143 use_gamedir=$(gameuser)$(gamegroup)
145 # ==================== Utility Programs for the Build =================
147 # ../configure figures out the correct values for these.
148 INSTALL = @INSTALL@
149 INSTALL_PROGRAM = @INSTALL_PROGRAM@
150 INSTALL_SCRIPT = @INSTALL_SCRIPT@
151 # By default, we uphold the dignity of our programs.
152 INSTALL_STRIP =
153 MKDIR_P = @MKDIR_P@
155 # ========================== Lists of Files ===========================
157 # emacsclientw.exe for MinGW, empty otherwise
158 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}
164 # Things that Emacs runs internally, or during the build process,
165 # which should not be installed in bindir.
166 UTILITIES = profile${EXEEXT} hexl${EXEEXT} \
167 $(if $(with_mailutils), , movemail${EXEEXT}) \
168 $(and $(use_gamedir), update-game-score${EXEEXT})
170 DONT_INSTALL= make-docfile${EXEEXT}
172 # Like UTILITIES, but they're not system-dependent, and should not be
173 # deleted by the distclean target.
174 SCRIPTS= rcs2log
176 # All files that are created by the linker, i.e., whose names end in ${EXEEXT}.
177 EXE_FILES = ${INSTALLABLES} ${UTILITIES} ${DONT_INSTALL}
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.
184 MOVE_FLAGS=
186 ## Empty if either MAIL_USE_FLOCK or MAIL_USE_LOCKF, else need-blessmail.
187 BLESSMAIL_TARGET=@BLESSMAIL_TARGET@
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 LIBHESIOD=@LIBHESIOD@
201 ## -lresolv if HAVE_LIBRESOLV
202 LIBRESOLV=@LIBRESOLV@
203 ## -llockfile if HAVE_LIBLOCKFILE or -lmail if HAVE_LIBMAIL
204 LIBS_MAIL=@LIBS_MAIL@
205 ## empty or -lrt or -lposix4 if HAVE_CLOCK_GETTIME
206 LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
207 ## empty or -lrt or -lposix4 if HAVE_FDATASYNC
208 LIB_FDATASYNC = @LIB_FDATASYNC@
209 ## empty or -lwsock2 for MinGW
210 LIB_WSOCK32=@LIB_WSOCK32@
212 ## Extra libraries to use when linking movemail.
213 LIBS_MOVE = $(LIBS_MAIL) $(KRB4LIB) $(DESLIB) $(KRB5LIB) $(CRYPTOLIB) \
214 $(COM_ERRLIB) $(LIBHESIOD) $(LIBRESOLV) $(LIB_WSOCK32)
216 ## Extra libraries when linking emacsclient
217 ## (empty or -lcomctl32 for MinGW)
218 LIBS_ECLIENT = @LIBS_ECLIENT@
220 ## Extra object files for linking for MinGW
221 NTLIB = @NTLIB@
222 CLIENTRES = @CLIENTRES@
223 WINDRES = @WINDRES@
225 ## Some systems define this to request special libraries.
226 LIBS_SYSTEM = @LIBS_SYSTEM@
228 BASE_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
233 ALL_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${LDFLAGS} ${CPPFLAGS} ${CFLAGS}
234 ## Unused.
235 LINK_CFLAGS = ${BASE_CFLAGS} ${LDFLAGS} ${CFLAGS}
236 CPP_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${CPPFLAGS} ${CFLAGS}
238 # Configuration files for .o files to depend on.
239 config_h = ../src/config.h $(srcdir)/../src/conf_post.h
241 all: ${EXE_FILES} ${SCRIPTS}
243 .PHONY: all need-blessmail maybe-blessmail
245 LOADLIBES = ../lib/libgnu.a $(LIBS_SYSTEM)
246 $(EXE_FILES): ../lib/libgnu.a
248 ## Only used if we need blessmail, but no harm in always defining.
249 ## This makes the actual blessmail executable.
250 blessmail: $(srcdir)/../lisp/mail/blessmail.el
251 $(AM_V_GEN)$(EMACS) $(EMACSOPT) -l $<
252 $(AM_V_at)chmod +x $@
254 ## This checks if we need to run blessmail.
255 ## Do not charge ahead and do it! Let the installer decide.
256 need-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."; \
265 ## This is the target invoked by the top-level Makefile.
266 maybe-blessmail: $(BLESSMAIL_TARGET)
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 ; \
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 ; \
311 .PHONY: install uninstall mostlyclean clean distclean maintainer-clean
312 .PHONY: bootstrap-clean extraclean check tags
314 install: $(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
325 uninstall:
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}; \
336 mostlyclean:
337 rm -f core *.o *.res
339 clean: mostlyclean
340 rm -f ${EXE_FILES}
342 distclean: clean
343 rm -f TAGS Makefile blessmail
345 bootstrap-clean maintainer-clean: distclean
347 extraclean: maintainer-clean
348 rm -f *~ \#*
350 ## Test the contents of the directory.
351 check:
352 @echo "We don't have any tests for the lib-src/ directory yet."
354 tagsfiles = $(wildcard ${srcdir}/*.[ch])
356 .PHONY: tags
357 tags: TAGS
358 TAGS: etags${EXEEXT} ${tagsfiles}
359 ./etags ${tagsfiles}
361 ../lib/libgnu.a: $(config_h)
362 $(MAKE) -C ../lib all
364 regex.o: $(srcdir)/../src/regex.c $(srcdir)/../src/regex.h $(config_h)
365 $(AM_V_CC)$(CC) -c $(CPP_CFLAGS) $<
368 etags_deps = ${srcdir}/etags.c regex.o $(NTLIB) $(config_h)
369 etags_cflags = -DEMACS_NAME="\"GNU Emacs\"" -DVERSION="\"${version}\"" -o $@
370 etags_libs = regex.o $(NTLIB) $(LOADLIBES)
372 etags${EXEEXT}: ${etags_deps}
373 $(AM_V_CCLD)$(CC) ${ALL_CFLAGS} $(etags_cflags) $< $(etags_libs)
375 ## ctags.c is distinct from etags.c so that parallel makes do not write two
376 ## etags.o files on top of each other.
377 ## FIXME?
378 ## Can't we use a wrapper that calls 'etags --ctags'?
379 ctags${EXEEXT}: ${srcdir}/ctags.c ${etags_deps}
380 $(AM_V_CCLD)$(CC) ${ALL_CFLAGS} $(etags_cflags) $< $(etags_libs)
382 ebrowse${EXEEXT}: ${srcdir}/ebrowse.c ${srcdir}/../lib/min-max.h $(NTLIB) \
383 $(config_h)
384 $(AM_V_CCLD)$(CC) ${ALL_CFLAGS} -DVERSION="\"${version}\"" \
385 $< $(NTLIB) $(LOADLIBES) -o $@
387 profile${EXEEXT}: ${srcdir}/profile.c $(NTLIB) $(config_h)
388 $(AM_V_CCLD)$(CC) ${ALL_CFLAGS} $< \
389 $(NTLIB) $(LOADLIBES) $(LIB_CLOCK_GETTIME) -o $@
391 make-docfile${EXEEXT}: ${srcdir}/make-docfile.c $(NTLIB) $(config_h)
392 $(AM_V_CCLD)$(CC) ${ALL_CFLAGS} $< $(NTLIB) $(LOADLIBES) -o $@
394 movemail${EXEEXT}: ${srcdir}/movemail.c pop.o $(NTLIB) $(config_h)
395 $(AM_V_CCLD)$(CC) ${ALL_CFLAGS} ${MOVE_FLAGS} $< pop.o \
396 $(NTLIB) $(LOADLIBES) $(LIBS_MOVE) -o $@
398 pop.o: ${srcdir}/pop.c ${srcdir}/pop.h ${srcdir}/../lib/min-max.h $(config_h)
399 $(AM_V_CC)$(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} $<
401 emacsclient${EXEEXT}: ${srcdir}/emacsclient.c $(NTLIB) $(config_h)
402 $(AM_V_CCLD)$(CC) ${ALL_CFLAGS} $< \
403 -DVERSION="\"${version}\"" $(NTLIB) $(LOADLIBES) $(LIB_FDATASYNC) \
404 $(LIB_WSOCK32) $(LIBS_ECLIENT) -o $@
406 emacsclientw${EXEEXT}: ${srcdir}/emacsclient.c $(NTLIB) $(CLIENTRES) $(config_h)
407 $(AM_V_CCLD)$(CC) ${ALL_CFLAGS} $(CLIENTRES) -mwindows $< \
408 -DVERSION="\"${version}\"" $(LOADLIBES) $(LIB_FDATASYNC) \
409 $(LIB_WSOCK32) $(LIBS_ECLIENT) -o $@
411 NTINC = ${srcdir}/../nt/inc
412 NTDEPS = $(NTINC)/ms-w32.h $(NTINC)/sys/stat.h $(NTINC)/inttypes.h \
413 $(NTINC)/stdint.h $(NTINC)/pwd.h $(NTINC)/sys/time.h $(NTINC)/stdbool.h \
414 $(NTINC)/sys/wait.h $(NTINC)/unistd.h $(NTINC)/sys/file.h $(NTINC)/netdb.h
416 # The dependency on $(NTDEPS) is a trick intended to cause recompile of
417 # programs on MinGW whenever some private header in nt/inc is modified.
418 ntlib.o: ${srcdir}/ntlib.c ${srcdir}/ntlib.h $(NTDEPS)
419 $(AM_V_CC)$(CC) -c ${CPP_CFLAGS} $<
421 hexl${EXEEXT}: ${srcdir}/hexl.c $(NTLIB) $(config_h)
422 $(AM_V_CCLD)$(CC) ${ALL_CFLAGS} $< $(LOADLIBES) -o $@
424 update-game-score${EXEEXT}: ${srcdir}/update-game-score.c $(NTLIB) $(config_h)
425 $(AM_V_CCLD)$(CC) ${ALL_CFLAGS} \
426 -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\"" \
427 $< $(NTLIB) $(LOADLIBES) -o $@
429 emacsclient.res: ../nt/emacsclient.rc $(NTINC)/../icons/emacs.ico
430 $(AM_V_RC)$(WINDRES) -O coff --include-dir=$(NTINC)/.. -o $@ $<
432 ## Makefile ends here.