Use libexecdir and sharedstatedir as appropriate.
[bpt/emacs.git] / lib-src / Makefile.in
CommitLineData
eb4252f7
RS
1# Makefile for lib-src subdirectory in GNU Emacs.
2# Copyright (C) 1985, 1987, 1988, 1993, 1994 Free Software Foundation, Inc.
29ed0542 3
eb4252f7 4# This file is part of GNU Emacs.
29ed0542 5
eb4252f7
RS
6# GNU Emacs is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 2, or (at your option)
9# any later version.
29ed0542 10
eb4252f7
RS
11# GNU Emacs is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
29ed0542 15
eb4252f7
RS
16# You should have received a copy of the GNU General Public License
17# along with GNU Emacs; see the file COPYING. If not, write to
18# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
29ed0542 19
eb4252f7
RS
20# Avoid trouble on systems where the `SHELL' variable might be
21# inherited from the environment.
f7dbcf3c
JB
22SHELL = /bin/sh
23
eb4252f7 24# ==================== Things `configure' will edit ====================
c71beb75 25
b93f2493
BF
26CC=@CC@
27CFLAGS=@CFLAGS@
28ALLOCA=@ALLOCA@
b93f2493
BF
29YACC=@YACC@
30version=@version@
cf770692 31configuration=@configuration@
c71beb75 32
eb4252f7 33# ==================== Where To Install Things ====================
c71beb75 34
eb4252f7
RS
35# The default location for installation. Everything is placed in
36# subdirectories of this directory. The default values for many of
37# the variables below are expressed in terms of this one, so you may
38# not need to change them. This is set with the --prefix option to
39# `../configure'.
b93f2493 40prefix=@prefix@
c71beb75 41
eb4252f7
RS
42# Like `prefix', but used for architecture-specific files. This is
43# set with the --exec-prefix option to `../configure'.
b93f2493 44exec_prefix=@exec_prefix@
c71beb75 45
eb4252f7
RS
46# Where to install Emacs and other binaries that people will want to
47# run directly (like etags). This is set with the --bindir option
48# to `../configure'.
b93f2493 49bindir=@bindir@
c71beb75 50
eb4252f7
RS
51# Where to install and expect executable files to be run by Emacs
52# rather than directly by users, and other architecture-dependent
53# data. ${archlibdir} is usually below this. This is set with the
54# --libdir option to `../configure'.
b93f2493 55libdir=@libdir@
c71beb75 56
eb4252f7
RS
57# Where to find the source code. This is set by the configure
58# script's `--srcdir' option. However, the value of ${srcdir} in
59# this makefile is not identical to what was specified with --srcdir,
60# since the variable here has `/lib-src' added at the end.
b93f2493
BF
61srcdir=@srcdir@
62VPATH=@srcdir@
c71beb75 63
eb4252f7 64# ==================== Emacs-specific directories ====================
c71beb75 65
eb4252f7
RS
66# These variables hold the values Emacs will actually use. They are
67# based on the values of the standard Make variables above.
c71beb75 68
eb4252f7
RS
69# Where to put executables to be run by Emacs rather than the user.
70# This path usually includes the Emacs version and configuration name,
71# so that multiple configurations for multiple versions of Emacs may
72# be installed at once. This can be set with the --archlibdir option
73# to `../configure'.
b93f2493 74archlibdir=@archlibdir@
41f86d5a 75
eb4252f7 76# ==================== Utility Programs for the Build =================
c71beb75 77
eb4252f7 78# ../configure figures out the correct values for these.
b93f2493 79INSTALL = @INSTALL@
b93f2493
BF
80INSTALL_PROGRAM = @INSTALL_PROGRAM@
81INSTALL_DATA = @INSTALL_DATA@
c71beb75 82
eb4252f7 83# ========================== Lists of Files ===========================
f7dbcf3c 84
eb4252f7
RS
85# Things that a user might actually run,
86# which should be installed in bindir.
0d73e8e3
JB
87INSTALLABLES = etags ctags emacsclient b2m
88INSTALLABLE_SCRIPTS = rcs-checkin
f7dbcf3c 89
eb4252f7
RS
90# Things that Emacs runs internally, or during the build process,
91# which should not be installed in bindir.
5aae6601 92UTILITIES= wakeup profile digest-doc \
62039e5a 93 sorted-doc movemail cvtmail fakemail yow emacsserver hexl timer
f7dbcf3c 94
5aae6601
RS
95DONT_INSTALL= test-distrib make-docfile make-path
96
eb4252f7
RS
97# Like UTILITIES, but they're not system-dependent, and should not be
98# deleted by the distclean target.
b7cceaf1
JB
99SCRIPTS= rcs2log vcdiff
100
0d73e8e3 101EXECUTABLES= ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}
f7dbcf3c 102
41f86d5a
ER
103SOURCES = COPYING ChangeLog Makefile.in README aixcc.lex emacs.csh \
104 makedoc.com *.[chy] rcs2log vcdiff
105
81f94052
RS
106# Additional -D flags for movemail (add to MOVE_FLAGS if desired):
107# MAIL_USE_POP Support mail retrieval from a POP mailbox.
108# MAIL_USE_MMDF Support MMDF mailboxes.
109# MAIL_USE_FLOCK Use flock for file locking (see the comments
110# about locking in movemail.c)
111# MAIL_UNLINK_SPOOL Unlink the user's spool mailbox after reading
112# it (instead of just emptying it).
113# KERBEROS Support Kerberized POP.
114# KRB5 Support Kerberos Version 5 pop instead of
115# Version 4 (define this in addition to
116# KERBEROS).
117# HESIOD Support Hesiod lookups of user mailboxes.
118# MAILHOST A string, the host name of the default POP
119# mail host for the site.
120MOVE_FLAGS=
121
122# Additional libraries for movemail:
123# For KERBEROS
124# MOVE_LIBS= -lkrb -ldes -lcom_err
125# For KERBEROS + KRB5
126# MOVE_LIBS= -lkrb5 -lcrypto -lisode -lcom_err
127# Add "-lhesiod" if HESIOD is defined.
128MOVE_LIBS=
129
eb4252f7
RS
130# ========================== start of cpp stuff =======================
131/* From here on, comments must be done in C syntax. */
132
133#define NO_SHORTNAMES
134#define THIS_IS_YMAKEFILE
135#define NOT_C_CODE
136#include "../src/config.h"
137
89b3f894
RS
138/* We won't really call alloca;
139 don't let the file name alloca.c get messed up. */
140#ifdef alloca
141#undef alloca
142#endif
143
eb4252f7
RS
144/* Some s/*.h files define this to request special libraries. */
145#ifndef LIBS_SYSTEM
146#define LIBS_SYSTEM
147#endif
148
149/* Some m/*.h files define this to request special libraries. */
150#ifndef LIBS_MACHINE
151#define LIBS_MACHINE
152#endif
153
154#ifndef C_SWITCH_SYSTEM
155#define C_SWITCH_SYSTEM
156#endif
157
158#ifndef C_SWITCH_MACHINE
159#define C_SWITCH_MACHINE
160#endif
161
162#undef MOVEMAIL_NEEDS_BLESSING
163#ifndef MAIL_USE_FLOCK
164#ifndef MAIL_USE_LOCKF
165#define MOVEMAIL_NEEDS_BLESSING
166#endif
167#endif
168
169#ifdef MOVEMAIL_NEEDS_BLESSING
170#define BLESSMAIL blessmail
171#else
172#define BLESSMAIL
173#endif
174
175LOADLIBES=LIBS_SYSTEM LIBS_MACHINE
176
29ed0542
RS
177/* We need to #define emacs to get the right versions of some files.
178 Some other files - those shared with other GNU utilities - need
179 HAVE_CONFIG_H #defined before they know they can take advantage of
180 the information in ../src/config.h. */
82a635f3 181ALL_CFLAGS = C_SWITCH_SYSTEM C_SWITCH_MACHINE -Demacs -DHAVE_CONFIG_H \
3e883207 182 -I. -I../src -I${srcdir} -I${srcdir}/../src ${LDFLAGS} ${CPPFLAGS} ${CFLAGS}
82a635f3 183LINK_CFLAGS = C_SWITCH_SYSTEM C_SWITCH_MACHINE -Demacs -DHAVE_CONFIG_H \
3e883207 184 -I. -I../src -I${srcdir} -I${srcdir}/../src ${LDFLAGS} ${CFLAGS}
82a635f3 185CPP_CFLAGS = C_SWITCH_SYSTEM C_SWITCH_MACHINE -Demacs -DHAVE_CONFIG_H \
b2d7a9c7 186 -I. -I../src -I${srcdir} -I${srcdir}/../src ${CPPFLAGS} ${CFLAGS}
20cda85b
RS
187ALLOCA_CFLAGS = C_SWITCH_SYSTEM C_SWITCH_MACHINE -DHAVE_CONFIG_H \
188 -I. -I../src -I${srcdir} -I${srcdir}/../src ${CPPFLAGS} ${CFLAGS}
29ed0542
RS
189\f
190/* This is the default compilation command.
191 But we should never rely on it, because some make version
192 failed to find it for getopt.o.
193 Using an explicit command made it work. */
c38a040d 194.c.o:
5293b432 195 ${CC} -c ${CPP_CFLAGS} $<
c71beb75 196
4eda59a9 197all: ${UTILITIES} ${INSTALLABLES}
c71beb75 198
c6207d0d 199#ifdef MOVEMAIL_NEEDS_BLESSING
f675ecb5 200blessmail:
2b243866 201 ../src/emacs -batch -l ../lisp/blessmail.el
c6207d0d
KH
202 chmod +x blessmail
203#endif
204
d19f95fe
RS
205maybe-blessmail: BLESSMAIL
206#ifdef MOVEMAIL_NEEDS_BLESSING
207/* Don't charge ahead and do it! Let the installer decide.
208 ./blessmail ${archlibdir}/movemail */
209 @if [ `wc -l <blessmail` != 2 ] ; then \
210 dir=`sed -n -e 's/echo mail directory = \(.*\)/\1/p' blessmail`; \
211 echo Assuming $$dir is really the mail spool directory, you should; \
fed76e78 212 echo run lib-src/blessmail ${archlibdir}/movemail; \
d19f95fe 213 echo as root, to give movemail appropriate permissions.; \
eb4252f7 214 echo Do that after running make install.; \
d19f95fe
RS
215 fi
216#endif
217
29ed0542
RS
218/* Install the internal utilities. Until they are installed, we can
219 just run them directly from lib-src. */
d19f95fe 220${archlibdir}: all
c71beb75
JB
221 @echo
222 @echo "Installing utilities run internally by Emacs."
223 ./make-path ${archlibdir}
f7d3e7d0 224 if [ `(cd ${archlibdir} && /bin/pwd)` != `/bin/pwd` ]; then \
544d556f 225 for file in ${UTILITIES}; do \
4ef7b413 226 (cd ..; $(INSTALL_PROGRAM) lib-src/$$file ${archlibdir}/$$file) ; \
544d556f 227 done ; \
ad600343
RS
228 fi
229 if [ `(cd ${archlibdir} && /bin/pwd)` \
230 != `(cd ${srcdir} && /bin/pwd)` ]; then \
544d556f 231 for file in ${SCRIPTS}; do \
4ef7b413 232 (cd ..; $(INSTALL_PROGRAM) ${srcdir}/$$file ${archlibdir}/$$file); \
c71beb75 233 done ; \
0268f19b 234 fi
f7dbcf3c 235
29ed0542
RS
236/* We don't need to install `wakeup' explicitly, because it will be
237 copied when this whole directory is copied. */
c71beb75
JB
238install: ${archlibdir}
239 @echo
240 @echo "Installing utilities for users to run."
b70cff71 241 for file in ${INSTALLABLES} ; do \
4ef7b413 242 (cd ..; $(INSTALL_PROGRAM) lib-src/$${file} ${bindir}/$${file}) ; \
0268f19b 243 done
b70cff71 244 for file in ${INSTALLABLE_SCRIPTS} ; do \
4ef7b413 245 (cd ..; $(INSTALL_PROGRAM) ${srcdir}/$${file} ${bindir}/$${file}) ; \
0268f19b 246 done
f7dbcf3c 247
39b649dd
JB
248uninstall:
249 (cd ${bindir}; \
250 rm -f ${INSTALLABLES} ${INSTALLABLE_SCRIPTS})
251 (cd ${archlibdir}; \
252 rm -f ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS})
253
a17d2c25
RS
254mostlyclean:
255 -rm -f core *.o
256
257clean: mostlyclean
5aae6601 258 -rm -f ${INSTALLABLES} ${UTILITIES} ${DONT_INSTALL}
1e8259bb 259 -rm -f ../etc/DOC* *.tab.c *.tab.h
f7dbcf3c 260
39b649dd 261distclean: clean
1e8259bb 262 -rm -f aixcc.c TAGS
348c8c1b 263 -rm -f Makefile Makefile.in blessmail
f7dbcf3c
JB
264
265realclean: distclean
39b649dd 266 true
c71beb75
JB
267
268extraclean: realclean
269 -rm -f *~ \#*
f7dbcf3c 270
41f86d5a
ER
271unlock:
272 chmod u+w $(SOURCES)
273
274relock:
275 chmod u-w $(SOURCES)
276
29ed0542 277/* Test the contents of the directory. */
f7dbcf3c
JB
278check:
279 @echo "We don't have any tests for GNU Emacs yet."
280
281TAGS: etags
282 etags *.[ch]
283
29ed0542
RS
284/* This verifies that the non-ASCII characters in the file `testfile'
285 have not been clobbered by whatever means were used to copy and
286 distribute Emacs. If they were clobbered, all the .elc files were
287 clobbered too. */
0d73e8e3 288test-distrib: ${srcdir}/test-distrib.c
c88a7f88 289 $(CC) ${ALL_CFLAGS} -o test-distrib ${srcdir}/test-distrib.c
0d73e8e3 290 ./test-distrib ${srcdir}/testfile
f7dbcf3c 291
c38a040d 292GETOPTOBJS = getopt.o getopt1.o $(ALLOCA)
0d73e8e3 293GETOPTDEPS = $(GETOPTOBJS) ${srcdir}/getopt.h
b90589d8 294getopt.o: ${srcdir}/getopt.c ${srcdir}/getopt.h
0268f19b 295 ${CC} -c ${CPP_CFLAGS} ${srcdir}/getopt.c
b90589d8 296getopt1.o: ${srcdir}/getopt1.c ${srcdir}/getopt.h
0268f19b 297 ${CC} -c ${CPP_CFLAGS} ${srcdir}/getopt1.c
20cda85b
RS
298alloca.o: ${srcdir}/alloca.c
299 ${CC} -c ${ALLOCA_CFLAGS} ${srcdir}/alloca.c
f7dbcf3c 300
755f5c87 301etags: ${srcdir}/etags.c $(GETOPTDEPS) ../src/config.h
9076a6fc 302 $(CC) ${ALL_CFLAGS} -DVERSION="\"${version}\"" ${srcdir}/etags.c $(GETOPTOBJS) $(LOADLIBES) -o etags
f7dbcf3c 303
29ed0542
RS
304/* We depend on etags to assure that parallel makes don't write two
305 etags.o files on top of each other. */
4348b379 306ctags: ${srcdir}/etags.c $(GETOPTDEPS) etags
9076a6fc 307 $(CC) ${ALL_CFLAGS} -DCTAGS -DVERSION="\"${version}\"" ${srcdir}/etags.c $(GETOPTOBJS) $(LOADLIBES) -o ctags
f7dbcf3c 308
0d73e8e3 309wakeup: ${srcdir}/wakeup.c
3e883207 310 $(CC) ${ALL_CFLAGS} ${srcdir}/wakeup.c $(LOADLIBES) -o wakeup
f7dbcf3c 311
379fb9c8
RS
312profile: ${srcdir}/profile.c
313 $(CC) ${ALL_CFLAGS} ${srcdir}/profile.c $(LOADLIBES) -o profile
314
0d73e8e3 315make-docfile: ${srcdir}/make-docfile.c
3e883207 316 $(CC) ${ALL_CFLAGS} ${srcdir}/make-docfile.c $(LOADLIBES) -o make-docfile
f7dbcf3c 317
0d73e8e3 318digest-doc: ${srcdir}/digest-doc.c
3e883207 319 $(CC) ${ALL_CFLAGS} ${srcdir}/digest-doc.c $(LOADLIBES) -o digest-doc
f7dbcf3c 320
1e3255d8 321sorted-doc: ${srcdir}/sorted-doc.c ${ALLOCA}
3e883207 322 $(CC) ${ALL_CFLAGS} ${srcdir}/sorted-doc.c ${ALLOCA} $(LOADLIBES) -o sorted-doc
f7dbcf3c 323
0d73e8e3 324b2m: ${srcdir}/b2m.c ../src/config.h
3e883207 325 $(CC) ${ALL_CFLAGS} ${srcdir}/b2m.c $(LOADLIBES) -o b2m
f7dbcf3c 326
81f94052
RS
327movemail: movemail.o pop.o
328 $(CC) ${LINK_CFLAGS} ${MOVE_FLAGS} movemail.o pop.o $(LOADLIBES) $(MOVE_LIBS) -o movemail
329
330movemail.o: ${srcdir}/movemail.c ../src/config.h
331 $(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/movemail.c
332
333pop.o: ${srcdir}/pop.c
334 $(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/pop.c
f7dbcf3c 335
0d73e8e3 336cvtmail: ${srcdir}/cvtmail.c
3e883207 337 $(CC) ${ALL_CFLAGS} ${srcdir}/cvtmail.c $(LOADLIBES) -o cvtmail
f7dbcf3c 338
0d73e8e3 339fakemail: ${srcdir}/fakemail.c ../src/config.h
3e883207 340 $(CC) ${ALL_CFLAGS} ${srcdir}/fakemail.c $(LOADLIBES) -o fakemail
f7dbcf3c 341
0d73e8e3 342yow: ${srcdir}/yow.c ../src/paths.h
3e883207 343 $(CC) ${ALL_CFLAGS} ${srcdir}/yow.c $(LOADLIBES) -o yow
f7dbcf3c 344
0d73e8e3 345emacsserver: ${srcdir}/emacsserver.c ../src/config.h
3e883207 346 $(CC) ${ALL_CFLAGS} ${srcdir}/emacsserver.c $(LOADLIBES) -o emacsserver
f7dbcf3c 347
0d73e8e3 348emacsclient: ${srcdir}/emacsclient.c ../src/config.h
3e883207 349 $(CC) ${ALL_CFLAGS} ${srcdir}/emacsclient.c $(LOADLIBES) -o emacsclient
f7dbcf3c 350
0d73e8e3 351hexl: ${srcdir}/hexl.c
3e883207 352 $(CC) ${ALL_CFLAGS} ${srcdir}/hexl.c $(LOADLIBES) -o hexl
f7dbcf3c 353
9ff5de07 354TIMEROBJS=getdate.o timer.o $(ALLOCA)
0d73e8e3
JB
355getdate.o: ${srcdir}/getdate.y ../src/config.h
356 ${YACC} ${YFLAGS} ${srcdir}/getdate.y
eab5f4fd 357 $(CC) $(CPP_CFLAGS) -c y.tab.c
43bf8b0e 358 mv y.tab.o getdate.o
0d73e8e3 359timer.o: ${srcdir}/timer.c ../src/config.h
eab5f4fd 360 $(CC) -c $(CPP_CFLAGS) ${srcdir}/timer.c
9ff5de07 361timer: ${TIMEROBJS}
3e883207 362 $(CC) $(LINK_CFLAGS) ${TIMEROBJS} $(LOADLIBES) -o timer
f7dbcf3c 363
a0697435 364make-path: ${srcdir}/make-path.c ../src/config.h
3e883207 365 $(CC) $(ALL_CFLAGS) ${srcdir}/make-path.c -o make-path
ecc798b0 366
29ed0542 367/* These are NOT included in INSTALLABLES or UTILITIES.
1858a206 368 See ../src/Makefile.in.in. */
0d73e8e3 369emacstool: ${srcdir}/emacstool.c
3e883207 370 $(CC) ${srcdir}/emacstool.c -o emacstool ${ALL_CFLAGS} \
f7dbcf3c
JB
371 -lsuntool -lsunwindow -lpixrect $(LOADLIBES)
372
29ed0542 373/* For SUN Japanese Language Environment. */
0d73e8e3 374nemacstool: ${srcdir}/emacstool.c
3e883207 375 $(CC) -o nemacstool -DJLE ${ALL_CFLAGS} ${srcdir}/emacstool.c \
f7dbcf3c
JB
376 -lsuntool -lmle -lsunwindow -lpixrect $(LOADLIBES)
377
0d73e8e3 378xvetool: ${srcdir}/emacstool.c
3e883207 379 $(CC) -o xvetool -DXVIEW ${ALL_CFLAGS} ${srcdir}/emacstool.c \
f7dbcf3c
JB
380 -lxview -lX -I$(OPENWINHOME)/include -L$(OPENWINHOME)/lib \
381 $(LOADLIBES)
382
0d73e8e3 383xveterm: ${srcdir}/emacstool.c
3e883207 384 $(CC) -o xveterm -DXVIEW -DTTERM ${ALL_CFLAGS} ${srcdir}/emacstool.c \
f7dbcf3c
JB
385 -lxview -lolgx -lX -I$(OPENWINHOME)/include -L$(OPENWINHOME)/lib \
386 $(LOADLIBES)
387
0d73e8e3 388aixcc: ${srcdir}/aixcc.c
3e883207 389 $(CC) $(ALL_CFLAGS) -o aixcc ${srcdir}/aixcc.c
f7dbcf3c 390
0d73e8e3
JB
391aixcc.c: ${srcdir}/aixcc.lex
392 lex ${srcdir}/aixcc.lex
f7dbcf3c 393 mv lex.yy.c aixcc.c