Minimize blessmail-related cpp usage, with an eye to future removal.
[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 Free Software 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 --multibyte
28
29 # ==================== Things `configure' will edit ====================
30
31 CC=@CC@
32 CFLAGS=@CFLAGS@
33 version=@version@
34 configuration=@configuration@
35 EXEEXT=@EXEEXT@
36 C_SWITCH_SYSTEM=@C_SWITCH_SYSTEM@
37 C_SWITCH_MACHINE=@C_SWITCH_MACHINE@
38
39 # Program name transformation.
40 TRANSFORM = @program_transform_name@
41
42 # ==================== Where To Install Things ====================
43
44 # The default location for installation. Everything is placed in
45 # subdirectories of this directory. The default values for many of
46 # the variables below are expressed in terms of this one, so you may
47 # not need to change them. This is set with the --prefix option to
48 # `../configure'.
49 prefix=@prefix@
50
51 # Like `prefix', but used for architecture-specific files. This is
52 # set with the --exec-prefix option to `../configure'.
53 exec_prefix=@exec_prefix@
54
55 # Where to install Emacs and other binaries that people will want to
56 # run directly (like etags). This is set with the --bindir option
57 # to `../configure'.
58 bindir=@bindir@
59
60 # Where to install and expect executable files to be run by Emacs
61 # rather than directly by users, and other architecture-dependent
62 # data. ${archlibdir} is usually below this. This is set with the
63 # --libexecdir option to `../configure'.
64 libexecdir=@libexecdir@
65
66 # Directory for local state files for all programs.
67 localstatedir=@localstatedir@
68
69 # Where to find the source code. This is set by the configure
70 # script's `--srcdir' option. However, the value of ${srcdir} in
71 # this makefile is not identical to what was specified with --srcdir,
72 # since the variable here has `/lib-src' added at the end.
73
74 # We use $(srcdir) explicitly in dependencies so as not to depend on VPATH.
75 srcdir=@srcdir@
76 VPATH=@srcdir@
77
78 # The top-level source directory, also set by configure.
79 top_srcdir=@top_srcdir@
80
81 # ==================== Emacs-specific directories ====================
82
83 # These variables hold the values Emacs will actually use. They are
84 # based on the values of the standard Make variables above.
85
86 # Where to put executables to be run by Emacs rather than the user.
87 # This path usually includes the Emacs version and configuration name,
88 # so that multiple configurations for multiple versions of Emacs may
89 # be installed at once. This can be set with the --archlibdir option
90 # to `../configure'.
91 archlibdir=@archlibdir@
92
93 gamedir=@gamedir@
94 gameuser=@gameuser@
95
96 # ==================== Utility Programs for the Build =================
97
98 # ../configure figures out the correct values for these.
99 INSTALL = @INSTALL@
100 INSTALL_PROGRAM = @INSTALL_PROGRAM@
101 INSTALL_DATA = @INSTALL_DATA@
102 INSTALL_SCRIPT = @INSTALL_SCRIPT@
103 # By default, we uphold the dignity of our programs.
104 INSTALL_STRIP =
105
106 # ========================== Lists of Files ===========================
107
108 # Things that a user might actually run,
109 # which should be installed in bindir.
110 INSTALLABLES = etags${EXEEXT} ctags${EXEEXT} emacsclient${EXEEXT} b2m${EXEEXT} ebrowse${EXEEXT} @LIB_SRC_EXTRA_INSTALLABLES@
111 INSTALLABLE_SCRIPTS = rcs-checkin grep-changelog
112
113 # Things that Emacs runs internally, or during the build process,
114 # which should not be installed in bindir.
115 UTILITIES= profile${EXEEXT} digest-doc${EXEEXT} sorted-doc${EXEEXT} \
116 movemail${EXEEXT} fakemail${EXEEXT} \
117 hexl${EXEEXT} update-game-score${EXEEXT}
118
119 DONT_INSTALL= test-distrib${EXEEXT} make-docfile${EXEEXT}
120
121 # Like UTILITIES, but they're not system-dependent, and should not be
122 # deleted by the distclean target.
123 SCRIPTS= rcs2log vcdiff
124
125 EXECUTABLES= ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}
126
127 # Specify additional -D flags for movemail. Options:
128 # -DMAIL_USE_FLOCK or -DMAIL_USE_LOCKF (use flock or lockf for file locking).
129 # See the comments about locking in movemail.c. Normally the values
130 # in ../src/[ms]/*.h should be correct and you should not need to do anything.
131 # If neither flag is set, blessmail is used.
132 MOVE_FLAGS=
133
134 ## May be reset below by cpp.
135 BLESSMAIL_TARGET=
136
137 ## -lkrb if HAVE_LIBKRB or -lkrb4 if HAVE_LIBKRB4
138 KRB4LIB=@KRB4LIB@
139 ## -ldes if HAVE_LIBDES or -ldes425 if HAVE_LIBDES425
140 DESLIB=@DESLIB@
141 ## -lkrb5 if HAVE_LIBKRB5
142 KRB5LIB=@KRB5LIB@
143 ## -lk5crypto if HAVE_LIBK5CRYPTO or -lcrypto if HAVE_LIBCRYPTO
144 CRYPTOLIB=@CRYPTOLIB@
145 ## -lcom_err if HAVE_LIBCOM_ERR
146 COM_ERRLIB=@COM_ERRLIB@
147 ## -lhesiod if HAVE_LIBHESIOD
148 LIBHESIOD=@LIBHESIOD@
149 ## -lresolv if HAVE_LIBRESOLV
150 LIBRESOLV=@LIBRESOLV@
151 ## -llockfile if HAVE_LIBLOCKFILE or -lmail if HAVE_LIBMAIL
152 LIBS_MAIL=@LIBS_MAIL@
153
154 ## Extra libraries to use when linking movemail.
155 LIBS_MOVE = $(LIBS_MAIL) $(KRB4LIB) $(DESLIB) $(KRB5LIB) $(CRYPTOLIB) $(COM_ERRLIB) $(LIBHESIOD) $(LIBRESOLV)
156
157 # Those files shared with other GNU utilities need HAVE_CONFIG_H
158 # defined before they know they can take advantage of the information
159 # in ../src/config.h.
160 ALL_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) -DHAVE_CONFIG_H -I. -I../src -I${srcdir} -I${srcdir}/../src ${LDFLAGS} ${CPPFLAGS} ${CFLAGS}
161 LINK_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) -DHAVE_CONFIG_H -I. -I../src -I${srcdir} -I${srcdir}/../src ${LDFLAGS} ${CFLAGS}
162 CPP_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) -DHAVE_CONFIG_H -I. -I../src -I${srcdir} -I${srcdir}/../src ${CPPFLAGS} ${CFLAGS}
163
164 # ========================== start of cpp stuff =======================
165 /* From here on, comments must be done in C syntax. */
166
167 #define THIS_IS_MAKEFILE
168 #define NOT_C_CODE
169 #include "../src/config.h"
170
171 /* Some s/SYSTEM.h files define this to request special libraries. */
172 #ifndef LIBS_SYSTEM
173 #define LIBS_SYSTEM
174 #endif
175 LOADLIBES=LIBS_SYSTEM
176
177 #ifndef MAIL_USE_FLOCK
178 #ifndef MAIL_USE_LOCKF
179 BLESSMAIL_TARGET = need-blessmail
180 #endif
181 #endif
182
183 \f
184 .SUFFIXES: .m
185
186 /* This is the default compilation command.
187 But we should never rely on it, because some make version
188 failed to find it for getopt.o.
189 Using an explicit command made it work. */
190 .c.o:
191 ${CC} -c ${CPP_CFLAGS} $<
192
193 .m.o:
194 $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $<
195
196 all: ${DONT_INSTALL} ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}
197
198 /* These targets copy the scripts into the build directory
199 so that they can be run from there in an uninstalled Emacs.
200 The "-" is prepended because some versions of cp barf when
201 srcdir is the current directory, and thus the file will be
202 copied into itself. */
203 rcs2log: $(srcdir)/rcs2log
204 -cp -p $(srcdir)/rcs2log rcs2log
205
206 rcs-checkin: $(srcdir)/rcs-checkin
207 -cp -p $(srcdir)/rcs-checkin rcs-checkin
208
209 grep-changelog: $(srcdir)/grep-changelog
210 -cp -p $(srcdir)/grep-changelog grep-changelog
211
212 vcdiff: $(srcdir)/vcdiff
213 -cp -p $(srcdir)/vcdiff vcdiff
214
215 /* Only used if we need blessmail, but no harm in always defining.
216 This makes the actual blessmail executable. */
217 blessmail:
218 $(EMACS) $(EMACSOPT) -l $(srcdir)/../lisp/mail/blessmail.el
219 chmod +x blessmail
220
221 /* This checks if we need to run blessmail. */
222 need-blessmail: blessmail
223 /* Don\'t charge ahead and do it! Let the installer decide.
224 ./blessmail $(DESTDIR)${archlibdir}/movemail${EXEEXT} */
225 @if [ `wc -l <blessmail` != 2 ] ; then \
226 dir=`sed -n -e 's/echo mail directory = \(.*\)/\1/p' blessmail`; \
227 echo Assuming $$dir is really the mail spool directory, you should; \
228 echo run lib-src/blessmail $(DESTDIR)${archlibdir}/movemail${EXEEXT}; \
229 echo as root, to give movemail${EXEEXT} appropriate permissions.; \
230 echo Do that after running make install.; \
231 fi
232
233 /* This is the target invoked by the top-level Makefile. */
234 maybe-blessmail: $(BLESSMAIL_TARGET)
235
236 /* Install the internal utilities. Until they are installed, we can
237 just run them directly from lib-src. */
238 $(DESTDIR)${archlibdir}: all
239 @echo
240 @echo "Installing utilities run internally by Emacs."
241 umask 022; $(top_srcdir)/mkinstalldirs $(DESTDIR)${archlibdir}
242 if [ `(cd $(DESTDIR)${archlibdir} && /bin/pwd)` != `/bin/pwd` ]; then \
243 for file in ${UTILITIES}; do \
244 $(INSTALL_PROGRAM) $(INSTALL_STRIP) $$file $(DESTDIR)${archlibdir}/$$file ; \
245 done ; \
246 fi
247 umask 022; $(top_srcdir)/mkinstalldirs $(DESTDIR)${gamedir}; \
248 touch $(DESTDIR)${gamedir}/snake-scores; \
249 touch $(DESTDIR)${gamedir}/tetris-scores
250 /* If the following commands fail, that is not a big deal.
251 update-game-score will detect at runtime that it is not setuid,
252 and handle things accordingly. */
253 -if chown ${gameuser} $(DESTDIR)${archlibdir}/update-game-score && chmod u+s $(DESTDIR)${archlibdir}/update-game-score; then \
254 chown ${gameuser} $(DESTDIR)${gamedir}; \
255 chmod u=rwx,g=rwx,o=rx $(DESTDIR)${gamedir}; \
256 fi
257 if [ `(cd $(DESTDIR)${archlibdir} && /bin/pwd)` \
258 != `(cd ${srcdir} && /bin/pwd)` ]; then \
259 for file in ${SCRIPTS}; do \
260 $(INSTALL_SCRIPT) ${srcdir}/$$file $(DESTDIR)${archlibdir}/$$file; \
261 done ; \
262 fi
263
264 install: $(DESTDIR)${archlibdir}
265 @echo
266 @echo "Installing utilities for users to run."
267 for file in ${INSTALLABLES} ; do \
268 $(INSTALL_PROGRAM) $(INSTALL_STRIP) $${file} $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \
269 chmod a+rx $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'`; \
270 done
271 for file in ${INSTALLABLE_SCRIPTS} ; do \
272 $(INSTALL_SCRIPT) ${srcdir}/$${file} $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \
273 chmod a+rx $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'`; \
274 done
275
276 uninstall:
277 (cd $(DESTDIR)${bindir}; \
278 for file in ${INSTALLABLES} ${INSTALLABLE_SCRIPTS}; do \
279 rm -f $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \
280 done)
281 if [ -d $(DESTDIR)${archlibdir} ]; then \
282 (cd $(DESTDIR)${archlibdir} && \
283 rm -f ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}) \
284 fi
285
286 mostlyclean:
287 -rm -f core *.o getopt.h getopt.h-t
288
289 clean: mostlyclean
290 -rm -f ${INSTALLABLES} ${UTILITIES} ${DONT_INSTALL}
291 -rm -f fns*.el *.tab.c *.tab.h
292
293 distclean: clean
294 -rm -f TAGS
295 -rm -f Makefile Makefile.c blessmail
296
297 maintainer-clean: distclean
298 true
299
300 extraclean: maintainer-clean
301 -rm -f *~ \#*
302
303 /* Test the contents of the directory. */
304 check:
305 @echo "We don't have any tests for GNU Emacs yet."
306
307 tags: TAGS
308 TAGS: etags${EXEEXT}
309 etags *.[ch]
310
311 /* This verifies that the non-ASCII characters in the file \`testfile\'
312 have not been clobbered by whatever means were used to copy and
313 distribute Emacs. If they were clobbered, all the .elc files were
314 clobbered too. */
315 test-distrib${EXEEXT}: ${srcdir}/test-distrib.c
316 $(CC) ${ALL_CFLAGS} -o test-distrib ${srcdir}/test-distrib.c
317 ./test-distrib ${srcdir}/testfile
318
319 /* We need the following in order to create a <getopt.h> when the system
320 does not have one that works with the given compiler. */
321 GETOPT_H = @GETOPT_H@
322 getopt.h: getopt_.h
323 cp $(srcdir)/getopt_.h $@-t
324 mv $@-t $@
325
326 GETOPTOBJS = @GETOPTOBJS@
327 GETOPTDEPS = $(GETOPTOBJS) $(GETOPT_H)
328 getopt.o: ${srcdir}/getopt.c $(GETOPT_H) ${srcdir}/gettext.h
329 ${CC} -c ${CPP_CFLAGS} ${srcdir}/getopt.c
330 getopt1.o: ${srcdir}/getopt1.c $(GETOPT_H)
331 ${CC} -c ${CPP_CFLAGS} ${srcdir}/getopt1.c
332
333 REGEXPOBJ = regex.o
334 REGEXPDEPS = $(REGEXPOBJ) $(srcdir)/../src/regex.h
335
336 regex.o: $(srcdir)/../src/regex.c $(srcdir)/../src/regex.h ../src/config.h
337 ${CC} -c ${CPP_CFLAGS} -DCONFIG_BROKETS -DINHIBIT_STRING_HEADER ${srcdir}/../src/regex.c
338
339 etags${EXEEXT}: ${srcdir}/etags.c $(GETOPTDEPS) $(REGEXPDEPS) ../src/config.h
340 $(CC) ${ALL_CFLAGS} -DEMACS_NAME="\"GNU Emacs\"" -DVERSION="\"${version}\"" ${srcdir}/etags.c $(GETOPTOBJS) $(REGEXPOBJ) $(LOADLIBES) -o etags
341
342 ebrowse${EXEEXT}: ${srcdir}/ebrowse.c $(GETOPTDEPS) ../src/config.h
343 $(CC) ${ALL_CFLAGS} -DVERSION="\"${version}\"" ${srcdir}/ebrowse.c $(GETOPTOBJS) $(LOADLIBES) -o ebrowse
344
345 /* We depend on etags to assure that parallel makes don\'t write two
346 etags.o files on top of each other. */
347 ctags${EXEEXT}: etags${EXEEXT}
348 $(CC) ${ALL_CFLAGS} -DCTAGS -DEMACS_NAME="\"GNU Emacs\"" -DVERSION="\"${version}\"" ${srcdir}/etags.c $(GETOPTOBJS) $(REGEXPOBJ) $(LOADLIBES) -o ctags
349
350 profile${EXEEXT}: ${srcdir}/profile.c ../src/config.h
351 $(CC) ${ALL_CFLAGS} ${srcdir}/profile.c $(LOADLIBES) -o profile
352
353 make-docfile${EXEEXT}: ${srcdir}/make-docfile.c ../src/config.h
354 $(CC) ${ALL_CFLAGS} ${srcdir}/make-docfile.c $(LOADLIBES) -o make-docfile
355
356 digest-doc${EXEEXT}: ${srcdir}/digest-doc.c
357 $(CC) ${ALL_CFLAGS} ${srcdir}/digest-doc.c $(LOADLIBES) -o digest-doc
358
359 sorted-doc${EXEEXT}: ${srcdir}/sorted-doc.c
360 $(CC) ${ALL_CFLAGS} ${srcdir}/sorted-doc.c $(LOADLIBES) -o sorted-doc
361
362 b2m${EXEEXT}: ${srcdir}/b2m.c ../src/config.h $(GETOPTDEPS)
363 $(CC) ${ALL_CFLAGS} ${srcdir}/b2m.c -DVERSION="\"${version}\"" \
364 $(GETOPTOBJS) $(LOADLIBES) -o b2m
365
366 movemail${EXEEXT}: movemail.o pop.o $(GETOPTDEPS)
367 $(CC) ${LINK_CFLAGS} ${MOVE_FLAGS} movemail.o pop.o $(GETOPTOBJS) $(LOADLIBES) $(LIBS_MOVE) -o movemail
368
369 /* We need to define emacs to get the right version of something (what?). */
370 movemail.o: ${srcdir}/movemail.c ../src/config.h $(GETOPT_H)
371 $(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/movemail.c
372
373 pop.o: ${srcdir}/pop.c ../src/config.h
374 $(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/pop.c
375
376 fakemail${EXEEXT}: ${srcdir}/fakemail.c ../src/config.h
377 $(CC) ${ALL_CFLAGS} ${srcdir}/fakemail.c $(LOADLIBES) -o fakemail
378
379 emacsclient${EXEEXT}: ${srcdir}/emacsclient.c ../src/config.h $(GETOPTDEPS)
380 $(CC) ${ALL_CFLAGS} ${srcdir}/emacsclient.c $(GETOPTOBJS) \
381 -DVERSION="\"${version}\"" \
382 $(LOADLIBES) -o emacsclient
383
384 hexl${EXEEXT}: ${srcdir}/hexl.c ../src/config.h
385 $(CC) ${ALL_CFLAGS} ${srcdir}/hexl.c $(LOADLIBES) -o hexl
386
387 update-game-score${EXEEXT}: update-game-score.o $(GETOPTDEPS)
388 $(CC) ${LINK_CFLAGS} ${MOVE_FLAGS} update-game-score.o $(GETOPTOBJS) $(LOADLIBES) -o update-game-score
389
390 update-game-score.o: ${srcdir}/update-game-score.c ../src/config.h $(GETOPT_H)
391 $(CC) -c ${CPP_CFLAGS} ${srcdir}/update-game-score.c \
392 -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\""