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