Parallelize clean rules using GNU make features
[bpt/emacs.git] / lib-src / Makefile.in
CommitLineData
bbece175
GM
1### @configure_input@
2
ba318903
PE
3# Copyright (C) 1985, 1987-1988, 1993-1994, 2001-2014 Free Software
4# Foundation, Inc.
29ed0542 5
eb4252f7 6# This file is part of GNU Emacs.
29ed0542 7
294981c7 8# GNU Emacs is free software: you can redistribute it and/or modify
eb4252f7 9# it under the terms of the GNU General Public License as published by
294981c7
GM
10# the Free Software Foundation, either version 3 of the License, or
11# (at your option) any later version.
29ed0542 12
eb4252f7
RS
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.
29ed0542 17
eb4252f7 18# You should have received a copy of the GNU General Public License
294981c7
GM
19# along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
20
50b13cde 21SHELL = @SHELL@
f7dbcf3c 22
70e48c86
GM
23# Following ../lisp/Makefile.in.
24EMACS = ../src/emacs
e7a42417 25EMACSOPT = -batch --no-site-file --no-site-lisp
70e48c86 26
eb4252f7 27# ==================== Things `configure' will edit ====================
c71beb75 28
b93f2493
BF
29CC=@CC@
30CFLAGS=@CFLAGS@
b93f2493 31version=@version@
d3b23034 32## Used in $archlibdir.
cf770692 33configuration=@configuration@
108c7c97 34EXEEXT=@EXEEXT@
49628785
GM
35C_SWITCH_SYSTEM=@C_SWITCH_SYSTEM@
36C_SWITCH_MACHINE=@C_SWITCH_MACHINE@
e6cfa7c3 37PROFILING_CFLAGS = @PROFILING_CFLAGS@
b8df54ff
PE
38WARN_CFLAGS = @WARN_CFLAGS@
39WERROR_CFLAGS = @WERROR_CFLAGS@
d4166523 40UPDATE_MANIFEST = @UPDATE_MANIFEST@
c71beb75 41
a4663fed
PJ
42# Program name transformation.
43TRANSFORM = @program_transform_name@
44
eb4252f7 45# ==================== Where To Install Things ====================
c71beb75 46
3a4155de
GM
47# Location to install Emacs.app under GNUstep / Mac OS X.
48# Later values may use this.
49ns_appbindir=@ns_appbindir@
50
eb4252f7
RS
51# The default location for installation. Everything is placed in
52# subdirectories of this directory. The default values for many of
53# the variables below are expressed in terms of this one, so you may
54# not need to change them. This is set with the --prefix option to
55# `../configure'.
b93f2493 56prefix=@prefix@
c71beb75 57
eb4252f7
RS
58# Like `prefix', but used for architecture-specific files. This is
59# set with the --exec-prefix option to `../configure'.
b93f2493 60exec_prefix=@exec_prefix@
c71beb75 61
eb4252f7
RS
62# Where to install Emacs and other binaries that people will want to
63# run directly (like etags). This is set with the --bindir option
64# to `../configure'.
b93f2493 65bindir=@bindir@
c71beb75 66
eb4252f7
RS
67# Where to install and expect executable files to be run by Emacs
68# rather than directly by users, and other architecture-dependent
69# data. ${archlibdir} is usually below this. This is set with the
424b6d2b
RS
70# --libexecdir option to `../configure'.
71libexecdir=@libexecdir@
c71beb75 72
712eaee0
AS
73# Directory for local state files for all programs.
74localstatedir=@localstatedir@
75
eb4252f7
RS
76# Where to find the source code. This is set by the configure
77# script's `--srcdir' option. However, the value of ${srcdir} in
78# this makefile is not identical to what was specified with --srcdir,
79# since the variable here has `/lib-src' added at the end.
5126d3b7
RS
80
81# We use $(srcdir) explicitly in dependencies so as not to depend on VPATH.
b93f2493
BF
82srcdir=@srcdir@
83VPATH=@srcdir@
c71beb75 84
2d521ee6
DM
85# The top-level source directory, also set by configure.
86top_srcdir=@top_srcdir@
11e5e2eb
GM
87# MinGW CPPFLAGS may use this.
88abs_top_srcdir=@abs_top_srcdir@
2d521ee6 89
eb4252f7 90# ==================== Emacs-specific directories ====================
c71beb75 91
eb4252f7
RS
92# These variables hold the values Emacs will actually use. They are
93# based on the values of the standard Make variables above.
c71beb75 94
eb4252f7
RS
95# Where to put executables to be run by Emacs rather than the user.
96# This path usually includes the Emacs version and configuration name,
97# so that multiple configurations for multiple versions of Emacs may
98# be installed at once. This can be set with the --archlibdir option
99# to `../configure'.
b93f2493 100archlibdir=@archlibdir@
41f86d5a 101
1ba1fb11
CW
102gamedir=@gamedir@
103gameuser=@gameuser@
104
eb4252f7 105# ==================== Utility Programs for the Build =================
c71beb75 106
eb4252f7 107# ../configure figures out the correct values for these.
b93f2493 108INSTALL = @INSTALL@
b93f2493 109INSTALL_PROGRAM = @INSTALL_PROGRAM@
01c7d383 110INSTALL_SCRIPT = @INSTALL_SCRIPT@
ae6ed0ac
RS
111# By default, we uphold the dignity of our programs.
112INSTALL_STRIP =
005ad204 113MKDIR_P = @MKDIR_P@
c71beb75 114
eb4252f7 115# ========================== Lists of Files ===========================
f7dbcf3c 116
f540ee86
EZ
117# emacsclientw.exe for MinGW, empty otherwise
118CLIENTW = @CLIENTW@
119
2f8d5db9 120# Things that a user might actually run, which should be installed in bindir.
f540ee86 121INSTALLABLES = etags${EXEEXT} ctags${EXEEXT} emacsclient${EXEEXT} $(CLIENTW) \
3fb78d1f 122 ebrowse${EXEEXT}
2f8d5db9 123
418cd726 124INSTALLABLE_SCRIPTS = grep-changelog
f7dbcf3c 125
eb4252f7
RS
126# Things that Emacs runs internally, or during the build process,
127# which should not be installed in bindir.
c136e5cd
GM
128UTILITIES = profile${EXEEXT} movemail${EXEEXT} hexl${EXEEXT} \
129 update-game-score${EXEEXT}
f7dbcf3c 130
7cd43111 131DONT_INSTALL= make-docfile${EXEEXT}
5aae6601 132
eb4252f7
RS
133# Like UTILITIES, but they're not system-dependent, and should not be
134# deleted by the distclean target.
d4166523 135SCRIPTS= rcs2log $(UPDATE_MANIFEST)
b7cceaf1 136
9a514d4a
PE
137# All files that are created by the linker, i.e., whose names end in ${EXEEXT}.
138EXE_FILES = ${INSTALLABLES} ${UTILITIES} ${DONT_INSTALL}
139
aded53ff
GM
140# Specify additional -D flags for movemail. Options:
141# -DMAIL_USE_FLOCK or -DMAIL_USE_LOCKF (use flock or lockf for file locking).
142# See the comments about locking in movemail.c. Normally the values
d3b23034
GM
143# set by configure should be correct and you should not need to do anything.
144# If neither flag is set, you need to use blessmail.
81f94052
RS
145MOVE_FLAGS=
146
7490175b
GM
147## Empty if either MAIL_USE_FLOCK or MAIL_USE_LOCKF, else need-blessmail.
148BLESSMAIL_TARGET=@BLESSMAIL_TARGET@
f6c0ee20 149
57f8c490 150## -lkrb or -lkrb4 if needed
5e58e3a4 151KRB4LIB=@KRB4LIB@
57f8c490 152## -ldes or -ldes425 if needed
5e58e3a4 153DESLIB=@DESLIB@
57f8c490 154## -lkrb5 if needed
5e58e3a4 155KRB5LIB=@KRB5LIB@
57f8c490 156## -lk5crypto or -lcrypto if needed
5e58e3a4 157CRYPTOLIB=@CRYPTOLIB@
57f8c490 158## -lcom_err if needed
5e58e3a4 159COM_ERRLIB=@COM_ERRLIB@
57f8c490 160## -lhesiod if needed
5e58e3a4
GM
161LIBHESIOD=@LIBHESIOD@
162## -lresolv if HAVE_LIBRESOLV
163LIBRESOLV=@LIBRESOLV@
164## -llockfile if HAVE_LIBLOCKFILE or -lmail if HAVE_LIBMAIL
165LIBS_MAIL=@LIBS_MAIL@
d35af63c
PE
166## empty or -lrt or -lposix4 if HAVE_CLOCK_GETTIME
167LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
47d7532e
PE
168## empty or -lrt or -lposix4 if HAVE_FDATASYNC
169LIB_FDATASYNC = @LIB_FDATASYNC@
d6db9fd6
EZ
170## empty or -lwsock2 for MinGW
171LIB_WSOCK32=@LIB_WSOCK32@
5e58e3a4
GM
172
173## Extra libraries to use when linking movemail.
2f8d5db9 174LIBS_MOVE = $(LIBS_MAIL) $(KRB4LIB) $(DESLIB) $(KRB5LIB) $(CRYPTOLIB) \
d6db9fd6 175 $(COM_ERRLIB) $(LIBHESIOD) $(LIBRESOLV) $(LIB_WSOCK32)
5e58e3a4 176
d6db9fd6
EZ
177## Extra libraries when linking emacsclient
178## (empty or -lcomctl32 for MinGW)
179LIBS_ECLIENT = @LIBS_ECLIENT@
180
181## Extra object files for linking for MinGW
a74b0e1b 182NTLIB = @NTLIB@
095bf253
EZ
183CLIENTRES = @CLIENTRES@
184WINDRES = @WINDRES@
7c4026b6 185
97efb629
GM
186## Some systems define this to request special libraries.
187LIBS_SYSTEM = @LIBS_SYSTEM@
188
b8df54ff
PE
189BASE_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) \
190 $(WARN_CFLAGS) $(WERROR_CFLAGS) \
cf38a720 191 -I. -I../src -I../lib \
9a514d4a 192 -I${srcdir} -I${srcdir}/../src -I${srcdir}/../lib
c88b05a9 193
e6cfa7c3 194ALL_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${LDFLAGS} ${CPPFLAGS} ${CFLAGS}
a4daeecf 195LINK_CFLAGS = ${BASE_CFLAGS} ${LDFLAGS} ${CFLAGS}
e6cfa7c3 196CPP_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${CPPFLAGS} ${CFLAGS}
5e58e3a4 197
de7de872
GM
198# Configuration files for .o files to depend on.
199config_h = ../src/config.h $(srcdir)/../src/conf_post.h
200
67163749 201all: ${EXE_FILES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}
5ef215d8 202
0aee6912
PE
203.PHONY: all need-blessmail maybe-blessmail
204
9a514d4a
PE
205LOADLIBES = ../lib/libgnu.a $(LIBS_SYSTEM)
206$(EXE_FILES): ../lib/libgnu.a
eb4252f7 207
d3b23034
GM
208## Only used if we need blessmail, but no harm in always defining.
209## This makes the actual blessmail executable.
f675ecb5 210blessmail:
70e48c86 211 $(EMACS) $(EMACSOPT) -l $(srcdir)/../lisp/mail/blessmail.el
c6207d0d 212 chmod +x blessmail
c6207d0d 213
d3b23034
GM
214## This checks if we need to run blessmail.
215## Do not charge ahead and do it! Let the installer decide.
f6c0ee20 216need-blessmail: blessmail
d19f95fe
RS
217 @if [ `wc -l <blessmail` != 2 ] ; then \
218 dir=`sed -n -e 's/echo mail directory = \(.*\)/\1/p' blessmail`; \
48f73cfb
GM
219 echo "Assuming $$dir is really the mail spool directory, you should"; \
220 echo "run lib-src/blessmail $(DESTDIR)${archlibdir}/movemail${EXEEXT}"; \
221 echo "as root, to give movemail${EXEEXT} appropriate permissions."; \
222 echo "Do that after running make install."; \
d19f95fe 223 fi
f6c0ee20 224
d3b23034 225## This is the target invoked by the top-level Makefile.
f6c0ee20 226maybe-blessmail: $(BLESSMAIL_TARGET)
d19f95fe 227
d3b23034
GM
228## Install the internal utilities. Until they are installed, we can
229## just run them directly from lib-src.
230## If the chown/chmod commands fail, that is not a big deal.
231## update-game-score will detect at runtime that it is not setuid,
232## and handle things accordingly.
81af9060 233$(DESTDIR)${archlibdir}: all
c71beb75
JB
234 @echo
235 @echo "Installing utilities run internally by Emacs."
48f73cfb 236 umask 022; ${MKDIR_P} "$(DESTDIR)${archlibdir}"
357a5081
GM
237 exp_archlibdir=`cd "$(DESTDIR)${archlibdir}" && /bin/pwd`; \
238 if [ "$$exp_archlibdir" != "`/bin/pwd`" ]; then \
544d556f 239 for file in ${UTILITIES}; do \
48f73cfb 240 $(INSTALL_PROGRAM) $(INSTALL_STRIP) $$file "$(DESTDIR)${archlibdir}/$$file" ; \
544d556f 241 done ; \
ad600343 242 fi
48f73cfb
GM
243 umask 022; ${MKDIR_P} "$(DESTDIR)${gamedir}"; \
244 touch "$(DESTDIR)${gamedir}/snake-scores"; \
245 touch "$(DESTDIR)${gamedir}/tetris-scores"
246 -if chown ${gameuser} "$(DESTDIR)${archlibdir}/update-game-score${EXEEXT}" && chmod u+s "$(DESTDIR)${archlibdir}/update-game-score${EXEEXT}"; then \
247 chown ${gameuser} "$(DESTDIR)${gamedir}"; \
248 chmod u=rwx,g=rwx,o=rx "$(DESTDIR)${gamedir}"; \
7451222f 249 fi
7ac903ab
GM
250 exp_archlibdir=`cd "$(DESTDIR)${archlibdir}" && /bin/pwd`; \
251 if [ "$$exp_archlibdir" != "`cd ${srcdir} && /bin/pwd`" ]; then \
544d556f 252 for file in ${SCRIPTS}; do \
48f73cfb 253 $(INSTALL_SCRIPT) ${srcdir}/$$file "$(DESTDIR)${archlibdir}/$$file"; \
c71beb75 254 done ; \
0268f19b 255 fi
f7dbcf3c 256
0aee6912 257.PHONY: install uninstall mostlyclean clean distclean maintainer-clean
0e6929ec 258.PHONY: bootstrap-clean extraclean check tags
0aee6912 259
81af9060 260install: $(DESTDIR)${archlibdir}
c71beb75
JB
261 @echo
262 @echo "Installing utilities for users to run."
48f73cfb 263 umask 022; ${MKDIR_P} "$(DESTDIR)${bindir}"
b70cff71 264 for file in ${INSTALLABLES} ; do \
48f73cfb 265 $(INSTALL_PROGRAM) $(INSTALL_STRIP) $${file} "$(DESTDIR)${bindir}"/`echo $${file} | sed -e 's/${EXEEXT}$$//' -e '$(TRANSFORM)'`${EXEEXT} ; \
0268f19b 266 done
b70cff71 267 for file in ${INSTALLABLE_SCRIPTS} ; do \
48f73cfb 268 $(INSTALL_SCRIPT) ${srcdir}/$${file} "$(DESTDIR)${bindir}"/`echo $${file} | sed '$(TRANSFORM)'` ; \
0268f19b 269 done
f7dbcf3c 270
39b649dd 271uninstall:
eeced60b 272 for file in ${INSTALLABLES}; do \
48f73cfb 273 rm -f "$(DESTDIR)${bindir}"/`echo $${file} | sed -e 's/${EXEEXT}$$//' -e '$(TRANSFORM)'`${EXEEXT} ; \
eeced60b
GM
274 done
275 for file in ${INSTALLABLE_SCRIPTS}; do \
48f73cfb 276 rm -f "$(DESTDIR)${bindir}"/`echo $${file} | sed '$(TRANSFORM)'` ; \
eeced60b 277 done
48f73cfb
GM
278 if [ -d "$(DESTDIR)${archlibdir}" ]; then \
279 (cd "$(DESTDIR)${archlibdir}" && rm -f ${UTILITIES} ${SCRIPTS}) \
f8388570 280 fi
39b649dd 281
a17d2c25 282mostlyclean:
38b787fa 283 -rm -f core *.o *.res
a17d2c25
RS
284
285clean: mostlyclean
497c74cd 286 -rm -f ${EXE_FILES}
f7dbcf3c 287
39b649dd 288distclean: clean
5c579a75 289 -rm -f TAGS
81ac4f35 290 -rm -f Makefile blessmail
f7dbcf3c 291
0e6929ec 292bootstrap-clean maintainer-clean: distclean
39b649dd 293 true
c71beb75 294
a01c76d7 295extraclean: maintainer-clean
c71beb75 296 -rm -f *~ \#*
f7dbcf3c 297
d3b23034 298## Test the contents of the directory.
f7dbcf3c 299check:
c88b05a9 300 @echo "We don't have any tests for the lib-src/ directory yet."
f7dbcf3c 301
93548af1 302tags: TAGS
108c7c97 303TAGS: etags${EXEEXT}
f7dbcf3c
JB
304 etags *.[ch]
305
de7de872 306../lib/libgnu.a: $(config_h)
f9d80c51 307 cd ../lib && $(MAKE) libgnu.a
9a514d4a 308
de7de872 309regex.o: $(srcdir)/../src/regex.c $(srcdir)/../src/regex.h $(config_h)
da5ecfa9 310 ${CC} -c ${CPP_CFLAGS} ${srcdir}/../src/regex.c
66ab94d9 311
10211d43
GM
312
313etags_deps = ${srcdir}/etags.c regex.o $(NTLIB) $(config_h)
5eda3a75
PE
314etags_cflags = -DEMACS_NAME="\"GNU Emacs\"" -DVERSION="\"${version}\"" -o $@
315etags_libs = regex.o $(LOADLIBES) $(NTLIB)
10211d43
GM
316
317etags${EXEEXT}: ${etags_deps}
5eda3a75 318 $(CC) ${ALL_CFLAGS} $(etags_cflags) $(srcdir)/etags.c $(etags_libs)
10211d43 319
5eda3a75
PE
320## ctags.c is distinct from etags.c so that parallel makes do not write two
321## etags.o files on top of each other.
10211d43 322## FIXME?
5eda3a75
PE
323## Can't we use a wrapper that calls 'etags --ctags'?
324ctags${EXEEXT}: ctags.c ${etags_deps}
325 $(CC) ${ALL_CFLAGS} $(etags_cflags) $(srcdir)/ctags.c $(etags_libs)
f7dbcf3c 326
d6db9fd6
EZ
327ebrowse${EXEEXT}: ${srcdir}/ebrowse.c ${srcdir}/../lib/min-max.h $(NTLIB) \
328 $(config_h)
2f8d5db9 329 $(CC) ${ALL_CFLAGS} -DVERSION="\"${version}\"" \
df199e56 330 ${srcdir}/ebrowse.c $(LOADLIBES) $(NTLIB) -o $@
adb0a8d3 331
d6db9fd6 332profile${EXEEXT}: ${srcdir}/profile.c $(NTLIB) $(config_h)
d35af63c 333 $(CC) ${ALL_CFLAGS} ${srcdir}/profile.c \
df199e56 334 $(LOADLIBES) $(NTLIB) $(LIB_CLOCK_GETTIME) -o $@
379fb9c8 335
d6db9fd6
EZ
336make-docfile${EXEEXT}: ${srcdir}/make-docfile.c $(NTLIB) $(config_h)
337 $(CC) ${ALL_CFLAGS} ${srcdir}/make-docfile.c $(LOADLIBES) $(NTLIB) \
df199e56 338 -o $@
f7dbcf3c 339
a74b0e1b 340movemail${EXEEXT}: ${srcdir}/movemail.c pop.o $(NTLIB) $(config_h)
d114d4f3 341 $(CC) ${ALL_CFLAGS} ${MOVE_FLAGS} ${srcdir}/movemail.c pop.o \
df199e56 342 $(LOADLIBES) $(NTLIB) $(LIBS_MOVE) -o $@
81f94052 343
d6db9fd6 344pop.o: ${srcdir}/pop.c ${srcdir}/pop.h ${srcdir}/../lib/min-max.h $(config_h)
81f94052 345 $(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/pop.c
f7dbcf3c 346
f540ee86 347emacsclient${EXEEXT}: ${srcdir}/emacsclient.c $(NTLIB) $(config_h)
84bbb1ad 348 $(CC) ${ALL_CFLAGS} ${srcdir}/emacsclient.c \
d6db9fd6 349 -DVERSION="\"${version}\"" $(NTLIB) $(LOADLIBES) $(LIB_FDATASYNC) \
df199e56 350 $(LIB_WSOCK32) $(LIBS_ECLIENT) -o $@
7c4026b6 351
f540ee86
EZ
352emacsclientw${EXEEXT}: ${srcdir}/emacsclient.c $(NTLIB) $(CLIENTRES) $(config_h)
353 $(CC) ${ALL_CFLAGS} $(CLIENTRES) -mwindows ${srcdir}/emacsclient.c \
d6db9fd6 354 -DVERSION="\"${version}\"" $(LOADLIBES) $(LIB_FDATASYNC) \
df199e56 355 $(LIB_WSOCK32) $(LIBS_ECLIENT) -o $@
d6db9fd6 356
2b57bbc0 357NTINC = ${srcdir}/../nt/inc
d6db9fd6
EZ
358NTDEPS = $(NTINC)/ms-w32.h $(NTINC)/sys/stat.h $(NTINC)/inttypes.h \
359 $(NTINC)/stdint.h $(NTINC)/pwd.h $(NTINC)/sys/time.h $(NTINC)/stdbool.h \
360 $(NTINC)/sys/wait.h $(NTINC)/unistd.h $(NTINC)/sys/file.h $(NTINC)/netdb.h
f540ee86 361
d6db9fd6
EZ
362# The dependency on $(NTDEPS) is a trick intended to cause recompile of
363# programs on MinGW whenever some private header in nt/inc is modified.
364ntlib.o: ${srcdir}/ntlib.c ${srcdir}/ntlib.h $(NTDEPS)
7c4026b6 365 $(CC) -c ${CPP_CFLAGS} ${srcdir}/ntlib.c
f7dbcf3c 366
d6db9fd6 367hexl${EXEEXT}: ${srcdir}/hexl.c $(NTLIB) $(config_h)
df199e56 368 $(CC) ${ALL_CFLAGS} ${srcdir}/hexl.c $(LOADLIBES) -o $@
f7dbcf3c 369
a74b0e1b 370update-game-score${EXEEXT}: ${srcdir}/update-game-score.c $(NTLIB) $(config_h)
1c728a9d 371 $(CC) ${ALL_CFLAGS} -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\"" \
d6db9fd6 372 ${srcdir}/update-game-score.c $(LOADLIBES) $(NTLIB) \
df199e56 373 -o $@
d3b23034 374
2b57bbc0 375emacsclient.res: $(NTINC)/../emacsclient.rc
df199e56 376 $(WINDRES) -O coff --include-dir=$(NTINC)/.. -o $@ \
2b57bbc0 377 $(NTINC)/../emacsclient.rc
095bf253 378
d3b23034 379## Makefile ends here.