Merge from emacs-23
[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, 2002, 2003, 2004,
3 # 2005, 2006, 2007, 2008, 2009, 2010
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
22 # Avoid trouble on systems where the `SHELL' variable might be
23 # inherited from the environment.
24 SHELL = /bin/sh
25
26 # Following ../lisp/Makefile.in.
27 EMACS = ../src/emacs
28 EMACSOPT = -batch --no-site-file --multibyte
29
30 # ==================== Things `configure' will edit ====================
31
32 CC=@CC@
33 CFLAGS=@CFLAGS@
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 C_WARNINGS_SWITCH = @C_WARNINGS_SWITCH@
41 PROFILING_CFLAGS = @PROFILING_CFLAGS@
42
43 # Program name transformation.
44 TRANSFORM = @program_transform_name@
45
46 # ==================== Where To Install Things ====================
47
48 # The default location for installation. Everything is placed in
49 # subdirectories of this directory. The default values for many of
50 # the variables below are expressed in terms of this one, so you may
51 # not need to change them. This is set with the --prefix option to
52 # `../configure'.
53 prefix=@prefix@
54
55 # Like `prefix', but used for architecture-specific files. This is
56 # set with the --exec-prefix option to `../configure'.
57 exec_prefix=@exec_prefix@
58
59 # Where to install Emacs and other binaries that people will want to
60 # run directly (like etags). This is set with the --bindir option
61 # to `../configure'.
62 bindir=@bindir@
63
64 # Where to install and expect executable files to be run by Emacs
65 # rather than directly by users, and other architecture-dependent
66 # data. ${archlibdir} is usually below this. This is set with the
67 # --libexecdir option to `../configure'.
68 libexecdir=@libexecdir@
69
70 # Directory for local state files for all programs.
71 localstatedir=@localstatedir@
72
73 # Where to find the source code. This is set by the configure
74 # script's `--srcdir' option. However, the value of ${srcdir} in
75 # this makefile is not identical to what was specified with --srcdir,
76 # since the variable here has `/lib-src' added at the end.
77
78 # We use $(srcdir) explicitly in dependencies so as not to depend on VPATH.
79 srcdir=@srcdir@
80 VPATH=@srcdir@
81
82 # The top-level source directory, also set by configure.
83 top_srcdir=@top_srcdir@
84
85 # ==================== Emacs-specific directories ====================
86
87 # These variables hold the values Emacs will actually use. They are
88 # based on the values of the standard Make variables above.
89
90 # Where to put executables to be run by Emacs rather than the user.
91 # This path usually includes the Emacs version and configuration name,
92 # so that multiple configurations for multiple versions of Emacs may
93 # be installed at once. This can be set with the --archlibdir option
94 # to `../configure'.
95 archlibdir=@archlibdir@
96
97 gamedir=@gamedir@
98 gameuser=@gameuser@
99
100 # ==================== Utility Programs for the Build =================
101
102 # ../configure figures out the correct values for these.
103 INSTALL = @INSTALL@
104 INSTALL_PROGRAM = @INSTALL_PROGRAM@
105 INSTALL_DATA = @INSTALL_DATA@
106 INSTALL_SCRIPT = @INSTALL_SCRIPT@
107 # By default, we uphold the dignity of our programs.
108 INSTALL_STRIP =
109
110 # ========================== Lists of Files ===========================
111
112 # Things that a user might actually run, which should be installed in bindir.
113 INSTALLABLES = etags${EXEEXT} ctags${EXEEXT} emacsclient${EXEEXT} \
114 ebrowse${EXEEXT}
115
116 INSTALLABLE_SCRIPTS = rcs-checkin grep-changelog
117 STAMP_INST_SCRIPTS = stamp-rcs-checkin stamp-grep-changelog
118
119 # Things that Emacs runs internally, or during the build process,
120 # which should not be installed in bindir.
121 UTILITIES = profile${EXEEXT} movemail${EXEEXT} fakemail${EXEEXT} \
122 hexl${EXEEXT} update-game-score${EXEEXT}
123
124 DONT_INSTALL= test-distrib${EXEEXT} make-docfile${EXEEXT}
125
126 # Like UTILITIES, but they're not system-dependent, and should not be
127 # deleted by the distclean target.
128 SCRIPTS= rcs2log vcdiff
129 STAMP_SCRIPTS= stamp-rcs2log stamp-vcdiff
130
131 EXECUTABLES= ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}
132
133 # Specify additional -D flags for movemail. Options:
134 # -DMAIL_USE_FLOCK or -DMAIL_USE_LOCKF (use flock or lockf for file locking).
135 # See the comments about locking in movemail.c. Normally the values
136 # set by configure should be correct and you should not need to do anything.
137 # If neither flag is set, you need to use blessmail.
138 MOVE_FLAGS=
139
140 ## Empty if either MAIL_USE_FLOCK or MAIL_USE_LOCKF, else need-blessmail.
141 BLESSMAIL_TARGET=@BLESSMAIL_TARGET@
142
143 ## -lkrb if HAVE_LIBKRB or -lkrb4 if HAVE_LIBKRB4
144 KRB4LIB=@KRB4LIB@
145 ## -ldes if HAVE_LIBDES or -ldes425 if HAVE_LIBDES425
146 DESLIB=@DESLIB@
147 ## -lkrb5 if HAVE_LIBKRB5
148 KRB5LIB=@KRB5LIB@
149 ## -lk5crypto if HAVE_LIBK5CRYPTO or -lcrypto if HAVE_LIBCRYPTO
150 CRYPTOLIB=@CRYPTOLIB@
151 ## -lcom_err if HAVE_LIBCOM_ERR
152 COM_ERRLIB=@COM_ERRLIB@
153 ## -lhesiod if HAVE_LIBHESIOD
154 LIBHESIOD=@LIBHESIOD@
155 ## -lresolv if HAVE_LIBRESOLV
156 LIBRESOLV=@LIBRESOLV@
157 ## -llockfile if HAVE_LIBLOCKFILE or -lmail if HAVE_LIBMAIL
158 LIBS_MAIL=@LIBS_MAIL@
159
160 ## Extra libraries to use when linking movemail.
161 LIBS_MOVE = $(LIBS_MAIL) $(KRB4LIB) $(DESLIB) $(KRB5LIB) $(CRYPTOLIB) \
162 $(COM_ERRLIB) $(LIBHESIOD) $(LIBRESOLV)
163
164 ## Some systems define this to request special libraries.
165 LIBS_SYSTEM = @LIBS_SYSTEM@
166
167 # Those files shared with other GNU utilities need HAVE_CONFIG_H
168 # defined before they know they can take advantage of the information
169 # in ../src/config.h.
170 BASE_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) ${C_WARNINGS_SWITCH} \
171 -DHAVE_CONFIG_H -I. -I../src -I${srcdir} -I${srcdir}/../src
172
173 ALL_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${LDFLAGS} ${CPPFLAGS} ${CFLAGS}
174 LINK_CFLAGS = ${BASE_CFLAGS} ${LDFLAGS} ${CFLAGS}
175 CPP_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${CPPFLAGS} ${CFLAGS}
176
177 LOADLIBES=$(LIBS_SYSTEM)
178
179 ## This is the default compilation command.
180 ## But we should never rely on it, because some make version failed to
181 ## find it for getopt.o.
182 ## Using an explicit command made it work.
183 .c.o:
184 ${CC} -c ${CPP_CFLAGS} $<
185
186 all: ${DONT_INSTALL} ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS} ${STAMP_INST_SCRIPTS} ${STAMP_SCRIPTS}
187
188 ## These targets copy the scripts into the build directory so that
189 ## they can be run from there in an uninstalled Emacs.
190 ## The "-" is prepended because some versions of cp barf when srcdir
191 ## is the current directory, and thus the file will be copied into itself.
192 stamp-rcs2log: $(srcdir)/rcs2log
193 -cp -p $(srcdir)/rcs2log rcs2log
194 touch $@
195
196 stamp-rcs-checkin: $(srcdir)/rcs-checkin
197 -cp -p $(srcdir)/rcs-checkin rcs-checkin
198 touch $@
199
200 stamp-grep-changelog: $(srcdir)/grep-changelog
201 -cp -p $(srcdir)/grep-changelog grep-changelog
202 touch $@
203
204 stamp-vcdiff: $(srcdir)/vcdiff
205 -cp -p $(srcdir)/vcdiff vcdiff
206 touch $@
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; $(top_srcdir)/mkinstalldirs $(DESTDIR)${archlibdir}
237 if [ `(cd $(DESTDIR)${archlibdir} && /bin/pwd)` != `/bin/pwd` ]; then \
238 for file in ${UTILITIES}; do \
239 $(INSTALL_PROGRAM) $(INSTALL_STRIP) $$file $(DESTDIR)${archlibdir}/$$file ; \
240 done ; \
241 fi
242 umask 022; $(top_srcdir)/mkinstalldirs $(DESTDIR)${gamedir}; \
243 touch $(DESTDIR)${gamedir}/snake-scores; \
244 touch $(DESTDIR)${gamedir}/tetris-scores
245 -if chown ${gameuser} $(DESTDIR)${archlibdir}/update-game-score && chmod u+s $(DESTDIR)${archlibdir}/update-game-score; then \
246 chown ${gameuser} $(DESTDIR)${gamedir}; \
247 chmod u=rwx,g=rwx,o=rx $(DESTDIR)${gamedir}; \
248 fi
249 if [ `(cd $(DESTDIR)${archlibdir} && /bin/pwd)` \
250 != `(cd ${srcdir} && /bin/pwd)` ]; then \
251 for file in ${SCRIPTS}; do \
252 $(INSTALL_SCRIPT) ${srcdir}/$$file $(DESTDIR)${archlibdir}/$$file; \
253 done ; \
254 fi
255
256 install: $(DESTDIR)${archlibdir}
257 @echo
258 @echo "Installing utilities for users to run."
259 for file in ${INSTALLABLES} ; do \
260 $(INSTALL_PROGRAM) $(INSTALL_STRIP) $${file} $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \
261 chmod a+rx $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'`; \
262 done
263 for file in ${INSTALLABLE_SCRIPTS} ; do \
264 $(INSTALL_SCRIPT) ${srcdir}/$${file} $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \
265 chmod a+rx $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'`; \
266 done
267
268 uninstall:
269 (cd $(DESTDIR)${bindir}; \
270 for file in ${INSTALLABLES} ${INSTALLABLE_SCRIPTS}; do \
271 rm -f $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \
272 done)
273 if [ -d $(DESTDIR)${archlibdir} ]; then \
274 (cd $(DESTDIR)${archlibdir} && \
275 rm -f ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}) \
276 fi
277
278 mostlyclean:
279 -rm -f core *.o getopt.h getopt.h-t
280
281 clean: mostlyclean
282 -rm -f ${INSTALLABLES} ${UTILITIES} ${DONT_INSTALL}
283 -rm -f fns*.el *.tab.c *.tab.h stamp-*
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 ${srcdir}/test-distrib.c
309 ./test-distrib ${srcdir}/testfile
310
311 ## We need the following in order to create a <getopt.h> when the system
312 ## does not have one that works with the given compiler.
313 GETOPT_H = @GETOPT_H@
314 getopt.h: getopt_.h
315 cp $(srcdir)/getopt_.h $@-t
316 mv $@-t $@
317
318 GETOPTOBJS = @GETOPTOBJS@
319 GETOPTDEPS = $(GETOPTOBJS) $(GETOPT_H)
320 getopt.o: ${srcdir}/getopt.c $(GETOPT_H) ${srcdir}/gettext.h
321 ${CC} -c ${CPP_CFLAGS} ${srcdir}/getopt.c
322 getopt1.o: ${srcdir}/getopt1.c $(GETOPT_H)
323 ${CC} -c ${CPP_CFLAGS} ${srcdir}/getopt1.c
324
325 REGEXPOBJ = regex.o
326 REGEXPDEPS = $(REGEXPOBJ) $(srcdir)/../src/regex.h
327
328 regex.o: $(srcdir)/../src/regex.c $(srcdir)/../src/regex.h ../src/config.h
329 ${CC} -c ${CPP_CFLAGS} -DCONFIG_BROKETS -DINHIBIT_STRING_HEADER \
330 ${srcdir}/../src/regex.c
331
332 etags${EXEEXT}: ${srcdir}/etags.c $(GETOPTDEPS) $(REGEXPDEPS) ../src/config.h
333 $(CC) ${ALL_CFLAGS} -DEMACS_NAME="\"GNU Emacs\"" \
334 -DVERSION="\"${version}\"" ${srcdir}/etags.c $(GETOPTOBJS) \
335 $(REGEXPOBJ) $(LOADLIBES) -o etags
336
337 ebrowse${EXEEXT}: ${srcdir}/ebrowse.c $(GETOPTDEPS) ../src/config.h
338 $(CC) ${ALL_CFLAGS} -DVERSION="\"${version}\"" \
339 ${srcdir}/ebrowse.c $(GETOPTOBJS) $(LOADLIBES) -o ebrowse
340
341 ## We depend on etags to assure that parallel makes do not write two
342 ## etags.o files on top of each other.
343 ctags${EXEEXT}: etags${EXEEXT}
344 $(CC) ${ALL_CFLAGS} -DCTAGS -DEMACS_NAME="\"GNU Emacs\"" \
345 -DVERSION="\"${version}\"" ${srcdir}/etags.c $(GETOPTOBJS) \
346 $(REGEXPOBJ) $(LOADLIBES) -o ctags
347
348 profile${EXEEXT}: ${srcdir}/profile.c ../src/config.h
349 $(CC) ${ALL_CFLAGS} ${srcdir}/profile.c $(LOADLIBES) -o profile
350
351 make-docfile${EXEEXT}: ${srcdir}/make-docfile.c ../src/config.h
352 $(CC) ${ALL_CFLAGS} ${srcdir}/make-docfile.c $(LOADLIBES) \
353 -o make-docfile
354
355 movemail${EXEEXT}: movemail.o pop.o $(GETOPTDEPS)
356 $(CC) ${LINK_CFLAGS} ${MOVE_FLAGS} movemail.o pop.o \
357 $(GETOPTOBJS) $(LOADLIBES) $(LIBS_MOVE) -o movemail
358
359 movemail.o: ${srcdir}/movemail.c ../src/config.h $(GETOPT_H)
360 $(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/movemail.c
361
362 pop.o: ${srcdir}/pop.c ../src/config.h
363 $(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/pop.c
364
365 fakemail${EXEEXT}: ${srcdir}/fakemail.c ../src/config.h
366 $(CC) ${ALL_CFLAGS} ${srcdir}/fakemail.c $(LOADLIBES) -o fakemail
367
368 emacsclient${EXEEXT}: ${srcdir}/emacsclient.c ../src/config.h $(GETOPTDEPS)
369 $(CC) ${ALL_CFLAGS} ${srcdir}/emacsclient.c $(GETOPTOBJS) \
370 -DVERSION="\"${version}\"" \
371 $(LOADLIBES) -o emacsclient
372
373 hexl${EXEEXT}: ${srcdir}/hexl.c ../src/config.h
374 $(CC) ${ALL_CFLAGS} ${srcdir}/hexl.c $(LOADLIBES) -o hexl
375
376 update-game-score${EXEEXT}: update-game-score.o $(GETOPTDEPS)
377 $(CC) ${LINK_CFLAGS} update-game-score.o $(GETOPTOBJS) \
378 $(LOADLIBES) -o update-game-score
379
380 update-game-score.o: ${srcdir}/update-game-score.c ../src/config.h $(GETOPT_H)
381 $(CC) -c ${CPP_CFLAGS} ${srcdir}/update-game-score.c \
382 -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\""
383
384 ## Makefile ends here.