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