Merge from trunk after a lot of time.
[bpt/emacs.git] / lib-src / Makefile.in
1 ### @configure_input@
2
3 # Copyright (C) 1985, 1987-1988, 1993-1994, 2001-2013
4 # Free Software 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
88 # ==================== Emacs-specific directories ====================
89
90 # These variables hold the values Emacs will actually use. They are
91 # based on the values of the standard Make variables above.
92
93 # Where to put executables to be run by Emacs rather than the user.
94 # This path usually includes the Emacs version and configuration name,
95 # so that multiple configurations for multiple versions of Emacs may
96 # be installed at once. This can be set with the --archlibdir option
97 # to `../configure'.
98 archlibdir=@archlibdir@
99
100 gamedir=@gamedir@
101 gameuser=@gameuser@
102
103 # ==================== Utility Programs for the Build =================
104
105 # ../configure figures out the correct values for these.
106 INSTALL = @INSTALL@
107 INSTALL_PROGRAM = @INSTALL_PROGRAM@
108 INSTALL_SCRIPT = @INSTALL_SCRIPT@
109 # By default, we uphold the dignity of our programs.
110 INSTALL_STRIP =
111 MKDIR_P = @MKDIR_P@
112
113 # ========================== Lists of Files ===========================
114
115 # emacsclientw.exe for MinGW, empty otherwise
116 CLIENTW = @CLIENTW@
117
118 # Things that a user might actually run, which should be installed in bindir.
119 INSTALLABLES = etags${EXEEXT} ctags${EXEEXT} emacsclient${EXEEXT} $(CLIENTW) \
120 ebrowse${EXEEXT}
121
122 INSTALLABLE_SCRIPTS = grep-changelog
123
124 # Things that Emacs runs internally, or during the build process,
125 # which should not be installed in bindir.
126 UTILITIES = profile${EXEEXT} movemail${EXEEXT} hexl${EXEEXT} \
127 update-game-score${EXEEXT}
128
129 DONT_INSTALL= test-distrib${EXEEXT} make-docfile${EXEEXT}
130
131 # Like UTILITIES, but they're not system-dependent, and should not be
132 # deleted by the distclean target.
133 SCRIPTS= rcs2log $(UPDATE_MANIFEST)
134
135 # All files that are created by the linker, i.e., whose names end in ${EXEEXT}.
136 EXE_FILES = ${INSTALLABLES} ${UTILITIES} ${DONT_INSTALL}
137
138 # Specify additional -D flags for movemail. Options:
139 # -DMAIL_USE_FLOCK or -DMAIL_USE_LOCKF (use flock or lockf for file locking).
140 # See the comments about locking in movemail.c. Normally the values
141 # set by configure should be correct and you should not need to do anything.
142 # If neither flag is set, you need to use blessmail.
143 MOVE_FLAGS=
144
145 ## Empty if either MAIL_USE_FLOCK or MAIL_USE_LOCKF, else need-blessmail.
146 BLESSMAIL_TARGET=@BLESSMAIL_TARGET@
147
148 ## -lkrb or -lkrb4 if needed
149 KRB4LIB=@KRB4LIB@
150 ## -ldes or -ldes425 if needed
151 DESLIB=@DESLIB@
152 ## -lkrb5 if needed
153 KRB5LIB=@KRB5LIB@
154 ## -lk5crypto or -lcrypto if needed
155 CRYPTOLIB=@CRYPTOLIB@
156 ## -lcom_err if needed
157 COM_ERRLIB=@COM_ERRLIB@
158 ## -lhesiod if needed
159 LIBHESIOD=@LIBHESIOD@
160 ## -lresolv if HAVE_LIBRESOLV
161 LIBRESOLV=@LIBRESOLV@
162 ## -llockfile if HAVE_LIBLOCKFILE or -lmail if HAVE_LIBMAIL
163 LIBS_MAIL=@LIBS_MAIL@
164 ## empty or -lrt or -lposix4 if HAVE_CLOCK_GETTIME
165 LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
166 ## empty or -lrt or -lposix4 if HAVE_FDATASYNC
167 LIB_FDATASYNC = @LIB_FDATASYNC@
168 ## empty or -lwsock2 for MinGW
169 LIB_WSOCK32=@LIB_WSOCK32@
170
171 ## Extra libraries to use when linking movemail.
172 LIBS_MOVE = $(LIBS_MAIL) $(KRB4LIB) $(DESLIB) $(KRB5LIB) $(CRYPTOLIB) \
173 $(COM_ERRLIB) $(LIBHESIOD) $(LIBRESOLV) $(LIB_WSOCK32)
174
175 ## Extra libraries when linking emacsclient
176 ## (empty or -lcomctl32 for MinGW)
177 LIBS_ECLIENT = @LIBS_ECLIENT@
178
179 ## Extra object files for linking for MinGW
180 NTLIB = @NTLIB@
181 CLIENTRES = @CLIENTRES@
182 WINDRES = @WINDRES@
183
184 ## Some systems define this to request special libraries.
185 LIBS_SYSTEM = @LIBS_SYSTEM@
186
187 BASE_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) \
188 $(WARN_CFLAGS) $(WERROR_CFLAGS) \
189 -I. -I../src -I../lib \
190 -I${srcdir} -I${srcdir}/../src -I${srcdir}/../lib
191
192 ALL_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${LDFLAGS} ${CPPFLAGS} ${CFLAGS}
193 LINK_CFLAGS = ${BASE_CFLAGS} ${LDFLAGS} ${CFLAGS}
194 CPP_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${CPPFLAGS} ${CFLAGS}
195
196 # Configuration files for .o files to depend on.
197 config_h = ../src/config.h $(srcdir)/../src/conf_post.h
198
199 all: ${EXE_FILES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}
200
201 .PHONY: all need-blessmail maybe-blessmail
202
203 LOADLIBES = ../lib/libgnu.a $(LIBS_SYSTEM)
204 $(EXE_FILES): ../lib/libgnu.a
205
206 ## Only used if we need blessmail, but no harm in always defining.
207 ## This makes the actual blessmail executable.
208 blessmail:
209 $(EMACS) $(EMACSOPT) -l $(srcdir)/../lisp/mail/blessmail.el
210 chmod +x blessmail
211
212 ## This checks if we need to run blessmail.
213 ## Do not charge ahead and do it! Let the installer decide.
214 need-blessmail: blessmail
215 @if [ `wc -l <blessmail` != 2 ] ; then \
216 dir=`sed -n -e 's/echo mail directory = \(.*\)/\1/p' blessmail`; \
217 echo Assuming $$dir is really the mail spool directory, you should; \
218 echo run lib-src/blessmail $(DESTDIR)${archlibdir}/movemail${EXEEXT}; \
219 echo as root, to give movemail${EXEEXT} appropriate permissions.; \
220 echo Do that after running make install.; \
221 fi
222
223 ## This is the target invoked by the top-level Makefile.
224 maybe-blessmail: $(BLESSMAIL_TARGET)
225
226 ## Install the internal utilities. Until they are installed, we can
227 ## just run them directly from lib-src.
228 ## If the chown/chmod commands fail, that is not a big deal.
229 ## update-game-score will detect at runtime that it is not setuid,
230 ## and handle things accordingly.
231 $(DESTDIR)${archlibdir}: all
232 @echo
233 @echo "Installing utilities run internally by Emacs."
234 umask 022; ${MKDIR_P} $(DESTDIR)${archlibdir}
235 if [ `cd $(DESTDIR)${archlibdir} && /bin/pwd` != `/bin/pwd` ]; then \
236 for file in ${UTILITIES}; do \
237 $(INSTALL_PROGRAM) $(INSTALL_STRIP) $$file $(DESTDIR)${archlibdir}/$$file ; \
238 done ; \
239 fi
240 umask 022; ${MKDIR_P} $(DESTDIR)${gamedir}; \
241 touch $(DESTDIR)${gamedir}/snake-scores; \
242 touch $(DESTDIR)${gamedir}/tetris-scores
243 -if chown ${gameuser} $(DESTDIR)${archlibdir}/update-game-score${EXEEXT} && chmod u+s $(DESTDIR)${archlibdir}/update-game-score${EXEEXT}; then \
244 chown ${gameuser} $(DESTDIR)${gamedir}; \
245 chmod u=rwx,g=rwx,o=rx $(DESTDIR)${gamedir}; \
246 fi
247 if [ `cd $(DESTDIR)${archlibdir} && /bin/pwd` \
248 != `cd ${srcdir} && /bin/pwd` ]; then \
249 for file in ${SCRIPTS}; do \
250 $(INSTALL_SCRIPT) ${srcdir}/$$file $(DESTDIR)${archlibdir}/$$file; \
251 done ; \
252 fi
253
254 .PHONY: install uninstall mostlyclean clean distclean maintainer-clean
255 .PHONY: extraclean check tags
256
257 install: $(DESTDIR)${archlibdir}
258 @echo
259 @echo "Installing utilities for users to run."
260 umask 022; ${MKDIR_P} $(DESTDIR)${bindir}
261 for file in ${INSTALLABLES} ; do \
262 $(INSTALL_PROGRAM) $(INSTALL_STRIP) $${file} $(DESTDIR)${bindir}/`echo $${file} | sed -e 's/${EXEEXT}$$//' -e '$(TRANSFORM)'`${EXEEXT} ; \
263 done
264 for file in ${INSTALLABLE_SCRIPTS} ; do \
265 $(INSTALL_SCRIPT) ${srcdir}/$${file} $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \
266 done
267
268 uninstall:
269 for file in ${INSTALLABLES}; do \
270 rm -f $(DESTDIR)${bindir}/`echo $${file} | sed -e 's/${EXEEXT}$$//' -e '$(TRANSFORM)'`${EXEEXT} ; \
271 done
272 for file in ${INSTALLABLE_SCRIPTS}; do \
273 rm -f $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \
274 done
275 if [ -d $(DESTDIR)${archlibdir} ]; then \
276 (cd $(DESTDIR)${archlibdir} && rm -f ${UTILITIES} ${SCRIPTS}) \
277 fi
278
279 mostlyclean:
280 -rm -f core *.o *.res
281
282 clean: mostlyclean
283 -rm -f ${EXE_FILES}
284
285 distclean: clean
286 -rm -f TAGS
287 -rm -f Makefile blessmail
288
289 maintainer-clean: distclean
290 true
291
292 extraclean: maintainer-clean
293 -rm -f *~ \#*
294
295 ## Test the contents of the directory.
296 check:
297 @echo "We don't have any tests for the lib-src/ directory yet."
298
299 tags: TAGS
300 TAGS: etags${EXEEXT}
301 etags *.[ch]
302
303 ## This verifies that the non-ASCII characters in the file \`testfile\'
304 ## have not been clobbered by whatever means were used to copy and
305 ## distribute Emacs. If they were clobbered, all the .elc files were
306 ## clobbered too.
307 test-distrib${EXEEXT}: ${srcdir}/test-distrib.c
308 $(CC) ${ALL_CFLAGS} -o test-distrib${EXEEXT} ${srcdir}/test-distrib.c
309 ./test-distrib ${srcdir}/testfile
310
311 ../lib/libgnu.a: $(config_h)
312 cd ../lib && $(MAKE) libgnu.a
313
314 regex.o: $(srcdir)/../src/regex.c $(srcdir)/../src/regex.h $(config_h)
315 ${CC} -c ${CPP_CFLAGS} -DCONFIG_BROKETS -DINHIBIT_STRING_HEADER \
316 ${srcdir}/../src/regex.c
317
318 etags${EXEEXT}: ${srcdir}/etags.c regex.o $(NTLIB) $(config_h)
319 $(CC) ${ALL_CFLAGS} -DEMACS_NAME="\"GNU Emacs\"" \
320 -DVERSION="\"${version}\"" ${srcdir}/etags.c \
321 regex.o $(LOADLIBES) $(NTLIB) -o etags${EXEEXT}
322
323 ebrowse${EXEEXT}: ${srcdir}/ebrowse.c ${srcdir}/../lib/min-max.h $(NTLIB) \
324 $(config_h)
325 $(CC) ${ALL_CFLAGS} -DVERSION="\"${version}\"" \
326 ${srcdir}/ebrowse.c $(LOADLIBES) $(NTLIB) -o ebrowse${EXEEXT}
327
328 ## We depend on etags to assure that parallel makes do not write two
329 ## etags.o files on top of each other.
330 ctags${EXEEXT}: etags${EXEEXT}
331 $(CC) ${ALL_CFLAGS} -DCTAGS -DEMACS_NAME="\"GNU Emacs\"" \
332 -DVERSION="\"${version}\"" ${srcdir}/etags.c \
333 regex.o $(LOADLIBES) $(NTLIB) -o ctags${EXEEXT}
334
335 profile${EXEEXT}: ${srcdir}/profile.c $(NTLIB) $(config_h)
336 $(CC) ${ALL_CFLAGS} ${srcdir}/profile.c \
337 $(LOADLIBES) $(NTLIB) $(LIB_CLOCK_GETTIME) -o profile${EXEEXT}
338
339 make-docfile${EXEEXT}: ${srcdir}/make-docfile.c $(NTLIB) $(config_h)
340 $(CC) ${ALL_CFLAGS} ${srcdir}/make-docfile.c $(LOADLIBES) $(NTLIB) \
341 -o make-docfile${EXEEXT}
342
343 movemail${EXEEXT}: ${srcdir}/movemail.c pop.o $(NTLIB) $(config_h)
344 $(CC) ${ALL_CFLAGS} ${MOVE_FLAGS} ${srcdir}/movemail.c pop.o \
345 $(LOADLIBES) $(NTLIB) $(LIBS_MOVE) -o movemail${EXEEXT}
346
347 pop.o: ${srcdir}/pop.c ${srcdir}/pop.h ${srcdir}/../lib/min-max.h $(config_h)
348 $(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/pop.c
349
350 emacsclient${EXEEXT}: ${srcdir}/emacsclient.c $(NTLIB) $(config_h)
351 $(CC) ${ALL_CFLAGS} ${srcdir}/emacsclient.c \
352 -DVERSION="\"${version}\"" $(NTLIB) $(LOADLIBES) $(LIB_FDATASYNC) \
353 $(LIB_WSOCK32) $(LIBS_ECLIENT) -o emacsclient${EXEEXT}
354
355 emacsclientw${EXEEXT}: ${srcdir}/emacsclient.c $(NTLIB) $(CLIENTRES) $(config_h)
356 $(CC) ${ALL_CFLAGS} $(CLIENTRES) -mwindows ${srcdir}/emacsclient.c \
357 -DVERSION="\"${version}\"" $(LOADLIBES) $(LIB_FDATASYNC) \
358 $(LIB_WSOCK32) $(LIBS_ECLIENT) -o emacsclientw${EXEEXT}
359
360 NTINC = ${srcdir}/../nt/inc
361 NTDEPS = $(NTINC)/ms-w32.h $(NTINC)/sys/stat.h $(NTINC)/inttypes.h \
362 $(NTINC)/stdint.h $(NTINC)/pwd.h $(NTINC)/sys/time.h $(NTINC)/stdbool.h \
363 $(NTINC)/sys/wait.h $(NTINC)/unistd.h $(NTINC)/sys/file.h $(NTINC)/netdb.h
364
365 # The dependency on $(NTDEPS) is a trick intended to cause recompile of
366 # programs on MinGW whenever some private header in nt/inc is modified.
367 ntlib.o: ${srcdir}/ntlib.c ${srcdir}/ntlib.h $(NTDEPS)
368 $(CC) -c ${CPP_CFLAGS} ${srcdir}/ntlib.c
369
370 hexl${EXEEXT}: ${srcdir}/hexl.c $(NTLIB) $(config_h)
371 $(CC) ${ALL_CFLAGS} ${srcdir}/hexl.c $(LOADLIBES) -o hexl${EXEEXT}
372
373 update-game-score${EXEEXT}: ${srcdir}/update-game-score.c $(NTLIB) $(config_h)
374 $(CC) ${ALL_CFLAGS} -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\"" \
375 ${srcdir}/update-game-score.c $(LOADLIBES) $(NTLIB) \
376 -o update-game-score${EXEEXT}
377
378 emacsclient.res: $(NTINC)/../emacsclient.rc
379 $(WINDRES) -O coff --include-dir=$(NTINC)/.. -o emacsclient.res \
380 $(NTINC)/../emacsclient.rc
381
382 ## Makefile ends here.