e35610d27fbc81bfad2486f59080a0615d257ec7
[bpt/emacs.git] / lib-src / Makefile.in
1 ### @configure_input@
2
3 # Copyright (C) 1985, 1987-1988, 1993-1994, 2001-2014 Free Software
4 # 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 SHELL = @SHELL@
22
23 # Following ../lisp/Makefile.in.
24 EMACS = ../src/emacs
25 EMACSOPT = -batch --no-site-file --no-site-lisp
26
27 # ==================== Things `configure' will edit ====================
28
29 CC=@CC@
30 CFLAGS=@CFLAGS@
31 CPPFLAGS=@CPPFLAGS@
32 version=@version@
33 ## Used in $archlibdir.
34 configuration=@configuration@
35 EXEEXT=@EXEEXT@
36 C_SWITCH_SYSTEM=@C_SWITCH_SYSTEM@
37 C_SWITCH_MACHINE=@C_SWITCH_MACHINE@
38 PROFILING_CFLAGS = @PROFILING_CFLAGS@
39 WARN_CFLAGS = @WARN_CFLAGS@
40 WERROR_CFLAGS = @WERROR_CFLAGS@
41 UPDATE_MANIFEST = @UPDATE_MANIFEST@
42
43 # Program name transformation.
44 TRANSFORM = @program_transform_name@
45
46 # ==================== Where To Install Things ====================
47
48 # Location to install Emacs.app under GNUstep / Mac OS X.
49 # Later values may use this.
50 ns_appbindir=@ns_appbindir@
51
52 # The default location for installation. Everything is placed in
53 # subdirectories of this directory. The default values for many of
54 # the variables below are expressed in terms of this one, so you may
55 # not need to change them. This is set with the --prefix option to
56 # `../configure'.
57 prefix=@prefix@
58
59 # Like `prefix', but used for architecture-specific files. This is
60 # set with the --exec-prefix option to `../configure'.
61 exec_prefix=@exec_prefix@
62
63 # Where to install Emacs and other binaries that people will want to
64 # run directly (like etags). This is set with the --bindir option
65 # to `../configure'.
66 bindir=@bindir@
67
68 # Where to install and expect executable files to be run by Emacs
69 # rather than directly by users, and other architecture-dependent
70 # data. ${archlibdir} is usually below this. This is set with the
71 # --libexecdir option to `../configure'.
72 libexecdir=@libexecdir@
73
74 # Directory for local state files for all programs.
75 localstatedir=@localstatedir@
76
77 # Where to find the source code. This is set by the configure
78 # script's `--srcdir' option. However, the value of ${srcdir} in
79 # this makefile is not identical to what was specified with --srcdir,
80 # since the variable here has `/lib-src' added at the end.
81
82 # We use $(srcdir) explicitly in dependencies so as not to depend on VPATH.
83 srcdir=@srcdir@
84 VPATH=@srcdir@
85
86 # The top-level source directory, also set by configure.
87 top_srcdir=@top_srcdir@
88 # MinGW CPPFLAGS may use this.
89 abs_top_srcdir=@abs_top_srcdir@
90
91 # ==================== Emacs-specific directories ====================
92
93 # These variables hold the values Emacs will actually use. They are
94 # based on the values of the standard Make variables above.
95
96 # Where to put executables to be run by Emacs rather than the user.
97 # This path usually includes the Emacs version and configuration name,
98 # so that multiple configurations for multiple versions of Emacs may
99 # be installed at once. This can be set with the --archlibdir option
100 # to `../configure'.
101 archlibdir=@archlibdir@
102
103 gamedir=@gamedir@
104 gameuser=@gameuser@
105
106 # ==================== Utility Programs for the Build =================
107
108 # ../configure figures out the correct values for these.
109 INSTALL = @INSTALL@
110 INSTALL_PROGRAM = @INSTALL_PROGRAM@
111 INSTALL_SCRIPT = @INSTALL_SCRIPT@
112 # By default, we uphold the dignity of our programs.
113 INSTALL_STRIP =
114 MKDIR_P = @MKDIR_P@
115
116 # ========================== Lists of Files ===========================
117
118 # emacsclientw.exe for MinGW, empty otherwise
119 CLIENTW = @CLIENTW@
120
121 # Things that a user might actually run, which should be installed in bindir.
122 INSTALLABLES = etags${EXEEXT} ctags${EXEEXT} emacsclient${EXEEXT} $(CLIENTW) \
123 ebrowse${EXEEXT}
124
125 INSTALLABLE_SCRIPTS = grep-changelog
126
127 # Things that Emacs runs internally, or during the build process,
128 # which should not be installed in bindir.
129 UTILITIES = profile${EXEEXT} movemail${EXEEXT} hexl${EXEEXT} \
130 update-game-score${EXEEXT}
131
132 DONT_INSTALL= make-docfile${EXEEXT}
133
134 # Like UTILITIES, but they're not system-dependent, and should not be
135 # deleted by the distclean target.
136 SCRIPTS= rcs2log $(UPDATE_MANIFEST)
137
138 # All files that are created by the linker, i.e., whose names end in ${EXEEXT}.
139 EXE_FILES = ${INSTALLABLES} ${UTILITIES} ${DONT_INSTALL}
140
141 # Specify additional -D flags for movemail. Options:
142 # -DMAIL_USE_FLOCK or -DMAIL_USE_LOCKF (use flock or lockf for file locking).
143 # See the comments about locking in movemail.c. Normally the values
144 # set by configure should be correct and you should not need to do anything.
145 # If neither flag is set, you need to use blessmail.
146 MOVE_FLAGS=
147
148 ## Empty if either MAIL_USE_FLOCK or MAIL_USE_LOCKF, else need-blessmail.
149 BLESSMAIL_TARGET=@BLESSMAIL_TARGET@
150
151 ## -lkrb or -lkrb4 if needed
152 KRB4LIB=@KRB4LIB@
153 ## -ldes or -ldes425 if needed
154 DESLIB=@DESLIB@
155 ## -lkrb5 if needed
156 KRB5LIB=@KRB5LIB@
157 ## -lk5crypto or -lcrypto if needed
158 CRYPTOLIB=@CRYPTOLIB@
159 ## -lcom_err if needed
160 COM_ERRLIB=@COM_ERRLIB@
161 ## -lhesiod if needed
162 LIBHESIOD=@LIBHESIOD@
163 ## -lresolv if HAVE_LIBRESOLV
164 LIBRESOLV=@LIBRESOLV@
165 ## -llockfile if HAVE_LIBLOCKFILE or -lmail if HAVE_LIBMAIL
166 LIBS_MAIL=@LIBS_MAIL@
167 ## empty or -lrt or -lposix4 if HAVE_CLOCK_GETTIME
168 LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
169 ## empty or -lrt or -lposix4 if HAVE_FDATASYNC
170 LIB_FDATASYNC = @LIB_FDATASYNC@
171 ## empty or -lwsock2 for MinGW
172 LIB_WSOCK32=@LIB_WSOCK32@
173
174 ## Extra libraries to use when linking movemail.
175 LIBS_MOVE = $(LIBS_MAIL) $(KRB4LIB) $(DESLIB) $(KRB5LIB) $(CRYPTOLIB) \
176 $(COM_ERRLIB) $(LIBHESIOD) $(LIBRESOLV) $(LIB_WSOCK32)
177
178 ## Extra libraries when linking emacsclient
179 ## (empty or -lcomctl32 for MinGW)
180 LIBS_ECLIENT = @LIBS_ECLIENT@
181
182 ## Extra object files for linking for MinGW
183 NTLIB = @NTLIB@
184 CLIENTRES = @CLIENTRES@
185 WINDRES = @WINDRES@
186
187 ## Some systems define this to request special libraries.
188 LIBS_SYSTEM = @LIBS_SYSTEM@
189
190 BASE_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) \
191 $(WARN_CFLAGS) $(WERROR_CFLAGS) \
192 -I. -I../src -I../lib \
193 -I${srcdir} -I${srcdir}/../src -I${srcdir}/../lib
194
195 ALL_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${LDFLAGS} ${CPPFLAGS} ${CFLAGS}
196 LINK_CFLAGS = ${BASE_CFLAGS} ${LDFLAGS} ${CFLAGS}
197 CPP_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${CPPFLAGS} ${CFLAGS}
198
199 # Configuration files for .o files to depend on.
200 config_h = ../src/config.h $(srcdir)/../src/conf_post.h
201
202 all: ${EXE_FILES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}
203
204 .PHONY: all need-blessmail maybe-blessmail
205
206 LOADLIBES = ../lib/libgnu.a $(LIBS_SYSTEM)
207 $(EXE_FILES): ../lib/libgnu.a
208
209 ## Only used if we need blessmail, but no harm in always defining.
210 ## This makes the actual blessmail executable.
211 blessmail:
212 $(EMACS) $(EMACSOPT) -l $(srcdir)/../lisp/mail/blessmail.el
213 chmod +x blessmail
214
215 ## This checks if we need to run blessmail.
216 ## Do not charge ahead and do it! Let the installer decide.
217 need-blessmail: blessmail
218 @if [ `wc -l <blessmail` != 2 ] ; then \
219 dir=`sed -n -e 's/echo mail directory = \(.*\)/\1/p' blessmail`; \
220 echo "Assuming $$dir is really the mail spool directory, you should"; \
221 echo "run lib-src/blessmail $(DESTDIR)${archlibdir}/movemail${EXEEXT}"; \
222 echo "as root, to give movemail${EXEEXT} appropriate permissions."; \
223 echo "Do that after running make install."; \
224 fi
225
226 ## This is the target invoked by the top-level Makefile.
227 maybe-blessmail: $(BLESSMAIL_TARGET)
228
229 ## Install the internal utilities. Until they are installed, we can
230 ## just run them directly from lib-src.
231 ## If the chown/chmod commands fail, that is not a big deal.
232 ## update-game-score will detect at runtime that it is not setuid,
233 ## and handle things accordingly.
234 $(DESTDIR)${archlibdir}: all
235 @echo
236 @echo "Installing utilities run internally by Emacs."
237 umask 022; ${MKDIR_P} "$(DESTDIR)${archlibdir}"
238 exp_archlibdir=`cd "$(DESTDIR)${archlibdir}" && /bin/pwd`; \
239 if [ "$$exp_archlibdir" != "`/bin/pwd`" ]; then \
240 for file in ${UTILITIES}; do \
241 $(INSTALL_PROGRAM) $(INSTALL_STRIP) $$file "$(DESTDIR)${archlibdir}/$$file" ; \
242 done ; \
243 fi
244 umask 022; ${MKDIR_P} "$(DESTDIR)${gamedir}"; \
245 touch "$(DESTDIR)${gamedir}/snake-scores"; \
246 touch "$(DESTDIR)${gamedir}/tetris-scores"
247 -if chown ${gameuser} "$(DESTDIR)${archlibdir}/update-game-score${EXEEXT}" && chmod u+s "$(DESTDIR)${archlibdir}/update-game-score${EXEEXT}"; then \
248 chown ${gameuser} "$(DESTDIR)${gamedir}"; \
249 chmod u=rwx,g=rwx,o=rx "$(DESTDIR)${gamedir}"; \
250 fi
251 exp_archlibdir=`cd "$(DESTDIR)${archlibdir}" && /bin/pwd`; \
252 if [ "$$exp_archlibdir" != "`cd ${srcdir} && /bin/pwd`" ]; then \
253 for file in ${SCRIPTS}; do \
254 $(INSTALL_SCRIPT) ${srcdir}/$$file "$(DESTDIR)${archlibdir}/$$file"; \
255 done ; \
256 fi
257
258 .PHONY: install uninstall mostlyclean clean distclean maintainer-clean
259 .PHONY: bootstrap-clean extraclean check tags
260
261 install: $(DESTDIR)${archlibdir}
262 @echo
263 @echo "Installing utilities for users to run."
264 umask 022; ${MKDIR_P} "$(DESTDIR)${bindir}"
265 for file in ${INSTALLABLES} ; do \
266 $(INSTALL_PROGRAM) $(INSTALL_STRIP) $${file} "$(DESTDIR)${bindir}"/`echo $${file} | sed -e 's/${EXEEXT}$$//' -e '$(TRANSFORM)'`${EXEEXT} ; \
267 done
268 for file in ${INSTALLABLE_SCRIPTS} ; do \
269 $(INSTALL_SCRIPT) ${srcdir}/$${file} "$(DESTDIR)${bindir}"/`echo $${file} | sed '$(TRANSFORM)'` ; \
270 done
271
272 uninstall:
273 for file in ${INSTALLABLES}; do \
274 rm -f "$(DESTDIR)${bindir}"/`echo $${file} | sed -e 's/${EXEEXT}$$//' -e '$(TRANSFORM)'`${EXEEXT} ; \
275 done
276 for file in ${INSTALLABLE_SCRIPTS}; do \
277 rm -f "$(DESTDIR)${bindir}"/`echo $${file} | sed '$(TRANSFORM)'` ; \
278 done
279 if [ -d "$(DESTDIR)${archlibdir}" ]; then \
280 (cd "$(DESTDIR)${archlibdir}" && rm -f ${UTILITIES} ${SCRIPTS}) \
281 fi
282
283 mostlyclean:
284 -rm -f core *.o *.res
285
286 clean: mostlyclean
287 -rm -f ${EXE_FILES}
288
289 distclean: clean
290 -rm -f TAGS
291 -rm -f Makefile blessmail
292
293 bootstrap-clean maintainer-clean: distclean
294 true
295
296 extraclean: maintainer-clean
297 -rm -f *~ \#*
298
299 ## Test the contents of the directory.
300 check:
301 @echo "We don't have any tests for the lib-src/ directory yet."
302
303 tags: TAGS
304 TAGS: etags${EXEEXT}
305 etags *.[ch]
306
307 ../lib/libgnu.a: $(config_h)
308 $(MAKE) -C ../lib libgnu.a
309
310 regex.o: $(srcdir)/../src/regex.c $(srcdir)/../src/regex.h $(config_h)
311 ${CC} -c ${CPP_CFLAGS} ${srcdir}/../src/regex.c
312
313
314 etags_deps = ${srcdir}/etags.c regex.o $(NTLIB) $(config_h)
315 etags_cflags = -DEMACS_NAME="\"GNU Emacs\"" -DVERSION="\"${version}\"" -o $@
316 etags_libs = regex.o $(LOADLIBES) $(NTLIB)
317
318 etags${EXEEXT}: ${etags_deps}
319 $(CC) ${ALL_CFLAGS} $(etags_cflags) $(srcdir)/etags.c $(etags_libs)
320
321 ## ctags.c is distinct from etags.c so that parallel makes do not write two
322 ## etags.o files on top of each other.
323 ## FIXME?
324 ## Can't we use a wrapper that calls 'etags --ctags'?
325 ctags${EXEEXT}: ctags.c ${etags_deps}
326 $(CC) ${ALL_CFLAGS} $(etags_cflags) $(srcdir)/ctags.c $(etags_libs)
327
328 ebrowse${EXEEXT}: ${srcdir}/ebrowse.c ${srcdir}/../lib/min-max.h $(NTLIB) \
329 $(config_h)
330 $(CC) ${ALL_CFLAGS} -DVERSION="\"${version}\"" \
331 ${srcdir}/ebrowse.c $(LOADLIBES) $(NTLIB) -o $@
332
333 profile${EXEEXT}: ${srcdir}/profile.c $(NTLIB) $(config_h)
334 $(CC) ${ALL_CFLAGS} ${srcdir}/profile.c \
335 $(LOADLIBES) $(NTLIB) $(LIB_CLOCK_GETTIME) -o $@
336
337 make-docfile${EXEEXT}: ${srcdir}/make-docfile.c $(NTLIB) $(config_h)
338 $(CC) ${ALL_CFLAGS} ${srcdir}/make-docfile.c $(LOADLIBES) $(NTLIB) \
339 -o $@
340
341 movemail${EXEEXT}: ${srcdir}/movemail.c pop.o $(NTLIB) $(config_h)
342 $(CC) ${ALL_CFLAGS} ${MOVE_FLAGS} ${srcdir}/movemail.c pop.o \
343 $(LOADLIBES) $(NTLIB) $(LIBS_MOVE) -o $@
344
345 pop.o: ${srcdir}/pop.c ${srcdir}/pop.h ${srcdir}/../lib/min-max.h $(config_h)
346 $(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/pop.c
347
348 emacsclient${EXEEXT}: ${srcdir}/emacsclient.c $(NTLIB) $(config_h)
349 $(CC) ${ALL_CFLAGS} ${srcdir}/emacsclient.c \
350 -DVERSION="\"${version}\"" $(NTLIB) $(LOADLIBES) $(LIB_FDATASYNC) \
351 $(LIB_WSOCK32) $(LIBS_ECLIENT) -o $@
352
353 emacsclientw${EXEEXT}: ${srcdir}/emacsclient.c $(NTLIB) $(CLIENTRES) $(config_h)
354 $(CC) ${ALL_CFLAGS} $(CLIENTRES) -mwindows ${srcdir}/emacsclient.c \
355 -DVERSION="\"${version}\"" $(LOADLIBES) $(LIB_FDATASYNC) \
356 $(LIB_WSOCK32) $(LIBS_ECLIENT) -o $@
357
358 NTINC = ${srcdir}/../nt/inc
359 NTDEPS = $(NTINC)/ms-w32.h $(NTINC)/sys/stat.h $(NTINC)/inttypes.h \
360 $(NTINC)/stdint.h $(NTINC)/pwd.h $(NTINC)/sys/time.h $(NTINC)/stdbool.h \
361 $(NTINC)/sys/wait.h $(NTINC)/unistd.h $(NTINC)/sys/file.h $(NTINC)/netdb.h
362
363 # The dependency on $(NTDEPS) is a trick intended to cause recompile of
364 # programs on MinGW whenever some private header in nt/inc is modified.
365 ntlib.o: ${srcdir}/ntlib.c ${srcdir}/ntlib.h $(NTDEPS)
366 $(CC) -c ${CPP_CFLAGS} ${srcdir}/ntlib.c
367
368 hexl${EXEEXT}: ${srcdir}/hexl.c $(NTLIB) $(config_h)
369 $(CC) ${ALL_CFLAGS} ${srcdir}/hexl.c $(LOADLIBES) -o $@
370
371 update-game-score${EXEEXT}: ${srcdir}/update-game-score.c $(NTLIB) $(config_h)
372 $(CC) ${ALL_CFLAGS} -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\"" \
373 ${srcdir}/update-game-score.c $(LOADLIBES) $(NTLIB) \
374 -o $@
375
376 emacsclient.res: $(NTINC)/../emacsclient.rc
377 $(WINDRES) -O coff --include-dir=$(NTINC)/.. -o $@ \
378 $(NTINC)/../emacsclient.rc
379
380 ## Makefile ends here.