Merge from emacs-24; up to 2014-05-04T21:18:30Z!eggert@cs.ucla.edu
[bpt/emacs.git] / lib-src / Makefile.in
1 ### @configure_input@
2
3 # Copyright (C) 1985, 1987-1988, 1993-1994, 2001-2014 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 <http://www.gnu.org/licenses/>.
20
21 SHELL = @SHELL@
22
23 # Following ../lisp/Makefile.in.
24 EMACS = ../src/emacs
25 EMACSOPT = -batch --no-site-file --no-site-lisp
26
27 # ==================== Things `configure' will edit ====================
28
29 CC=@CC@
30 CFLAGS=@CFLAGS@
31 version=@version@
32 ## Used in $archlibdir.
33 configuration=@configuration@
34 EXEEXT=@EXEEXT@
35 C_SWITCH_SYSTEM=@C_SWITCH_SYSTEM@
36 C_SWITCH_MACHINE=@C_SWITCH_MACHINE@
37 PROFILING_CFLAGS = @PROFILING_CFLAGS@
38 WARN_CFLAGS = @WARN_CFLAGS@
39 WERROR_CFLAGS = @WERROR_CFLAGS@
40 UPDATE_MANIFEST = @UPDATE_MANIFEST@
41
42 # Program name transformation.
43 TRANSFORM = @program_transform_name@
44
45 # ==================== Where To Install Things ====================
46
47 # Location to install Emacs.app under GNUstep / Mac OS X.
48 # Later values may use this.
49 ns_appbindir=@ns_appbindir@
50
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'.
56 prefix=@prefix@
57
58 # Like `prefix', but used for architecture-specific files. This is
59 # set with the --exec-prefix option to `../configure'.
60 exec_prefix=@exec_prefix@
61
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'.
65 bindir=@bindir@
66
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
70 # --libexecdir option to `../configure'.
71 libexecdir=@libexecdir@
72
73 # Directory for local state files for all programs.
74 localstatedir=@localstatedir@
75
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.
80
81 # We use $(srcdir) explicitly in dependencies so as not to depend on VPATH.
82 srcdir=@srcdir@
83 VPATH=@srcdir@
84
85 # The top-level source directory, also set by configure.
86 top_srcdir=@top_srcdir@
87 # MinGW CPPFLAGS may use this.
88 abs_top_srcdir=@abs_top_srcdir@
89
90 # ==================== Emacs-specific directories ====================
91
92 # These variables hold the values Emacs will actually use. They are
93 # based on the values of the standard Make variables above.
94
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'.
100 archlibdir=@archlibdir@
101
102 gamedir=@gamedir@
103 gameuser=@gameuser@
104
105 # ==================== Utility Programs for the Build =================
106
107 # ../configure figures out the correct values for these.
108 INSTALL = @INSTALL@
109 INSTALL_PROGRAM = @INSTALL_PROGRAM@
110 INSTALL_SCRIPT = @INSTALL_SCRIPT@
111 # By default, we uphold the dignity of our programs.
112 INSTALL_STRIP =
113 MKDIR_P = @MKDIR_P@
114
115 # ========================== Lists of Files ===========================
116
117 # emacsclientw.exe for MinGW, empty otherwise
118 CLIENTW = @CLIENTW@
119
120 # Things that a user might actually run, which should be installed in bindir.
121 INSTALLABLES = etags${EXEEXT} ctags${EXEEXT} emacsclient${EXEEXT} $(CLIENTW) \
122 ebrowse${EXEEXT}
123
124 INSTALLABLE_SCRIPTS = grep-changelog
125
126 # Things that Emacs runs internally, or during the build process,
127 # which should not be installed in bindir.
128 UTILITIES = profile${EXEEXT} movemail${EXEEXT} hexl${EXEEXT} \
129 update-game-score${EXEEXT}
130
131 DONT_INSTALL= make-docfile${EXEEXT}
132
133 # Like UTILITIES, but they're not system-dependent, and should not be
134 # deleted by the distclean target.
135 SCRIPTS= rcs2log $(UPDATE_MANIFEST)
136
137 # All files that are created by the linker, i.e., whose names end in ${EXEEXT}.
138 EXE_FILES = ${INSTALLABLES} ${UTILITIES} ${DONT_INSTALL}
139
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
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.
145 MOVE_FLAGS=
146
147 ## Empty if either MAIL_USE_FLOCK or MAIL_USE_LOCKF, else need-blessmail.
148 BLESSMAIL_TARGET=@BLESSMAIL_TARGET@
149
150 ## -lkrb or -lkrb4 if needed
151 KRB4LIB=@KRB4LIB@
152 ## -ldes or -ldes425 if needed
153 DESLIB=@DESLIB@
154 ## -lkrb5 if needed
155 KRB5LIB=@KRB5LIB@
156 ## -lk5crypto or -lcrypto if needed
157 CRYPTOLIB=@CRYPTOLIB@
158 ## -lcom_err if needed
159 COM_ERRLIB=@COM_ERRLIB@
160 ## -lhesiod if needed
161 LIBHESIOD=@LIBHESIOD@
162 ## -lresolv if HAVE_LIBRESOLV
163 LIBRESOLV=@LIBRESOLV@
164 ## -llockfile if HAVE_LIBLOCKFILE or -lmail if HAVE_LIBMAIL
165 LIBS_MAIL=@LIBS_MAIL@
166 ## empty or -lrt or -lposix4 if HAVE_CLOCK_GETTIME
167 LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
168 ## empty or -lrt or -lposix4 if HAVE_FDATASYNC
169 LIB_FDATASYNC = @LIB_FDATASYNC@
170 ## empty or -lwsock2 for MinGW
171 LIB_WSOCK32=@LIB_WSOCK32@
172
173 ## Extra libraries to use when linking movemail.
174 LIBS_MOVE = $(LIBS_MAIL) $(KRB4LIB) $(DESLIB) $(KRB5LIB) $(CRYPTOLIB) \
175 $(COM_ERRLIB) $(LIBHESIOD) $(LIBRESOLV) $(LIB_WSOCK32)
176
177 ## Extra libraries when linking emacsclient
178 ## (empty or -lcomctl32 for MinGW)
179 LIBS_ECLIENT = @LIBS_ECLIENT@
180
181 ## Extra object files for linking for MinGW
182 NTLIB = @NTLIB@
183 CLIENTRES = @CLIENTRES@
184 WINDRES = @WINDRES@
185
186 ## Some systems define this to request special libraries.
187 LIBS_SYSTEM = @LIBS_SYSTEM@
188
189 BASE_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) \
190 $(WARN_CFLAGS) $(WERROR_CFLAGS) \
191 -I. -I../src -I../lib \
192 -I${srcdir} -I${srcdir}/../src -I${srcdir}/../lib
193
194 ALL_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${LDFLAGS} ${CPPFLAGS} ${CFLAGS}
195 LINK_CFLAGS = ${BASE_CFLAGS} ${LDFLAGS} ${CFLAGS}
196 CPP_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${CPPFLAGS} ${CFLAGS}
197
198 # Configuration files for .o files to depend on.
199 config_h = ../src/config.h $(srcdir)/../src/conf_post.h
200
201 all: ${EXE_FILES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}
202
203 .PHONY: all need-blessmail maybe-blessmail
204
205 LOADLIBES = ../lib/libgnu.a $(LIBS_SYSTEM)
206 $(EXE_FILES): ../lib/libgnu.a
207
208 ## Only used if we need blessmail, but no harm in always defining.
209 ## This makes the actual blessmail executable.
210 blessmail:
211 $(EMACS) $(EMACSOPT) -l $(srcdir)/../lisp/mail/blessmail.el
212 chmod +x blessmail
213
214 ## This checks if we need to run blessmail.
215 ## Do not charge ahead and do it! Let the installer decide.
216 need-blessmail: blessmail
217 @if [ `wc -l <blessmail` != 2 ] ; then \
218 dir=`sed -n -e 's/echo mail directory = \(.*\)/\1/p' blessmail`; \
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."; \
223 fi
224
225 ## This is the target invoked by the top-level Makefile.
226 maybe-blessmail: $(BLESSMAIL_TARGET)
227
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.
233 $(DESTDIR)${archlibdir}: all
234 @echo
235 @echo "Installing utilities run internally by Emacs."
236 umask 022; ${MKDIR_P} "$(DESTDIR)${archlibdir}"
237 exp_archlibdir=`cd "$(DESTDIR)${archlibdir}" && /bin/pwd`; \
238 if [ "$$exp_archlibdir" != "`/bin/pwd`" ]; then \
239 for file in ${UTILITIES}; do \
240 $(INSTALL_PROGRAM) $(INSTALL_STRIP) $$file "$(DESTDIR)${archlibdir}/$$file" ; \
241 done ; \
242 fi
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}"; \
249 fi
250 exp_archlibdir=`cd "$(DESTDIR)${archlibdir}" && /bin/pwd`; \
251 if [ "$$exp_archlibdir" != "`cd ${srcdir} && /bin/pwd`" ]; then \
252 for file in ${SCRIPTS}; do \
253 $(INSTALL_SCRIPT) ${srcdir}/$$file "$(DESTDIR)${archlibdir}/$$file"; \
254 done ; \
255 fi
256
257 .PHONY: install uninstall mostlyclean clean distclean maintainer-clean
258 .PHONY: extraclean check tags
259
260 install: $(DESTDIR)${archlibdir}
261 @echo
262 @echo "Installing utilities for users to run."
263 umask 022; ${MKDIR_P} "$(DESTDIR)${bindir}"
264 for file in ${INSTALLABLES} ; do \
265 $(INSTALL_PROGRAM) $(INSTALL_STRIP) $${file} "$(DESTDIR)${bindir}"/`echo $${file} | sed -e 's/${EXEEXT}$$//' -e '$(TRANSFORM)'`${EXEEXT} ; \
266 done
267 for file in ${INSTALLABLE_SCRIPTS} ; do \
268 $(INSTALL_SCRIPT) ${srcdir}/$${file} "$(DESTDIR)${bindir}"/`echo $${file} | sed '$(TRANSFORM)'` ; \
269 done
270
271 uninstall:
272 for file in ${INSTALLABLES}; do \
273 rm -f "$(DESTDIR)${bindir}"/`echo $${file} | sed -e 's/${EXEEXT}$$//' -e '$(TRANSFORM)'`${EXEEXT} ; \
274 done
275 for file in ${INSTALLABLE_SCRIPTS}; do \
276 rm -f "$(DESTDIR)${bindir}"/`echo $${file} | sed '$(TRANSFORM)'` ; \
277 done
278 if [ -d "$(DESTDIR)${archlibdir}" ]; then \
279 (cd "$(DESTDIR)${archlibdir}" && rm -f ${UTILITIES} ${SCRIPTS}) \
280 fi
281
282 mostlyclean:
283 -rm -f core *.o *.res
284
285 clean: mostlyclean
286 -rm -f ${EXE_FILES}
287
288 distclean: clean
289 -rm -f TAGS
290 -rm -f Makefile blessmail
291
292 maintainer-clean: distclean
293 true
294
295 extraclean: maintainer-clean
296 -rm -f *~ \#*
297
298 ## Test the contents of the directory.
299 check:
300 @echo "We don't have any tests for the lib-src/ directory yet."
301
302 tags: TAGS
303 TAGS: etags${EXEEXT}
304 etags *.[ch]
305
306 ../lib/libgnu.a: $(config_h)
307 cd ../lib && $(MAKE) $(MFLAGS) libgnu.a
308
309 regex.o: $(srcdir)/../src/regex.c $(srcdir)/../src/regex.h $(config_h)
310 ${CC} -c ${CPP_CFLAGS} ${srcdir}/../src/regex.c
311
312
313 etags_deps = ${srcdir}/etags.c regex.o $(NTLIB) $(config_h)
314 etags_args = -DEMACS_NAME="\"GNU Emacs\"" -DVERSION="\"${version}\"" \
315 ${srcdir}/etags.c regex.o $(LOADLIBES) $(NTLIB) -o $@
316
317 etags${EXEEXT}: ${etags_deps}
318 $(CC) ${ALL_CFLAGS} ${etags_args}
319
320 ## FIXME?
321 ## Can't we use a symlink ctags -> etags, and make etags check for argv[0]?
322 ## Or a wrapper script that calls etags --ctags?
323 ctags${EXEEXT}: ${etags_deps}
324 $(CC) ${ALL_CFLAGS} -DCTAGS ${etags_args}
325
326
327 ebrowse${EXEEXT}: ${srcdir}/ebrowse.c ${srcdir}/../lib/min-max.h $(NTLIB) \
328 $(config_h)
329 $(CC) ${ALL_CFLAGS} -DVERSION="\"${version}\"" \
330 ${srcdir}/ebrowse.c $(LOADLIBES) $(NTLIB) -o $@
331
332 profile${EXEEXT}: ${srcdir}/profile.c $(NTLIB) $(config_h)
333 $(CC) ${ALL_CFLAGS} ${srcdir}/profile.c \
334 $(LOADLIBES) $(NTLIB) $(LIB_CLOCK_GETTIME) -o $@
335
336 make-docfile${EXEEXT}: ${srcdir}/make-docfile.c $(NTLIB) $(config_h)
337 $(CC) ${ALL_CFLAGS} ${srcdir}/make-docfile.c $(LOADLIBES) $(NTLIB) \
338 -o $@
339
340 movemail${EXEEXT}: ${srcdir}/movemail.c pop.o $(NTLIB) $(config_h)
341 $(CC) ${ALL_CFLAGS} ${MOVE_FLAGS} ${srcdir}/movemail.c pop.o \
342 $(LOADLIBES) $(NTLIB) $(LIBS_MOVE) -o $@
343
344 pop.o: ${srcdir}/pop.c ${srcdir}/pop.h ${srcdir}/../lib/min-max.h $(config_h)
345 $(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/pop.c
346
347 emacsclient${EXEEXT}: ${srcdir}/emacsclient.c $(NTLIB) $(config_h)
348 $(CC) ${ALL_CFLAGS} ${srcdir}/emacsclient.c \
349 -DVERSION="\"${version}\"" $(NTLIB) $(LOADLIBES) $(LIB_FDATASYNC) \
350 $(LIB_WSOCK32) $(LIBS_ECLIENT) -o $@
351
352 emacsclientw${EXEEXT}: ${srcdir}/emacsclient.c $(NTLIB) $(CLIENTRES) $(config_h)
353 $(CC) ${ALL_CFLAGS} $(CLIENTRES) -mwindows ${srcdir}/emacsclient.c \
354 -DVERSION="\"${version}\"" $(LOADLIBES) $(LIB_FDATASYNC) \
355 $(LIB_WSOCK32) $(LIBS_ECLIENT) -o $@
356
357 NTINC = ${srcdir}/../nt/inc
358 NTDEPS = $(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
361
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.
364 ntlib.o: ${srcdir}/ntlib.c ${srcdir}/ntlib.h $(NTDEPS)
365 $(CC) -c ${CPP_CFLAGS} ${srcdir}/ntlib.c
366
367 hexl${EXEEXT}: ${srcdir}/hexl.c $(NTLIB) $(config_h)
368 $(CC) ${ALL_CFLAGS} ${srcdir}/hexl.c $(LOADLIBES) -o $@
369
370 update-game-score${EXEEXT}: ${srcdir}/update-game-score.c $(NTLIB) $(config_h)
371 $(CC) ${ALL_CFLAGS} -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\"" \
372 ${srcdir}/update-game-score.c $(LOADLIBES) $(NTLIB) \
373 -o $@
374
375 emacsclient.res: $(NTINC)/../emacsclient.rc
376 $(WINDRES) -O coff --include-dir=$(NTINC)/.. -o $@ \
377 $(NTINC)/../emacsclient.rc
378
379 ## Makefile ends here.