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