* Makefile.in (CPP): New variable.
[bpt/emacs.git] / lib-src / Makefile.in
CommitLineData
f7dbcf3c
JB
1# DIST: This is the distribution Makefile for Emacs. configure can
2# DIST: make most of the changes to this file you might want, so try
3# DIST: that first.
4
5# add -DUSG for SysV movemail and timer
6# For Xenix, add the following for movemail:
7# LOADLIBES= -lx
8# For Mips, the following is needed for who knows what.
9# LOADLIBES = -lmld /usr/bsd43/usr/lib/libc.a
10
11# Avoid trouble on systems where the `SHELL' variable might be
12# inherited from the environment.
13SHELL = /bin/sh
14
c71beb75
JB
15# ==================== Things `configure' might edit ====================
16
17CC=cc
c38a040d
JB
18CFLAGS=-g
19ALLOCA=
c6b81ef2 20C_SWITCH_SYSTEM=
c71beb75 21LOADLIBES=
4b5a51c1 22YACC=yacc
c71beb75
JB
23version=version-not-set
24configname=configuration-name-not-set
25
26# ==================== Where To Install Things ====================
27
28# The default location for installation. Everything is placed in
29# subdirectories of this directory. The default values for many of
30# the variables below are expressed in terms of this one, so you may
31# not need to change them.
32prefix=/usr/local
33
34# Like `prefix', but used for architecture-specific files.
35exec_prefix=${prefix}
36
37# Where to install Emacs and other binaries that people will want to
38# run directly (like etags).
39bindir=${exec_prefix}/bin
40
41# Where to install and expect executable files to be run by Emacs
42# rather than directly by users, and other architecture-dependent
43# data. ${archlibdir} is usually below this.
44libdir=${exec_prefix}/lib
45
3d3bd052 46# Where to find the source code. This is
c71beb75 47# set by the configure script's `--srcdir' option.
3d3bd052
RS
48# However, the value of ${srcdir} in this makefile
49# is not identical to what was specified with --srcdir.
50# The variable here has `/lib-src' added at the end.
0d73e8e3
JB
51srcdir=@srcdir@/lib-src
52VPATH=@srcdir@/lib-src
c71beb75
JB
53
54# ==================== Emacs-specific directories ====================
55
56# These variables hold the values Emacs will actually use. They are
57# based on the values of the standard Make variables above.
58
59# Where to put executables to be run by Emacs rather than the user.
60# This path usually includes the Emacs version and configuration name,
61# so that multiple configurations for multiple versions of Emacs may
62# be installed at once.
63archlibdir=${libdir}/emacs/${version}/${configname}
64
41f86d5a
ER
65# ====================== Developer's configuration =======================
66
67# The following assignments make sense if you're running Emacs on a single
68# machine, one version at a time, and you want changes to the lisp and etc
69# directories in the source tree to show up immediately in your working
70# environment. It saves a great deal of disk space by not duplicating the
71# lisp and etc directories.
72#
73# archlibdir=${srcdir}/bin
74
c71beb75
JB
75# ==================== Utility Programs for the Build ====================
76
f7dbcf3c
JB
77# Allow the user to specify the install program.
78INSTALL = install
c71beb75
JB
79INSTALLFLAGS = -c
80INSTALL_PROGRAM = ${INSTALL}
81INSTALL_DATA = ${INSTALL}
82
83# ============================= Targets ==============================
f7dbcf3c 84
b7cceaf1 85# Things that a user might actually run, which should be installed in bindir.
0d73e8e3
JB
86INSTALLABLES = etags ctags emacsclient b2m
87INSTALLABLE_SCRIPTS = rcs-checkin
f7dbcf3c 88
b7cceaf1
JB
89# Things that Emacs runs internally, or during the build process,
90# which should not be installed in bindir.
c71beb75 91UTILITIES= test-distrib make-path wakeup make-docfile digest-doc sorted-doc \
b7cceaf1 92 movemail cvtmail fakemail yow env emacsserver hexl timer
f7dbcf3c 93
b7cceaf1
JB
94# Like UTILITIES, but they're not system-dependent, and should not be
95# deleted by the distclean target.
96SCRIPTS= rcs2log vcdiff
97
0d73e8e3 98EXECUTABLES= ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}
f7dbcf3c 99
41f86d5a
ER
100SOURCES = COPYING ChangeLog Makefile.in README aixcc.lex emacs.csh \
101 makedoc.com *.[chy] rcs2log vcdiff
102
c71beb75
JB
103### We need to #define emacs to get the right versions of some files.
104### Some other files - those shared with other GNU utilities - need
105### HAVE_CONFIG_H #defined before they know they can take advantage of
106### the information in ../src/config.h.
c93341d5 107ALL_CFLAGS = ${C_SWITCH_SYSTEM} -Demacs -DHAVE_CONFIG_H \
4fa84f6b 108 -I${srcdir} -I${srcdir}/../src -I. -I../src ${CFLAGS}
5293b432
RS
109CPP_CFLAGS = ${C_SWITCH_SYSTEM} -Demacs -DHAVE_CONFIG_H \
110 -I${srcdir} -I${srcdir}/../src -I. -I../src ${CPPFLAGS} ${CFLAGS}
111# This is the default compilation command.
112# But we should never rely on it, because some make version
113# failed to find it for getopt.o. Using an explicit command made it work.
c38a040d 114.c.o:
5293b432 115 ${CC} -c ${CPP_CFLAGS} $<
c71beb75 116
4eda59a9 117all: ${UTILITIES} ${INSTALLABLES}
c71beb75
JB
118
119### Install the internal utilities. Until they are installed, we can
120### just run them directly from lib-src.
121${archlibdir}: all
122 @echo
123 @echo "Installing utilities run internally by Emacs."
124 ./make-path ${archlibdir}
f7d3e7d0 125 if [ `(cd ${archlibdir} && /bin/pwd)` != `/bin/pwd` ]; then \
0d73e8e3
JB
126 for file in ${UTILITIES} ${INSTALLABLES}; do \
127 cp $${file} ${archlibdir} ; \
128 chmod 755 ${archlibdir}/$${file} ; \
129 done ; \
130 cd ${srcdir}; for file in ${SCRIPTS} ${INSTALLABLE_SCRIPTS}; do \
c71beb75
JB
131 cp $${file} ${archlibdir} ; \
132 chmod 755 ${archlibdir}/$${file} ; \
133 done ; \
134 fi
135 @echo
136 @echo "Changing the owner and group of Emacs's utility programs to \`bin'."
137 @echo "(You may ignore errors here if you don't care about this.)"
138 -for file in ${EXECUTABLES} ; do \
139 chgrp bin ${archlibdir}/$${file} ; \
140 chown bin ${archlibdir}/$${file} ; \
f7dbcf3c
JB
141 done
142
143# We don't need to install `wakeup' explicitly, because it will be copied when
144# this whole directory is copied.
c71beb75
JB
145install: ${archlibdir}
146 @echo
147 @echo "Installing utilities for users to run."
b70cff71 148 for file in ${INSTALLABLES} ; do \
c71beb75
JB
149 cp $${file} ${bindir}/$${file}.new ; \
150 chmod 755 ${bindir}/$${file}.new ; \
151 done
b70cff71
RS
152 for file in ${INSTALLABLE_SCRIPTS} ; do \
153 cp ${srcdir}/$${file} ${bindir}/$${file}.new ; \
154 chmod 755 ${bindir}/$${file}.new ; \
155 done
c71beb75
JB
156 @echo
157 @echo "Changing the owner and group of utility programs to \`bin'."
158 @echo "(You may ignore errors here if you don't care about this.)"
5e231e70 159 -for file in ${INSTALLABLES} ${INSTALLABLE_SCRIPTS} ; do \
c71beb75
JB
160 chgrp bin ${bindir}/$${file}.new ; \
161 chown bin ${bindir}/$${file}.new ; \
3d3bd052 162 rm -f ${bindir}/$${file} ; \
c71beb75
JB
163 mv ${bindir}/$${file}.new ${bindir}/$${file} ; \
164 done
f7dbcf3c
JB
165
166clean mostlyclean:
b7cceaf1 167 -rm -f ${INSTALLABLES} ${UTILITIES} core *.o
f7dbcf3c
JB
168
169distclean:
c71beb75 170 -rm -f ${INSTALLABLES} ${UTILITIES} ../etc/DOC* core *.o
f7dbcf3c
JB
171
172realclean: distclean
c71beb75
JB
173 -rm TAGS aixcc.c
174
175extraclean: realclean
176 -rm -f *~ \#*
f7dbcf3c 177
41f86d5a
ER
178unlock:
179 chmod u+w $(SOURCES)
180
181relock:
182 chmod u-w $(SOURCES)
183
f7dbcf3c
JB
184# Test the contents of the directory.
185check:
186 @echo "We don't have any tests for GNU Emacs yet."
187
188TAGS: etags
189 etags *.[ch]
190
191# This verifies that the non-ASCII characters in the file `testfile'
192# have not been clobbered by whatever means were used to copy and
193# distribute Emacs. If they were clobbered, all the .elc files were
194# clobbered too.
0d73e8e3
JB
195test-distrib: ${srcdir}/test-distrib.c
196 $(CC) -o test-distrib ${srcdir}/test-distrib.c
197 ./test-distrib ${srcdir}/testfile
f7dbcf3c 198
c38a040d 199GETOPTOBJS = getopt.o getopt1.o $(ALLOCA)
0d73e8e3 200GETOPTDEPS = $(GETOPTOBJS) ${srcdir}/getopt.h
b90589d8 201getopt.o: ${srcdir}/getopt.c ${srcdir}/getopt.h
5293b432 202 ${CC} -c ${CPP_CFLAGS} ${srcdir}/getopt.c
b90589d8 203getopt1.o: ${srcdir}/getopt1.c ${srcdir}/getopt.h
5293b432 204 ${CC} -c ${CPP_CFLAGS} ${srcdir}/getopt1.c
f7dbcf3c 205
0d73e8e3 206etags: ${srcdir}/etags.c $(GETOPTDEPS)
5293b432 207 $(CC) ${CPP_CFLAGS} -DETAGS ${srcdir}/etags.c $(GETOPTOBJS) $(LOADLIBES) -o etags
f7dbcf3c 208
0d73e8e3 209ctags: ${srcdir}/etags.c $(GETOPTDEPS)
5293b432 210 $(CC) ${CPP_CFLAGS} -DCTAGS ${srcdir}/etags.c $(GETOPTOBJS) $(LOADLIBES) -o ctags
f7dbcf3c 211
0d73e8e3 212wakeup: ${srcdir}/wakeup.c
5293b432 213 $(CC) ${CPP_CFLAGS} ${srcdir}/wakeup.c $(LOADLIBES) -o wakeup
f7dbcf3c 214
0d73e8e3 215make-docfile: ${srcdir}/make-docfile.c
5293b432 216 $(CC) ${CPP_CFLAGS} ${srcdir}/make-docfile.c $(LOADLIBES) -o make-docfile
f7dbcf3c 217
0d73e8e3 218digest-doc: ${srcdir}/digest-doc.c
5293b432 219 $(CC) ${CPP_CFLAGS} ${srcdir}/digest-doc.c $(LOADLIBES) -o digest-doc
f7dbcf3c 220
1e3255d8 221sorted-doc: ${srcdir}/sorted-doc.c ${ALLOCA}
5293b432 222 $(CC) ${CPP_CFLAGS} ${srcdir}/sorted-doc.c ${ALLOCA} $(LOADLIBES) -o sorted-doc
f7dbcf3c 223
0d73e8e3 224b2m: ${srcdir}/b2m.c ../src/config.h
5293b432 225 $(CC) -I${srcdir}/../src ${CPP_CFLAGS} ${srcdir}/b2m.c $(LOADLIBES) -o b2m
f7dbcf3c 226
0d73e8e3 227movemail: ${srcdir}/movemail.c ../src/config.h
5293b432 228 $(CC) -I${srcdir}/../src ${CPP_CFLAGS} ${srcdir}/movemail.c $(LOADLIBES) -o movemail
f7dbcf3c 229
0d73e8e3 230cvtmail: ${srcdir}/cvtmail.c
5293b432 231 $(CC) ${CPP_CFLAGS} ${srcdir}/cvtmail.c $(LOADLIBES) -o cvtmail
f7dbcf3c 232
0d73e8e3 233fakemail: ${srcdir}/fakemail.c ../src/config.h
5293b432 234 $(CC) -I${srcdir}/../src ${CPP_CFLAGS} ${srcdir}/fakemail.c $(LOADLIBES) -o fakemail
f7dbcf3c 235
0d73e8e3 236yow: ${srcdir}/yow.c ../src/paths.h
5293b432 237 $(CC) ${CPP_CFLAGS} ${srcdir}/yow.c $(LOADLIBES) -o yow
f7dbcf3c 238
0d73e8e3 239env: ${srcdir}/env.c ../src/config.h
5293b432 240 $(CC) -DEMACS -I${srcdir}/../src ${CPP_CFLAGS} ${srcdir}/env.c $(LOADLIBES) -o env
f7dbcf3c 241
0d73e8e3 242emacsserver: ${srcdir}/emacsserver.c ../src/config.h
5293b432 243 $(CC) -I${srcdir}/../src ${CPP_CFLAGS} ${srcdir}/emacsserver.c $(LOADLIBES) -o emacsserver
f7dbcf3c 244
0d73e8e3 245emacsclient: ${srcdir}/emacsclient.c ../src/config.h
5293b432 246 $(CC) -I${srcdir}/../src ${CPP_CFLAGS} ${srcdir}/emacsclient.c $(LOADLIBES) -o emacsclient
f7dbcf3c 247
0d73e8e3 248hexl: ${srcdir}/hexl.c
5293b432 249 $(CC) ${CPP_CFLAGS} ${srcdir}/hexl.c $(LOADLIBES) -o hexl
f7dbcf3c 250
9ff5de07 251TIMEROBJS=getdate.o timer.o $(ALLOCA)
0d73e8e3
JB
252getdate.o: ${srcdir}/getdate.y ../src/config.h
253 ${YACC} ${YFLAGS} ${srcdir}/getdate.y
5293b432 254 $(CC) -I${srcdir}/../src $(CPP_CFLAGS) -c y.tab.c
43bf8b0e 255 mv y.tab.o getdate.o
0d73e8e3 256timer.o: ${srcdir}/timer.c ../src/config.h
5293b432 257 $(CC) -c -I${srcdir}/../src $(CPP_CFLAGS) ${srcdir}/timer.c
9ff5de07 258timer: ${TIMEROBJS}
a2108602 259 $(CC) -I${srcdir}/../src $(ALL_CFLAGS) ${TIMEROBJS} $(LOADLIBES) -o timer
f7dbcf3c 260
0d73e8e3 261make-path: ${srcdir}/make-path.c
5293b432 262 $(CC) $(CPP_CFLAGS) ${srcdir}/make-path.c -o make-path
ecc798b0 263
f7dbcf3c
JB
264# These are NOT included in INSTALLABLES or UTILITIES.
265# See ../src/ymakefile.
0d73e8e3 266emacstool: ${srcdir}/emacstool.c
5293b432 267 $(CC) ${srcdir}/emacstool.c -o emacstool ${CPP_CFLAGS} \
f7dbcf3c
JB
268 -lsuntool -lsunwindow -lpixrect $(LOADLIBES)
269
270# For SUN Japanese Language Environment
0d73e8e3 271nemacstool: ${srcdir}/emacstool.c
5293b432 272 $(CC) -o nemacstool -DJLE ${CPP_CFLAGS} ${srcdir}/emacstool.c \
f7dbcf3c
JB
273 -lsuntool -lmle -lsunwindow -lpixrect $(LOADLIBES)
274
0d73e8e3 275xvetool: ${srcdir}/emacstool.c
5293b432 276 $(CC) -o xvetool -DXVIEW ${CPP_CFLAGS} ${srcdir}/emacstool.c \
f7dbcf3c
JB
277 -lxview -lX -I$(OPENWINHOME)/include -L$(OPENWINHOME)/lib \
278 $(LOADLIBES)
279
0d73e8e3 280xveterm: ${srcdir}/emacstool.c
5293b432 281 $(CC) -o xveterm -DXVIEW -DTTERM ${CPP_CFLAGS} ${srcdir}/emacstool.c \
f7dbcf3c
JB
282 -lxview -lolgx -lX -I$(OPENWINHOME)/include -L$(OPENWINHOME)/lib \
283 $(LOADLIBES)
284
0d73e8e3 285aixcc: ${srcdir}/aixcc.c
5293b432 286 $(CC) $(CPP_CFLAGS) -o aixcc ${srcdir}/aixcc.c
f7dbcf3c 287
0d73e8e3
JB
288aixcc.c: ${srcdir}/aixcc.lex
289 lex ${srcdir}/aixcc.lex
f7dbcf3c 290 mv lex.yy.c aixcc.c